**UPGRADE YOUR BROWSER**

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!

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community Forums
- :
- Forums
- :
- Design Tools
- :
- Design Entry
- :
- Re: FIR filter amplitude

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

ahmed_alfadhel

Explorer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-04-2019 03:17 AM

415 Views

Registered:
10-16-2018

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

johnvivm

Voyager

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-04-2019 05:10 AM - edited 06-04-2019 05:17 AM

339 Views

Registered:
08-16-2018

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
##

Jump to solution

johnvivm

Voyager

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-04-2019 04:04 AM

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.

ahmed_alfadhel

Explorer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-04-2019 04:36 AM

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.

johnvivm

Voyager

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-04-2019 04:39 AM

392 Views

Registered:
08-16-2018

Re: FIR filter amplitude

ahmed_alfadhel

Explorer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-04-2019 04:49 AM - edited 06-04-2019 04:57 AM

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,

johnvivm

Voyager

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-04-2019 05:10 AM - edited 06-04-2019 05:17 AM

340 Views

Registered:
08-16-2018

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.

ahmed_alfadhel

Explorer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-25-2019 06:35 PM - edited 06-25-2019 06:37 PM

139 Views

Registered:
10-16-2018

Re: FIR filter amplitude

Hi @johnvivm ,

Thank you for your informations.

@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.

johnvivm

Voyager

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-26-2019 12:17 AM

109 Views

Registered:
08-16-2018

Re: FIR filter amplitude

"scale down" is a technicism for "divide" to look more clever than a schoolboy.

The most economic way of scaling down is dividing by 2,4,8, etc. by shifting (or simply not using) the lowest bits.

For example when you assign:

v2 <= v1(15 downto 3);

you are scaling down by 8