This blog entry guides you through how to use the FIR filter feature of the Finite Impulse Response (FIR) compiler IP as a reloadable filter.
Prerequisites:
Below are the building blocks of the design:
1) Signal Generator
Signal Generator is used to generate the input signal for the FIR IP.
Signal generator can generate two types of signals:
The selection of input signal is based on a manual switch.
2) Reloadable Port
The timing diagram of the reloadable port is shown below:
Note: The reload channel handles the coefficients as "UFix" type.
The reload coefficients needs to be provided as Unsigned fix type and the FIR compiler will treat them as per the "Coefficient type" in the FIR GUI.
For example if '-7' is the coefficient provided in the reload channel to the FIR, and the FIR has the Coefficient type set as Fix_16_0, then the reload coefficient value of -7 in Ufix_16_0 format will be "65529".
3) Filter Specification
This design uses two coefficient sets:
a) Low Pass Filter (LPF) with the specifications shown below.
b) High Pass Filter (HPF) with the specifications shown below.
Initially the LPF coefficients are added to FIR, then the HPF coefficients are reloaded.
Notes:
1) Make sure that the filter coefficients are symmetric for both LPF and HPF.
It is possible for the HPF to have an asymmetric coefficient and the LPF to have a symmetric one.
In that scenario if we use the LPF in the FIR compiler with the inferred option, then we will get incorrect results.
If you have different kinds of symmetry, then use the 'non-symmetric' option in FIR.
2) The order of both filters should be the same.
To run the design, please follow the steps below:
coeff2=xlfda_numerator('HPF');
Num = (xlGetReOrderedCoeff(coeff2,'coeff', gcbh))';
The command xlfda_numerator('HPF') is used to generate the coefficient for the HPF filter.
The command (xlGetReOrderedCoeff(coeff2,'coeff', gcbh))' is used to extract the coefficient which is given as input to the FIR Filter.
Input signal: sin tone
Output signal:
Input signal: Random
Output signal:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.