From: Brian Drummond <brian@shapes.demon.co.uk>
Subject: Re: RFC: Generic Fixed-Point IIR Filter
Date: Fri, 27 Mar 2015 11:37:13 +0000 (UTC)
Date: 2015-03-27T11:37:13+00:00 [thread overview]
Message-ID: <mf3fd9$udn$1@dont-email.me> (raw)
In-Reply-To: a05f90b1-491d-4e9a-8a01-722c6a136668@googlegroups.com
On Thu, 26 Mar 2015 09:25:25 -0700, Patrick Noffke wrote:
> I would greatly appreciate some feedback/help on implementing a generic
> fixed-point IIR filter package.
...
>
> - If I try to use Fixed_Type for X_Array and Y_Array, then I do in fact
> get a constraint error (due to range overflow for an intermediate
> calculation). Is there a better way to do a calculation for a
> fixed-point type when you expect the result to be within the specified
> range of Fixed_Type, but intermediate calculations may not?
I wrote (adapted) a generic SVD (matrix operation) to instantiate with
either fixed or floating point. The original was floating point : the
intent was to investigate if different fixed point formats could be made
stable, before porting to VHDL and implementing in hardware. It quickly
answered the question : for matrix inversion, no way!
Intermediate addition operations seemed OK : intermediate operations
involving multiplication (or division) had to be rewritten using
intermediate variables.
A moment's thought showed this made sense : you may want the intermediate
results stored at a different resolution : this is also usually the case
with IIR filters.
In other words I had to break up
f := a * b * c;
into something like
temp := b * c;
f := a * temp;
where temp may have been a higher resolution type, which allowed (i.e.
forced!) me to explicitly control the numerical properties. This is the
point Randy made, 4.5.5(19.1/2).
> - is there another way to
> define the constants that will "convert" them to a multiple of small?
I would probably use a conversion function on real (float) constants.
> - I realize my range and precision for Filter_Value_Type are not
> necessarily ideal (the range depends on the filter coefficients, the
> filter architecture, as well as the filter order). Do you know of any
> references or have suggestions for how to analyze a filter to determine
> the ideal range and precision?
Signal processing texts aimed at hardware engineers should cover this :
"Synthesis and optimisation of DSP Algorithms" (Constantinides,Cheung,Luk)
comes to mind. But with a generic, you can instantiate it with different
fixed (and float) types, measure the quality of each, and choose.
-- Brian
prev parent reply other threads:[~2015-03-27 11:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-26 16:25 RFC: Generic Fixed-Point IIR Filter Patrick Noffke
2015-03-26 17:05 ` Dmitry A. Kazakov
2015-03-26 17:41 ` Jeffrey Carter
2015-03-26 19:44 ` Patrick Noffke
2015-03-26 20:34 ` Randy Brukardt
2015-03-26 20:39 ` Jeffrey Carter
2015-03-26 21:12 ` Randy Brukardt
2015-03-26 21:30 ` Patrick Noffke
2015-03-26 22:02 ` Jeffrey Carter
2015-03-27 12:17 ` G.B.
2015-03-26 21:17 ` Patrick Noffke
2015-03-26 20:37 ` Jeffrey Carter
2015-03-27 11:37 ` Brian Drummond [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox