Author Topic: FIR filter coefficient precision and their affect on filter performance.  (Read 2777 times)

0 Members and 1 Guest are viewing this topic.

Offline BoscoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 279
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.

Thanks
Boscoe
 

Offline nfmax

  • Super Contributor
  • ***
  • Posts: 1604
  • Country: gb
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.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4281
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
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.

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7938
  • Country: nl
  • Current job: ATEX product design
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.
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Google "coefficient sensitivity fir digital filter", quite a few papers,
ap notes out there.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline BoscoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 279
Thank you everyone, I downloaded Iowa and found the experimenting interesting and insightful. I will continue to read on the topic.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22434
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
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
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf