We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for
Did you mean:
Explorer
415 Views
Registered: ‎10-16-2018

## FIR filter amplitude

Hi,

I used FIR filter for my system, and I imported the coeffecients form matlab using FDA tool.

In matlab (FDA tool), I set the stop band to - 80 dB and the pass band to 0 dB, as indicated in the first attached picture.

But when openning the the coeffeceint file in Vivado by FIR IP block and checking the frequency response of the filter, the situation was different. In fact, the pass band is 125 dB ! and stop band is 50 dB ! I think these are wrong values. How to modify these values in order to be the same of FDA matlab tool ?

Thanks.

1 Solution

Accepted Solutions
Voyager
339 Views
Registered: ‎08-16-2018

## Re: FIR filter amplitude

That's something you can (should) play with. If you select for your coefficients 'Quantize Only' in Quantization, you can have, for example, 16-bit coeffs with 8 fractional bits. If you increase your coeff size to 24 bits, the fractional part can be up to 16 bits. So your coeffs will always be at least 8 bits wide (the integer part).

Now, your data can be, for example, 32-bit wide and 32 fractional bits. That's good enough for many applications.

What happens is (I just realized that) your data is always scaled up because of the coefficients having and integer part of 8 bits min. So you need to scale down the values either before or after (better) the filter.

With regards to precision, 16-bit coeffs and 32-bit data is good enough. When using integer arithmetics there is always this trade-off, it's something you need to play with and choose a solution is good enough for you.

7 Replies
Highlighted
Voyager
402 Views
Registered: ‎08-16-2018

## Re: FIR filter amplitude

Are you using FIR Compiler 7.2?

One thing you can try is to copy-paste the coefficient vector. If too long, simplify your filter to have less coefficients, just to see where the difference comes from.

My first suspicion is about coefficient representation. In the implementation tab, in 'Data Path Options' you specify the datawidth (default 16) and number of fractional bits (default 0). This means your coefficients are integer 0 - 65535 and maybe your coefficients are real numbers 0.0 - 1.0 and artificially multiplied by 65536 (96 dB). Check that.

Explorer
393 Views
Registered: ‎10-16-2018

## Re: FIR filter amplitude

Hi @johnvivm ,

Kindly, see the attched two pictures of implemenatation tab settings. I didn't understand why I have to set the output data with to 16 bits ! That 's mean severely I have to truncate my output. Since the full precision is 38 bits of the fir compileer output.

Voyager
392 Views
Registered: ‎08-16-2018

## Re: FIR filter amplitude

Also, with your FDAtool your passband is around 56-57 kHz, while in your FIR it's slightly shifted to 0.58 - 0.59 and looks narrower and there are less side lobes, looks like a much lower order response, is it really the same thing?

Explorer
388 Views
Registered: ‎10-16-2018

## Re: FIR filter amplitude

Hi @johnvivm ,

About the passband frequency. It is the same in FDA tool (55.5 - 57 KHz) and in Xilinx FIR compiler we have normalized values, so it is calculated as follow :

0.578 * 192000(Fs)/ 2 = 55.5 kHz,

0.594 * 192000 / 2 = 57 kHz,

Thanks,

Voyager
340 Views
Registered: ‎08-16-2018

## Re: FIR filter amplitude

That's something you can (should) play with. If you select for your coefficients 'Quantize Only' in Quantization, you can have, for example, 16-bit coeffs with 8 fractional bits. If you increase your coeff size to 24 bits, the fractional part can be up to 16 bits. So your coeffs will always be at least 8 bits wide (the integer part).

Now, your data can be, for example, 32-bit wide and 32 fractional bits. That's good enough for many applications.

What happens is (I just realized that) your data is always scaled up because of the coefficients having and integer part of 8 bits min. So you need to scale down the values either before or after (better) the filter.

With regards to precision, 16-bit coeffs and 32-bit data is good enough. When using integer arithmetics there is always this trade-off, it's something you need to play with and choose a solution is good enough for you.

Explorer
139 Views
Registered: ‎10-16-2018

## Re: FIR filter amplitude

Hi @johnvivm ,

@johnvivm wrote:

What happens is (I just realized that) your data is always scaled up because of the coefficients having and integer part of 8 bits min. So you need to scale down the values either before or after (better) the filter.

How to "scale down the values" ?

Thanks.

Voyager
109 Views
Registered: ‎08-16-2018

## Re: FIR filter amplitude

`v2 <= v1(15 downto 3);`