3.4. FIR Filter Compensation Coefficients
Typically, decimation or interpolation filtering applications require flat passband and narrow transition region filter performance. However, the CIC filter has drooping passband gains and wide transition regions. To overcome these problems connect the decimation or interpolation CIC filter to a compensation FIR filter, which narrows the output bandwidth and flattens the passband gain.
You can use a frequency sampling method to determine the coefficients of a FIR filter that equalizes the undesirable passband droop of the CIC and construct an ideal frequency response.
Determine the ideal frequency response by sampling the normalized magnitude response of the CIC filter before inverting the response.
Generally, only equalize the response in the passband, but you can sample further than the passband to fine tune the cascaded response of the filter chain.
The CIC IP generates a MATLAB script <variation_name>_fir_comp_coeff.m in the project directory. You can run this script in MATLAB to generate FIR coefficients that provide appropriate passband equalization. The generated coefficients are saved in a text file, for use by the FIR IP.
The MATLAB script requires the following parameters for the compensation FIR filter:
- L: FIR filter length, which is same as the number of taps or the number of coefficients
- F S : FIR filter sample rate in Hz before decimation/interpolation
- F C: FIR filter cutoff frequency in Hz
- B: Coefficient bit width if coefficients are written in fixed-point numbers
Figure 11. CIC and Compensation Filter Responses