FIR filter coefficient precision and their affect on filter performance. - Page 1
Forum section: electronics / projects

author: Boscoe
author_rank: Frequent Contributor
timestamp: May 17, 2017, 07:38:30 am
content: I'm currently undertaking a project implementing FIR filters in FPGA for audio. I'm generating the coefficients to 32bits from rePhase (great tool if you're interested in this sort of thing) but for the FPGA truncating them to 16bits, due to the nature of the sin(x)/x function the extremities are very low in value and this the vast majority of my 2048 coefficients are just zero. Could someone advise on how this could affect filter performance or maybe point me to a resource to find out? I may well bump it up to 24bits anyway but I would prefer not to as it means going up an FPGA size.ThanksBoscoe

author: nfmax
author_rank: Super Contributor
timestamp: May 17, 2017, 07:53:24 am
content: Because an FIR is a linear time-invariant system, the output from the filter with truncated coefficients is just the output from the filter with the coefficients as designed, less the output from a filter whose coefficients are the truncation errors. So you can simulate the 'truncation error' filter on its own, and evaluate its frequency response, to determine if the errors are significant for your application.

author: AndyC_772
author_rank: Super Contributor
timestamp: May 17, 2017, 09:36:58 am
content: Download yourself a copy of the free Iowa Hills FIR filter design tool. It has a 'test' mode where you can investigate the response of the filter with various levels of finite precision.

author: tszaboo
author_rank: Super Contributor
timestamp: May 17, 2017, 10:03:19 am
content: You can quickly evaluate these things easily, if you break down the filter into two stages. So you dont have a 16x16 multiplyer with 16 bit result, but a 16x16 multiplyer with a 32 bit result, and a 16 bit truncate, AKA, 16 bit quantization. The noise of such operation is known, 6 x bit+2 decibel (lazy numbers). So just evaluate the amount of noise added by each quantization.

author: danadak
author_rank: Super Contributor
timestamp: May 17, 2017, 12:56:01 pm
content: Google "coefficient sensitivity fir digital filter", quite a few papers,ap notes out there.Regards, Dana.

author: Boscoe
author_rank: Frequent Contributor
timestamp: May 17, 2017, 07:36:39 pm
content: Thank you everyone, I downloaded Iowa and found the experimenting interesting and insightful. I will continue to read on the topic.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 17, 2017, 08:41:07 pm
content: High order IIR is very sensitive, in that small errors can cause numerical instability and the whole thing explodes. (For this reason, IIR filters are usually designed the same way op-amp filters are: a chain of double-pole filters, the poles being arranged to match a given synthesis type. The maximum filter order, per stage, is 2, so the numerical accuracy isn't ridiculous.)But FIR filters have no stability concerns, so they need few bits beyond the operand size, just enough to avoid excessive rounding (which should probably be on the order of Lg(N) extra bits, for N taps).As mentioned above, you can calculate the error, and probably twiddle a few bits here and there to get an optimal filter response.You can also investigate other architectures, like using a decimating filter into a smaller (lower sample rate) filter, or the chain of IIR stages I mentioned before (given that you may need more bits per stage, but much fewer taps, to realize an equivalent response).Tim