09-26-2016 08:33 AM
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.
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?
09-26-2016 10:41 AM
09-26-2016 11:58 AM
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 :-)