数据流 - 2021.2 Chinese

Vitis 高层次综合用户指南 (UG1399)

Document ID
UG1399
Release Date
2021-12-15
Version
2021.2 Chinese

针对 std::complex 的支持:

Vivado HLS 中,无法在数据流 (DATAFLOW) 中直接使用 std::complex 数据类型,因为存在多重读写程序问题。此多重读写程序问题原因在于调用了 std 类构造函数来初始化该值。如果同时在数据流中使用该变量作为通道,就会导致以上问题。但 Vitis 支持通过使用 no_ctor 属性来使用 std::complex,如下所示。

// Nothing to do here.
void proc_1(std::complex<float> (&buffer)[50], const std::complex<float> *in);
void proc_2(hls::stream<std::complex<float>> &fifo, const std::complex<float> (&buffer)[50], std::complex<float> &acc);
void proc_3(std::complex<float> *out, hls::stream<std::complex<float>> &fifo, const std::complex<float> acc);
 
void top(std::complex<float> *out, const std::complex<float> *in) {
#pragma HLS DATAFLOW
  std::complex<float> acc __attribute((no_ctor)); // here
  std::complex<float> buffer[50] __attribute__((no_ctor)); // here
  hls::stream<std::complex<float>, 5> fifo; // not here! (hls::stream has it internally)
 
  proc_1(buffer, in);
  proc_2(fifo, buffer, acc);
  porc_3(out, fifo, acc);
}