The FFT supports runtime configuration and runtime status monitoring through the
configuration and status ports. These ports are defined as arguments to the FFT
function, shown here as variables fft_status1
and fft_config1
:
hls::fft<param1> (xn1, xk1, &fft_status1, &fft_config1);
The runtime configuration and status can be accessed using the predefined structs from the FFT C library:
- hls::ip_fft::config_t<param1>
- hls::ip_fft::status_t<param1>
The runtime configuration struct allows the following actions to be performed in the C code:
- Set the FFT length, if runtime configuration is enabled
- Set the FFT direction as forward or inverse
- Set the scaling schedule
The FFT length can be set as follows:
typedef hls::ip_fft::config_t<param1> config_t;
config_t fft_config1;
// Set FFT length to 512 => log2(512) =>9
fft_config1-> setNfft(9);
max_nfft
in the
static configuration.The FFT direction can be set as follows:
typedef hls::ip_fft::config_t<param1> config_t;
config_t fft_config1;
// Forward FFT
fft_config1->setDir(1);
// Inverse FFT
fft_config1->setDir(0);
The FFT scaling schedule can be set as follows:
typedef hls::ip_fft::config_t<param1> config_t;
config_t fft_config1;
fft_config1->setSch(0x2AB);
The output status port can be accessed using the pre-defined struct to determine:
- If any overflow occurred during the FFT
- The value of the block exponent
The FFT overflow mode can be checked as follows:
typedef hls::ip_fft::status_t<param1> status_t;
status_t fft_status1;
// Check the overflow flag
bool *ovflo = fft_status1->getOvflo();
And the block exponent value can be obtained using:
typedef hls::ip_fft::status_t<param1> status_t;
status_t fft_status1;
// Obtain the block exponent
unsigned int *blk_exp = fft_status1-> getBlkExp();