# Fixed Point Design Resources

Can anyone point me to good methodologies for designing fixed point versions of possibly nonlinear signal processing algorithms? Are there any systematic methods other than simulation for optimizing and analyzing finite word length effects? References would be appreciated!

Two algorithms of interest are IQ balancers and digital AGC loops.

• huh, hard question. And very broad! Can you maybe narrow down to one algorithm class to begin with, and later broaden? – Marcus Müller May 29 '20 at 23:52
• there is a lotta experience with LTI systems and fixed-point arithmetic. less so with nonlinear, fixed-point with nonlinear there are two issues that pop into my head. 1. if the nonlinear functions greatly increase the dynamic range, like an exp or a hyperbolic sinh would. 2. quantization itself is a nonlinear process so it might generate frequency components that might get confused with the frequency components generated by your desired nonlinear process. – robert bristow-johnson May 30 '20 at 2:17
• if you dither your quantization with triangular p.d.f. dither, the effects of quantization can be well expressed as additive noise because you can decouple both the mean and the variance of the total quantization error modeled as an additive error signal. without dither, modeling quantization error as additive can be funky unless the signal amplitude swing is much much greater than the quantization step size. – robert bristow-johnson May 30 '20 at 2:20
• If you have enough noise running through your system then you don't need to introduce dither at all. Many high-speed ADCs have significant dither (a deviation of $\pm$ 5 LSB is not uncommon), and you can buy these at no extra charge from the manufacturer. Just ask for a "regular old high-speed ADC". – TimWescott May 30 '20 at 3:13
• @robertbristow-johnson: True dat. I'm usually doing control systems, where the noise of the ADC carries through all the way to the output. – TimWescott May 30 '20 at 17:59

• At each point where significant quantization can happen, add noise

If you know that the quantization effects will be essentially random, and if the following stages tend to low-pass or band-pass filter, then model the quantization noise as Gaussian with $$x_n \sim N(0, q/12)$$, where $$q$$ is one LSB.

The justification for this is that the quantization noise will be uniformly distributed (hence $$\sigma = q/12$$), and the following filter's output will contain a weighted sum of a bunch of samples of the quantization noise, which will tend to Gaussian by the central limit theorem.

If you want to be Maximally Paranoid, then figure out what the worst-case behavior of the quantization noise would be for your application (stuck high, stuck low, some specific signal, etc.), and model the quantization noise as having that shape, with a magnitude of $$q$$. In the case of a linear system that has any frequency selectivity, this works out to a square wave at a frequency equal to the systems highest sensitivity to noise at the injection point (or a sine wave with an amplitude of $$1.09 q/2$$.

The justification for this is really just paranoia -- but if you have an absolute upper bound on the effects of quantization, and the system still works well enough, then you just know you're done.

To design data path widths, you can turn this around, and determine the acceptable level of quantization at each step, and make sure that your data paths are wide enough (and scaled correctly) so that quantization is smaller than your acceptable level.

It's dangerous to make general statements about nonlinear systems, but I would hazard a guess that if you can analyze the algorithm on paper at all, there's a good chance that you can analyze the algorithm plus quantization on paper.

• And when you're done, simulate the thing to make sure you didn't screw up the analysis. – TimWescott May 30 '20 at 3:22
• And good for you for doing design the right way -- guess, simulate & repeat works, but you never know what you've done. – TimWescott May 30 '20 at 3:23
• What would make you choose a Gaussian dist. for noise rather than uniform? – rhz May 30 '20 at 3:53
• @rhz essentially, math. You want the noise to contribute as much irrelevance as possible to the signal (this is very unusual in applied information theory), and Gaussian noise has the highest differential entropy per variance. The derivation of that would take me a couple hours to days to look up, so not doing that here. From a receiver's point of view: Gaussian noise is special, because uncorrelatedness implies independence (which isn't the case with other probability distributions), so your independence of noise to signal is preserved even under phase rotations etc. – Marcus Müller May 30 '20 at 9:24
• @rhz: If the input to a quantization step is big enough (i.e., if it spans several LSBs), then the quantization noise is uniform and, we hope, random and unbiased. If the following stages are low pass (or narrow-enough bandpass), then their output noise will be a weighted average of multiple quantization noise samples, so the central limit theorem applies. – TimWescott May 30 '20 at 18:03

Probably the simplest thing you can do is apply a specific example of noise shaping called "fraction saving".

Whenever a quantization, a word width reduction, is needed, just round down (that is drop the bits to the right of the quantization point), but remember those dropped bits in a state. In the following sample, take those bits that you previously dropped, zero extend them to the left, and add that to the next sample at that same quantization point before you drop those bits.

It's noise shaping of first order with a zero right on DC ($$z=1$$). Infinite signal-to-noise ratio at DC, but you have increase noise at Nyquist.