Reply by Ray Andraka March 25, 20042004-03-25
If the overflows are internal only, ie. if the added MSBs are not propagated all
the way to the output, then you don't need to add them provided your number
system is modular (2's complement is).   The arithmetic operations in the filter
are such that if you change one bit of an operand, only that bit and bits to the
left of it are affected.  Therefore, overflow bits internally do not affect
output bits with less significance.

Anatoli Sergienko wrote:

> > The only thing I would know is how many bits wide should I take for the > > intermediate results when I use an IIR filter. The input data is 24 bit. > > Should I use more than 24 bits to calculate the partial products, or not ? > > You need to add some MSBs. > The number of them depends on the filter sharpness. > If the filter is rather selectable you have to add even 8-12 MSBs. > Therefore the best solution is to simulate the filter with real signals, > investigate the overflows, > and select the minimum bit number which does not make the overflow. > > A.Ser.
-- --Ray Andraka, P.E. President, the Andraka Consulting Group, Inc. 401/884-7930 Fax 401/884-7950 email ray@andraka.com http://www.andraka.com "They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759
Reply by Anatoli Sergienko March 25, 20042004-03-25

> The only thing I would know is how many bits wide should I take for the > intermediate results when I use an IIR filter. The input data is 24 bit. > Should I use more than 24 bits to calculate the partial products, or not ?
You need to add some MSBs. The number of them depends on the filter sharpness. If the filter is rather selectable you have to add even 8-12 MSBs. Therefore the best solution is to simulate the filter with real signals, investigate the overflows, and select the minimum bit number which does not make the overflow. A.Ser.
Reply by John_H March 24, 20042004-03-24
"Sam (r&#4294967295;p. sans -no-sp-am)" <totalsam-no-sp-am@hotmail.com> wrote in message
news:4061ec72$0$702$5402220f@news.sunrise.ch...
> Thank you for all these answers ! > > The only thing I would know is how many bits wide should I take for the > intermediate results when I use an IIR filter. The input data is 24 bit. > Should I use more than 24 bits to calculate the partial products, or not ? > > Thank you ! > > Sam
There is no one answer for all IIR filters. You need to figure out what the maximum value *your system* can produce relative to the input scale for *your* desired IIR structure and how many bits you need for *your* desired IIR structure to get the stability and noise to acceptable levels.
Reply by Jerry Avins March 24, 20042004-03-24
Sam (r&#4294967295;p. sans -no-sp-am) wrote:

> Thank you for all these answers ! > > The only thing I would know is how many bits wide should I take for the > intermediate results when I use an IIR filter. The input data is 24 bit. > Should I use more than 24 bits to calculate the partial products, or not ? > > Thank you ! > > Sam
Yes -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by glen herrmannsfeldt March 24, 20042004-03-24
Ray Andraka wrote:

> FPGA arithmetic can be specified to the exact number of bits,
> not multiples of two bits. The difference with FPGAs is you > don't need to carry around extra bits to make the accumulator
> a multiple of some word size. Still, that does not > practically affect the IIR filter design appreciably.
> You have the same quantization effects to worry about > whether you use a microprocessor with fixed
> point or an FPGA with fixed point.
Well, on a 16 bit processor the discussion goes something like: "Is 16 bits enough, no, is 32 bits enough, yes." In the FPGA case you have to ask about the cost and benefit of each extra bit. (I was considering 2 bit/CLB architectures, but even there you don't need to use both.) One possibility is to choose an FPGA and then increase the bit width of intermediate values until it doesn't fit. -- glen
Reply by March 24, 20042004-03-24
Thank you for all these answers !

The only thing I would know is how many bits wide should I take for the
intermediate results when I use an IIR filter. The input data is 24 bit.
Should I use more than 24 bits to calculate the partial products, or not ?

Thank you !

Sam


Reply by Ray Andraka March 24, 20042004-03-24
FPGA arithmetic can be specified to the exact number of bits, not multiples of two
bits.  The difference with FPGAs is you don't need to carry around extra bits to
make the accumulator a multiple of some word size.  Still, that does not
practically affect the IIR filter design appreciably.  You have the same
quantization effects to worry about whether you use a microprocessor with fixed
point or an FPGA with fixed point.


>
-- --Ray Andraka, P.E. President, the Andraka Consulting Group, Inc. 401/884-7930 Fax 401/884-7950 email ray@andraka.com http://www.andraka.com "They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759
Reply by Matt North March 24, 20042004-03-24
> > 1. I have seen that the result of b0*x(n-1) can be as large as 5e5 with
a
> > simple sin as input signal !
GRPWD!
Reply by glen herrmannsfeldt March 24, 20042004-03-24
Ray Andraka wrote:

> Depends on your filter design. Implementing an IIR filter in fixed point > usually has to use a rather wide word, and care needs to be taken in the > selection of the coefficients in order to avoid nasty quantization effects. > Implementation in an FPGA has little to do with the filter design other than > the physical realization of it.
(snip) I was about to disagree with this, but then decided not to. One difference is the size of the building blocks. In a DSP you have a small number of sized words you can operate on, usually multiples of 8 or even 16. Once you decide 16 isn't enough, even for processing 16 bit data, you go to 24 or 32. There is little difference between 17 and 24 bits. Most FPGAs let you build ALU's in multiples of two bits. Multipliers and look up tables are somewhat different though, and may be quantized with other sizes. The constraints are a little different, and some of that difference is going to come out in the implementation. -- glen
Reply by glen herrmannsfeldt March 24, 20042004-03-24
Jerry Avins wrote:

(snip)

>> I would like to know how width are the busses between the
>> registers of an IIR filter (ie implemented in a FPGA), >> because these filters have coeffs > 1. >> I have seen that the result of b0*x(n-1) can be as large
>> as 5e5 with a simple sin as input signal !
(snip)
> FPGA stands for field-programmable gate array. With one, you implement > whatever circuit you design (or choose). The number of bits in a design > is whatever the designer decides. In parallel designs, the width of the > busses is the bit count. In bit-serial designs, those numbers are > uncoupled. With proper scaling, the size of a number and the bit count > aren't necessarily related.
Most FPGA designs that I know of are parallel, though you can choose the bit width often in units of 2, instead of 8 or 16 or 24, as on DSPs. I believe it is usual to keep some extra bits for intermediate values and truncate them later. Exactly how many and how often are implementation details. -- glen