// fir_hls.hpp // Types and constants for the HLS FIR kernel in fir_hls.cpp. // Same filter as the hand-written RTL in lesson 15 (fir_transposed.sv): // 31 taps, Q1.15 samples and coefficients, round half up, saturate to 16 bits. #ifndef FIR_HLS_HPP #define FIR_HLS_HPP #include constexpr int NTAPS = 31; // filter length constexpr int FRAC = 15; // fractional bits of the coefficients constexpr int MAX_LEN = 1024; // largest block one call processes using sample_t = std::int16_t; // Q1.15 sample using coef_t = std::int16_t; // Q1.15 coefficient using acc_t = std::int64_t; // wide enough for 31 products of 32 bits; an HLS // tool could use an exact width such as ap_int<37> // Filters len samples (len <= MAX_LEN). The filter state is kept between // calls, so a long signal can be sent in blocks. clear != 0 zeroes the state // before the first sample. void fir_hls(const sample_t in[MAX_LEN], sample_t out[MAX_LEN], int len, int clear); #endif // FIR_HLS_HPP