From: Vladimir Vassilevsky on

Let's say we need to implement H(z) = P(z)/Q(z) in the fixed point. The
typical implementation would be a cascade of biquads. So we factor P(z)
and Q(z) and distribute poles and zeroes between the stages.

The dynamic range of a filter is limited by overflow at the top, and by
quantization artifacts at the bottom. We can try all variants of
assignment of poles and zeroes to different stages to maximize the
dynamic range from rms quantization noise to full scale sine wave at the
"worst" frequency. So far so good.

However, this doesn't tell if some stage of filter can overflow if the
input is an arbitrary non-harmonic waveform. How could we optimize the
filter for this case?

Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
From: Jerry Avins on
Tim Wescott wrote:
> On Tue, 22 Dec 2009 23:04:06 -0500, Jerry Avins wrote:
>
>> Vladimir Vassilevsky wrote:
>>>
>>> Tim Wescott wrote:
>>>> On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>>>>
>>>>
>>>>> Let's say we need to implement H(z) = P(z)/Q(z) in the fixed point.
>>>>> The typical implementation would be a cascade of biquads. So we
>>>>> factor P(z) and Q(z) and distribute poles and zeroes between the
>>>>> stages.
>>>>>
>>>>> The dynamic range of a filter is limited by overflow at the top, and
>>>>> by quantization artifacts at the bottom. We can try all variants of
>>>>> assignment of poles and zeroes to different stages to maximize the
>>>>> dynamic range from rms quantization noise to full scale sine wave at
>>>>> the "worst" frequency. So far so good.
>>>>>
>>>>> However, this doesn't tell if some stage of filter can overflow if
>>>>> the input is an arbitrary non-harmonic waveform. How could we
>>>>> optimize the filter for this case?
>>>>>
>>>> I _think_ that if the transfer function from input to each state in
>>>> the filter is less than unity (or whatever the critical gain is
>>>> necessary to prevent overflow) for all possible frequencies, you can't
>>>> overflow.
>>>> But I don't _know_ -- I'd have to try to prove it, and may end up
>>>> disproving it instead!
>>> Unfortunately, not. Think of a highpass filter with the gain of 1 and
>>> the data range is +/-1. Let the input -1,-1,-1....-1, +1, so here is
>>> overflow.
>> I think I remember a proof here that there are pathological waveforms --
>> not the result of sampling -- that will cause any IIR structure to
>> overflow. The worst case for a transversal filter is easy to demonstrate
>> but unrealistically stringent.
>
> Can't be, at least not for a stable filter. Any linear time-invariant
> filter that's stable in the "poles strictly inside the stability region"
> sense is also stable in the bounded-input, bounded-output sense.
>
> If it's BIBO stable, then that means you can select your overflow level
> to be just outside the output bounds (or your gain to _keep_ the output
> bounds to just inside the overflow level).

Maybe Randy Yates remembers what's tickling my mind. (It was injected
into one of our on-line arguments in which we were both right about what
we wrote, but both wrong about what we understood the other to be
writing.) The standard analyses -- and yours -- assume certain
properties for the data. Someone here figured out -- Andor Bariska? -- a
pathology that violated the standard assumptions. I'm not sure what
structure or operation it applied to. but I clearly remember being
astounded at the result.

Jerry
--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
From: Vladimir Vassilevsky on


Tim Wescott wrote:

> On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>
>
>>The dynamic range of a filter is limited by overflow at the top, and by
>>quantization artifacts at the bottom. We can try all variants of
>>assignment of poles and zeroes to different stages to maximize the
>>dynamic range from rms quantization noise to full scale sine wave at the
>>"worst" frequency. So far so good.
>>
>>However, this doesn't tell if some stage of filter can overflow if the
>>input is an arbitrary non-harmonic waveform. How could we optimize the
>>filter for this case?
>
>
> So find the impulse response from input to each state, then sum the
> absolute values, then do the math.
>
> This time I'm right. Really.

Yes!

1. Find the impulse response of stage #1, set stage #1 gain accordingly.
2. Find the impulse response of stages #1 + #2, set stage #2 gain
accordingly.
3. Find the impulse response of stages #1 + #2 + #3, set stage #3 gain
accordingly.

So on, so forth. The system is guaranteed not to overflow for any input.

> I'm so sure that I'm right that if I'm
> wrong and you come to the _right_ part of Oregon* this time I'll buy you
> a beer.

It's my turn to buy beers. If I won't be in Oregon before April, I hope
to see you at comp.dsp conferrence (www.compdsp.com) in Kansas City.



Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com



From: Tim Wescott on
On Tue, 22 Dec 2009 20:50:42 -0600, Vladimir Vassilevsky wrote:

> Tim Wescott wrote:
>
>> On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>>
>>
>>>The dynamic range of a filter is limited by overflow at the top, and by
>>>quantization artifacts at the bottom. We can try all variants of
>>>assignment of poles and zeroes to different stages to maximize the
>>>dynamic range from rms quantization noise to full scale sine wave at
>>>the "worst" frequency. So far so good.
>>>
>>>However, this doesn't tell if some stage of filter can overflow if the
>>>input is an arbitrary non-harmonic waveform. How could we optimize the
>>>filter for this case?
>>
>>
>> So find the impulse response from input to each state, then sum the
>> absolute values, then do the math.
>>
>> This time I'm right. Really.
>
> Yes!
>
> 1. Find the impulse response of stage #1, set stage #1 gain accordingly.
> 2. Find the impulse response of stages #1 + #2, set stage #2 gain
> accordingly.
> 3. Find the impulse response of stages #1 + #2 + #3, set stage #3 gain
> accordingly.
>
> So on, so forth. The system is guaranteed not to overflow for any input.
>
>> I'm so sure that I'm right that if I'm wrong and you come to the
>> _right_ part of Oregon* this time I'll buy you a beer.
>
> It's my turn to buy beers. If I won't be in Oregon before April, I hope
> to see you at comp.dsp conferrence (www.compdsp.com) in Kansas City.
>
I suppose the next step is to apportion the stages so that the gains can
remain as high as possible without allowing overflow -- I'll bet that's
not as trivial.

--
www.wescottdesign.com
From: Jerry Avins on
Vladimir Vassilevsky wrote:
>
>
> Tim Wescott wrote:
>> On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>>
>>
>>> Let's say we need to implement H(z) = P(z)/Q(z) in the fixed point. The
>>> typical implementation would be a cascade of biquads. So we factor P(z)
>>> and Q(z) and distribute poles and zeroes between the stages.
>>>
>>> The dynamic range of a filter is limited by overflow at the top, and by
>>> quantization artifacts at the bottom. We can try all variants of
>>> assignment of poles and zeroes to different stages to maximize the
>>> dynamic range from rms quantization noise to full scale sine wave at the
>>> "worst" frequency. So far so good.
>>>
>>> However, this doesn't tell if some stage of filter can overflow if the
>>> input is an arbitrary non-harmonic waveform. How could we optimize the
>>> filter for this case?
>>>
>> I _think_ that if the transfer function from input to each state in
>> the filter is less than unity (or whatever the critical gain is
>> necessary to prevent overflow) for all possible frequencies, you can't
>> overflow.
>> But I don't _know_ -- I'd have to try to prove it, and may end up
>> disproving it instead!
>
> Unfortunately, not. Think of a highpass filter with the gain of 1 and
> the data range is +/-1. Let the input -1,-1,-1....-1, +1, so here is
> overflow.

I think I remember a proof here that there are pathological waveforms --
not the result of sampling -- that will cause any IIR structure to
overflow. The worst case for a transversal filter is easy to demonstrate
but unrealistically stringent.

Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������