The writeOut_row function is defined in the following example. It is structurally similar to readIn_row.
void writeOut_row(hls::stream<ap_axiu<128, 0, 0, 0>> &strm_out,
cmpxDataOut out[MAT_COLS]
)
{
#if FFT_2D_DT == 0 // cint16 datatype
LOOP_FFT_ROW_WRITE_OUT:for(int j = 0; j < MAT_COLS; j += 4) {
#pragma HLS PIPELINE II=1
#pragma HLS loop_tripcount min=16 max=512
ap_axiu<128, 0, 0, 0> ap;
cmpxDataOut tmp;
tmp = out[j];
ap.data.range( 15, 0) = real(tmp).range(15, 0);
ap.data.range( 31, 16) = imag(tmp).range(15, 0);
tmp = out[j+1];
ap.data.range( 47, 32) = real(tmp).range(15, 0);
ap.data.range( 63, 48) = imag(tmp).range(15, 0);
tmp = out[j+2];
ap.data.range( 79, 64) = real(tmp).range(15, 0);
ap.data.range( 95, 80) = imag(tmp).range(15, 0);
tmp = out[j+3];
ap.data.range(111, 96) = real(tmp).range(15, 0);
ap.data.range(127, 112) = imag(tmp).range(15, 0);
strm_out.write(ap);
}
#else // cfloat datatype
LOOP_FFT_ROW_WRITE_OUT:for(int j = 0; j < MAT_COLS; j += 2) {
#pragma HLS PIPELINE II=1
#pragma HLS loop_tripcount min=32 max=1024
ap_axiu<128, 0, 0, 0> ap;
AXI_DATA rowOut;
cmpxDataOut tmp;
tmp = out[j];
rowOut.fl_data[0] = real(tmp);
rowOut.fl_data[1] = imag(tmp);
tmp = out[j+1];
rowOut.fl_data[2] = real(tmp);
rowOut.fl_data[3] = imag(tmp);
ap.data.range( 63, 0) = rowOut.data[0];
ap.data.range(127, 64) = rowOut.data[1];
strm_out.write(ap);
}
#endif
}
The fft_2d kernel specifies HLS pragmas to help optimize the kernel code and adhere to interface protocols. Refer to this page for detailed documentation of all HLS pragmas. A summary of the HLS pragmas used in this kernel is given in the following table.
Switch |
Description |
|---|---|
#pragma HLS INTERFACE |
In C/C++ code, all input and output operations are performed, in zero time, through formal function arguments. In a RTL design, these same input and output operations must be performed through a port in the design interface and typically operate using a specific input/output (I/O) protocol. For more information, refer to this page. |
#pragma HLS PIPELINE II=1 |
Reduces the initiation interval (II) for a function or loop by allowing the concurrent execution of operations. The default type of pipeline is defined by the |
#pragma HLS dataflow |
The |
#pragma HLS array_reshape |
The |