We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Observer shakeelsultan
Registered: ‎07-01-2008

HLS fft_single example in streaming mode.

How can I run xilinx provided fft_single example in streaming mode?

I tried declaring [in, out ] ports of fft_top as streaming inputs. Though the design gets synthesized but I get a shifted output on each run.

Can anyone help please?

0 Kudos
1 Reply
Xilinx Employee
Xilinx Employee
Registered: ‎09-05-2018

Re: HLS fft_single example in streaming mode.

Hey @shakeelsultan ,

We highly recommend the hls streaming library "hls_stream.h" and hls::stream<> types. I was able to rewrite the example to use streaming accesses as follows.

In the tesbench, replace the arrays with hls::stream types:


    //static cmpxDataIn xn_input[SAMPLES];
    hls::stream<cmpxDataIn> xn_input_stream;
    //static cmpxDataOut xk_output[SAMPLES];
    hls::stream<cmpxDataOut> xk_output_stream;

Fill the streams with the data in the testbench using << or .write():



//xn_input[line_no-5] = cmpxDataIn(input_data_re, input_data_im);
xn_input_stream <<  cmpxDataIn(input_data_re, input_data_im);

Read out the output stream. A little more refactoring here because you must only each streaming output once:

  //if (golden != xk_output[i].re)
cmpxDataOut res = xk_output_stream.read();
if (golden != res.real())

res.real() and res.imag() and compared and printed after that. If you don't add the .read(); line there, you could get up to 4 accesses to the stream, which could cause a co-sim failure.

The dummy_proc_[be/fe]() functions need slight changes as well:

void dummy_proc_fe() {
 for (i=0; i< FFT_LENGTH; i++) out[i] = in.read(); // out[i] = in[i];
void dummy_proc_be() {
for (i=0; i< FFT_LENGTH; i++) out.write(in[i]); //out[i] = in[i];

And then the funciton headers need to be changed to pass in pointers to hls::stream types:

void dummy_proc_fe(
    bool direction,
    config_t* config,
	hls::stream<cmpxDataIn> &in,
    cmpxDataIn out[FFT_LENGTH]);

void dummy_proc_be(
    status_t* status_in,
    bool* ovflo,
    cmpxDataOut in[FFT_LENGTH],
	hls::stream<cmpxDataOut> &out);

void fft_top(
    bool direction,
    hls::stream<complex<data_in_t> > &in,
    hls::stream<complex<data_out_t> > &out,
    bool* ovflo);

That's how I would recommend you change from fifo to streaming. Generally, it's not advised to just use the #pragma HLS STREAM directive because you need to carefully keep track of your reads and writes.

Nicholas Moellers

Xilinx Worldwide Technical Support
0 Kudos