From: Anindya G on
Hello,

I am designing a filter chain on FPGA which decimates the input data at 200MHz by 20 using two halfband filters and one polyphase decimate-by-5 filter. I tried generating the coefficients and then quantizing them before I use them for my HDL code.

Following is my code:
-----------------------------------
Fs_in = 200e6;
% Half Band Filter 1
dhb1 = fdesign.decimator(2, 'halfband', 'TW,AST', 40e6, 80, Fs_in);
hb1 = design(dhb1);
hb1q = dfilt.dffir(hb1.Numerator);
hb1q.Arithmetic = 'fixed'; % Default 16-bit coefficients

% Half Band Filter 2
dhb2 = fdesign.decimator(2, 'halfband', 'TW,AST', 20e6, 80, dhb1.Fs_out);
hb2 = design(dhb2);
hb2q = dfilt.dffir(hb2.Numerator);
hb2q.Arithmetic = 'fixed'; % Default 16-bit coefficients

% Low Pass Decimation Filter
Fpass1 = 5e6; % Passband Frequency
Fstop1 = 6e6; % Stopband Frequency
Apass1 = 0.1; % Passband Ripple (dB)
Astop1 = 80; % Aliasing Attenuation(dB)
M1 = 5; % Decimation Factor
TW1 = Fstop1 - Fpass1; % Transition Width (Hz)
dlow1 = fdesign.decimator(M1, 'nyquist', M1, TW1, Astop1, dhb2.Fs_out);
hlow1 = design(dlow1); % Lowpass prototype
Hlpf1 = mfilt.firdecim(M1, hlow1.Numerator);
hlpf1q = dfilt.dffir(Hlpf1.Numerator);
hlpf1q.Arithmetic = 'fixed'; % Default 16-bit coefficients
-----------------------------------

After all this when I plot the responses of the cascaded stage they look very different:
----------------------------------------
hcasc = cascade(hb1, hb2, Hlpf1); fvtool(hcasc,'Fs', Fs_in);
hcascq = cascade(hb1q, hb2q, hlpf1q); fvtool(hcascq,'Fs', Fs_in);
----------------------------------------

When I simulate my HDL code which uses these quantized coefficients for the filters, the output is dictated by the quantized cascaded filter object hcascq.

The response of individual fixed-point filters is pretty close to their refernce filter counterparts (i.e. freqz(hb1) and freqz(hb1q) are very similar to each other). But the cascaded effect messes every thing. Is there something crucial/obvious that I am missing here?

Any help would be greatly appreciated.

Regards,

Anindya G.