-1
$\begingroup$

I understand from this other question that prior to implementing a fixed point IIR filter on a particular microcontroller target it's best to create a model using a DSP tool and compare the output to an "ideal" double-precision floating point version. I see there are tools such as Fixed-Point Designer for MATLAB and Simulink which can produce bit-accurate simulations of fixed-point implementations

I'm looking to do this but am limited to freeware tools, whereas most search results around fixed point modelling seem to reference Matlab (example) or other expensive software. A search for how to use Scilab or Python to do this has not suggested it's possible (at least not easily, for a beginner). Are there popular freeware tools available that can do this, with a good level of documentation, tutorials/examples, etc?

Once a filter design candidate is in hand, what suite of tests are recommended to ensure things like quantization error and overflow are not an issue for the intended application? What sorts of test signals should be passed through the candidate filter in order to maximize chances of exposing various possible issues, and what specific aspects of the output should be scrutinized?

$\endgroup$
1
  • $\begingroup$ I dunno, other than signals close to the floor and signals close to the ceiling (or even signals that clip). I have done a lot of fixed-point IIR filters for audio use both in the Mot DSP56K and in simple C code for a Renesas SH-2 CPU and have never ran a series of signals in to test it. I only examined its performance at very low levels (roundoff noise) and very high levels (clipping). 16-bit, 24-bit, and 32-bit processing. Dithering is a nice thing to do, but noise shaping with a zero at $z=1$ (DC) is very important. $\endgroup$ Dec 30, 2021 at 3:00

1 Answer 1

0
$\begingroup$

A simple solution to model fixed point IIR filters in Python is to use integer and modulo arithmetic. There are also fixed point libraries out there for more extensive implementations that would be useful for bit accurate modelling and verification but for simple testing of quantization effects on IIR and FIR filters using integer math should be more than sufficient. I include tests for overflow conditions or truncate / wrap on overflow matching the expected implementation.

When testing for fixed point I recommend the following:

Compare the frequency response both in passband and stopband to target requirements and the floating point implementation.

Very importantly do an SNR test by passing a test signal representing both the maximum and minimum expected signal conditions and measure the signal to noise ratio at the input and output of the filter; many issues with inferior fixed point implementations result in significantly higher noise degradation than expected (for example scaling the coefficients rather than the output or not using an extended precision accumulator). I recommend using the normalized correlation coefficient to a reference waveform as an SNR metric as described in this post.

For IIR specifically also check for stability and "dead-beat" response by passing a unit sample through the filter.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.