Learning · Step 8
FIR filters
An FIR filter is a tapped delay line:
y[n] = Σ h[k]·x[n−k]. The h[k] are the
filter coefficients — designed as real numbers (a
windowed sinc, a Parks–McClellan design, …). Porting an FIR to
fixed-point means quantizing those coefficients. The input and
accumulator side is ordinary multiply-accumulate (step 4); this step
is about the coefficients.
Pick the coefficient Q the same way you pick it for any
data (step 3): find max|h[k]|, give the integer side
enough bits to cover it, and the rest is fractional resolution. A
normalised low-pass has every |h| < 1, so the
coefficients live in a fractional format —
B_c bits = 1 sign + (B_c−1) fraction.
The headline rule: coefficient word length sets the stopband. Quantizing each coefficient rounds it by up to ±½ LSB; those tiny errors form an "error filter" that leaks into the stopband and lifts its floor. The attenuation you can reach is capped by the coefficient word length — each coefficient bit buys roughly 6 dB of stopband depth. Need 90 dB? Budget about 15–16 coefficient bits. The explorer below shows it directly.
Three rules bite in practice. Round, don't truncate
the coefficients — truncation biases every tap the same way and
pulls the DC gain off. Preserve symmetry — a
linear-phase FIR has h[k] = h[L−1−k]; quantize one half
and mirror it, or independent rounding can break the symmetry and
with it the linear phase. Re-normalise the DC gain —
rounding shifts Σh[k] slightly; nudge the centre tap to
put it back.
Try it
A 41-tap low-pass (cutoff 0.22·fs). Drag the coefficient word length and watch the quantized stopband floor — the blue curve — rise toward the ideal design.
What to notice
- Drag coefficient bits down — the quantized stopband floor climbs by roughly 6 dB per bit, while the ideal design stays deep. That 6 dB/bit is the rule.
- At high bit counts the blue curve sits right on the ideal — past a point, quantization is no longer the limit; the window design is.
- Flip Round → Truncate — every coefficient biases the same way, the stopband worsens, and the DC gain shifts off 0 dB.
- The passband barely moves. Coefficient quantization shows up in the stopband first — that's where you measure it.
Key fixed-point rules
- Pick the coefficient Q from
max|h[k]|— same rule as your data; the largest tap sets the integer bits, the rest is resolution. - Size the word length to the stopband spec — budget about 6 dB of attenuation per coefficient bit, plus a few bits of margin for the tap count.
- Round the coefficients, never truncate — truncation biases every tap the same way and pulls the DC gain off-target.
- Preserve symmetry — for a linear-phase filter quantize one half and mirror it; independent rounding can break the symmetry and the linear phase with it.
- Re-normalise the DC gain — after rounding, adjust
the centre (or largest) tap so
Σh[k]lands back on its target.
Step exam
Answer all 3 questions correctly to complete this step.
-
Quantizing FIR coefficients to fewer bits mainly degrades:
-
Roughly how much stopband attenuation does each extra coefficient bit buy?
-
When quantizing a linear-phase FIR you must: