Coding Style for Array to Stream - 2021.1 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2021-06-16
Version
2021.1 English

You should perform all the operations on temp variables. Read the input stream, process the temp variable, and write the output stream, as shown in the example below. This approach lets you preserve the sequential reading and writing of the stream of data, rather than attempting multiple or random reads or writes.

struct A {
  short varA;
  int varB;
};
 
void dut(A in[N], A out[N], bool flag) {
  #pragma HLS interface mode=axis port=in,out
  for (unsigned i=0; i<N; i++) {
    A tmp = in[i];
    if (flag)
      tmp.varB += 5;
    out[i] = tmp;
  }
}

If this coding style is not adhered to, it will lead to functional failures of the stream processing.