UPGRADE YOUR BROWSER

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!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer nchandra
Observer
5,079 Views
Registered: ‎02-18-2015

Using FFT with hls::stream

I am developing a communication system using hls::stream for the function interfaces. One of the steps involves taking the samples and feeding them through an FFT. However, the Vivado HLS method for using the FFT core is to use hls::fft, which expects two arrays, not streams, as input. What is the correct way to do this?

 

One method that seemed to work was to wrap the FFT call in a state machine that would collect the samples and store them in an array, then call hls::fft, and then send samples to the output stream. However, this requires the use of a static variable to keep track of the number of samples received so far. This means that when I have multiple FFT calls in the system, they all share the same static and go wrong.

 

https://forums.xilinx.com/t5/High-Level-Synthesis-HLS/HLS-when-sub-functions-requires-independent-static-variables/m-p/653824#M4873

seems to indicate that the correct way to handle the second case is to use an array of variables and feed them in to the functions. However, in the present case, this will be fairly complex since the FFT calls are inside another function that is itself instantiated multiple times (think multiple streams of data being processed).

 

What is the best way to use the FFT routines along with hls::stream?


Thanks,

Nitin

0 Kudos
2 Replies
Teacher muzaffer
Teacher
5,066 Views
Registered: ‎03-31-2012

Re: Using FFT with hls::stream

hls::fft just uses the xilinx fft ip which actually implements its interface with streams. You should be able to map the arrays in hls:fft interface to hls::stream rather easily. If this is not the case, I'd consider hls::fft to be broken ;-)
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Observer nchandra
Observer
5,057 Views
Registered: ‎02-18-2015

Re: Using FFT with hls::stream


@muzaffer wrote:
hls::fft just uses the xilinx fft ip which actually implements its interface with streams. You should be able to map the arrays in hls:fft interface to hls::stream rather easily. If this is not the case, I'd consider hls::fft to be broken ;-)

That is indeed what I had hoped, but on looking through hls_fft.h in more detail, this seems to be pretty much set. The declarations are all very clearly in terms of arrays, with no mention of hls::stream anywhere. At the moment i don't think I can get into modifying the C++ declarations to fix this, just wanted to know if there is some known way to do it.

 

 

As I develop my code further, though, I am finding that I am facing many more issues with using static variables to retain state across function calls. It makes the whole idea of reusing function code for multiple instances very, very difficult. The FFT seems to be a relatively simpler problem :-)

 

Thanks,

Nitin

0 Kudos