Re: saturation in IIR Filter



On Fri, 04 Apr 2008 03:33:14 -0500, sooraj.tp wrote:

On Thu, 03 Apr 2008 05:21:20 -0500, sooraj.tp wrote:

hi
i implemented an IIR filter in vhdl with 16 bit input and
coefficients and 16 bit output.Here i used multiplier and accumulator
of
length 32 bit.Now i am facing a problem of bit growth in the output.I
read that saturation and rounding is a best way to avoid bit
growth.Can
you explain the procedure for saturation and rounding and where i want
to rounding-off the bits?

Thanx in advance

Saturation means monitoring the results of an add or shift, and
saturating if there is overflow. With addition, assuming that you're
using 2's complement math, if the carry bit doesn't agree with the sign
bit then you've overflowed and you need to saturate your number to
0x80000000 or 0x7fffffff depending on the value of the carry. If, when
you go from 32 to 16 bits you keep anything but the most significant 16
bits, then you have to limit the magnitude of any 32 bit number that
would result in a 16-bit number that is 'too big'.

BTW: If this is a second order filter you may find that 16-bit data
paths

are too small, at least for the intermediate values. IIR filters can
require an amount of precision that astonishes the newbie.

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html


hai Tim,
Actually my aim is to implement multi-order IIR filter using
multiple biquad structures(second order).When i was taken the MSB
bits,there occurs a serious change in the original result and rounded
result.when i round this 0x10000 to a 16 bit value by maintaining the
MSBs i got 0x0001.ie the difference between original and obtained result
is 0xFFFF.Is this due to the effect of saturation logic?if so,is this
error accumulated to large error?

0x10000 is outside of the domain of 16-bit numbers. Without knowing how
you got there, I can't comment on what the 'correct' thing to do with it
is.

In 2's complement (you are using signed numbers, yes?), adding 0x4001 to
0x4001 will give you 0x8002. This is cool, except that 0x4001 = 16385,
and 0x8002 (in twos compliment) = -32764, not the 32770 that you'd like.
So you have to saturate the result to 0x7fff (= 32767). While its not
the right answer, its generally a far less wrong answer than you'd
otherwise get.

You seem to be confusing rounding with saturation. Rounding is something
you do in preparation to trimming off less-significant bits; saturation
is something you must do when trimming off more-significant bits.

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
.



Relevant Pages

  • Re: Intercom
    ... I want to add several audio signals that where sampled by a A/D linear ... companding no keep the saturation at a minimum. ... Need to learn how to apply control theory in your embedded system? ... "Applied Control Theory for Embedded Systems" by Tim Wescott ...
    (comp.dsp)
  • Re: really low power transistors
    ... the _collector_ to emitter voltage at saturation? ... Need to learn how to apply control theory in your embedded system? ... "Applied Control Theory for Embedded Systems" by Tim Wescott ...
    (sci.electronics.basics)
  • Re: saturation in IIR Filter
    ... i implemented an IIR filter in vhdl with 16 bit input and ... read that saturation and rounding is a best way to avoid bit growth.Can ... Need to learn how to apply control theory in your embedded system? ... "Applied Control Theory for Embedded Systems" by Tim Wescott ...
    (comp.dsp)
  • Re: really low power transistors
    ... Base to emitter voltage at saturation? ... Need to learn how to apply control theory in your embedded system? ... "Applied Control Theory for Embedded Systems" by Tim Wescott ...
    (sci.electronics.basics)
  • Re: saturation in IIR Filter
    ... coefficients and 16 bit output.Here i used multiplier and accumulator ... read that saturation and rounding is a best way to avoid bit ... Actually my aim is to implement multi-order IIR filter using ...
    (comp.dsp)