Vitis 1-D SSR FFT L1 module can be used in a C++ HLS design by:
1- Cloning Vitis DSP Library git repository and add the following path to compiler include path:
REPO_PATH/dsp/L1/include/hw/vitis_fft/float/
2- Include vt_fft.hpp
3- Use namespace xf::dsp::fft
4- Define fft parameter structure lets say call it params_float
by extending ssr_fft_default_params
like Defining 1-D SSR FFT Parameter Structure
5- call fft<params_float>(input_stream,output_stream)
The following section gives usage examples and explains some other interface level details for use in C++ based HLS design. To use the 1-D SSR FFT L1 module:
- Include the
vt_fft.hpp
header:
#include "vt_fft.hpp"
- Use namespace
xf::dsp::fft
using namespace xf::dsp::fft;
- Define a C++ structure that extends ssr_fft_default_params:
struct params_float:ssr_fft_default_params { static const int N = 1024; static const int R = 4; static const fft_output_order_enum output_data_order = SSR_FFT_NATURAL; static const transform_direction_enum transform_direction = FORWARD_TRANSFORM; };
- Call 1-D SSR FFT as follows:
fft<params_float>(inD,outD); //OR fft<ssr_fft_params,IID>(inD,outD); // IID: is a constant giving instance ID
where inD and outD are 1-dimensional hls::stream complex of ap_fixed, float or double type, synthesis and simulation use is already explained in the previous table. The I/O arrays can be declared as follows:
Fixed Point Type: First define input type, then using type traits calculate output type based on ssr_fft_params struct (output type calculation takes into consideration scaling mode based bit-growth and input bit-widths not relevant for type float).
typedef std::complex< float > I_TYPE; typedef xf::dsp::fft::ssr_fft_output_type<ssr_fft_params,I_TYPE>::t_ssr_fft_out O_TYPE; I_TYPE inD[SSR_FFT_R][SSR_FFT_L/SSR_FFT_R]; O_TYPE outD [R][L/R];
Here SSR_FFT_R defines SSR factor and SSR_FFT_L defines the size of the FFT transform.
Float/Double Type: First define the double/float input type, then using type traits calculate output type based on ssr_fft_params struct. For float types the output type calculation will return the same type as input.
typedef std::complex< float/double > I_TYPE; typedef hls::ssr_fft::ssr_fft_output_type<ssr_fft_params,I_TYPE>::t_ssr_fft_out O_TYPE; I_TYPE inD[SSR_FFT_R][SSR_FFT_L/SSR_FFT_R]; O_TYPE outD[SSR_FFT_R][SSR_FFT_L/SSR_FFT_R];