S7 · Lesson 9 · CIC and halfband filters
Multiplier-free cascaded integrator–comb decimators, their droop and register growth, and halfband stages
A delta-sigma converter or a software radio's front end must decimate by factors of 64 to thousands at rates of tens or hundreds of megahertz, where every multiplier counts. Two filter families do most of that work. The cascaded integrator–comb (CIC) filter uses no multipliers at all, just adders and registers, and handles the first, largest rate reduction. Halfband filters, with nearly half their coefficients exactly zero, then take each remaining factor of two at a fraction of an ordinary filter's cost.
- The curve is a CIC decimator's response, relative to DC, against frequency in units of the output rate: for R = 16 and N stages.
- Nulls fall at every multiple of the output rate, exactly where the bands that would alias onto DC lie.
- Each added stage deepens the rejection near the nulls, but also the droop across the wanted band.
Predict
A four-stage CIC decimates by 16 and must pass up to 10% of its output rate. How much does it droop at that edge, and how well does it reject the band that would alias onto it?
At ν = 0.1: dB. The band that aliases onto the edge sits at ν = 0.9, near the first null: dB. A short compensating FIR at the low rate then flattens the droop.
Name it
The CIC decimator
N integrators run at the input rate, a downsampler by R, then N combs at the output rate (M = 1 or 2, the differential delay). By the noble identities this equals
N cascaded moving sums of RM samples, built from adders only.
- DC gain: .
- Register growth: the registers need bits more than the input. The integrators overflow, but in two's-complement arithmetic with enough bits the combs undo the wrap-around exactly.
- Response, in units ν of the output rate: relative to DC: droop across the passband, nulls at multiples of 1/M.
- A short FIR compensator at the output rate, roughly an inverse sinc, flattens the passband.
Halfband filters
A lowpass with cutoff π/2 and equal ripple δ in both bands can be designed so that for every even offset from the center except the center itself, which is ½. Then:
- : the response is symmetric about π/2, where it is exactly ½ (−6 dB);
- an N-tap halfband (N = 4K − 1) has only 2K + 1 nonzero taps, and with symmetry K distinct multiplications plus a shift for the center;
- decimating by 2 in polyphase form, one branch is a pure delay, so it costs K multiplications per output sample.
A decimate-by- chain is often a CIC followed by halfband stages and a final sharper FIR.
Worked example
A three-stage CIC decimates 8-bit data by 8. How wide must its registers be, and what is its DC gain?
Show the solution
- Bit growth. so the registers need 8 + 9 = 17 bits.
- DC gain. which shows as the 9 extra bits.
- Wraparound. The integrators will wrap around constantly, and that's fine: with 17-bit two's-complement arithmetic, the combs subtract the wrapped values and the output matches the direct moving-sum filter exactly.
Answer the registers must be 17 bits wide, and the DC gain is 512.
Worked example
A 23-tap halfband filter decimates by 2. How many of its taps are nonzero, and how many multiplications does it need per output sample?
Show the solution
- Find K. 23 = 4 × 6 − 1, so K = 6.
- Nonzero taps. That gives 2K + 1 = 13 nonzero taps: the center ½ and 12 others in symmetric pairs.
- Multiplications. With symmetry that's 6 distinct multiplications, and in polyphase form the center tap's branch is a delay and a shift: 6 multiplications per output sample, against 12 for an ordinary symmetric 23-tap decimator.
Answer 13 taps are nonzero, and it needs 6 multiplications per output sample.
Worked example
A 3.072 MHz delta-sigma bitstream must become 48 kHz audio. Plan a decimation chain.
Show the solution
- Total factor.
- CIC first. A CIC decimating by 16 brings it to 192 kHz using only adders.
- Two halfbands. Two halfbands by 2 take it to 96 and then 48 kHz, the last one sharp enough to keep the 20 kHz band and reject everything above 24 kHz.
- Cost and droop. Each halfband runs at a quarter or less of the input rate, and the CIC's droop at 20 kHz is corrected in the last stage.
Answer a CIC by 16 to 192 kHz, then two halfband filters by 2 to 96 and 48 kHz, with the CIC's droop corrected in the last stage.
Check
A CIC decimator has N = 4 stages, R = 8, M = 1, and 12-bit input.
(a)
What is its DC gain?
(b)
How wide must its registers be?
Check
A CIC decimator (N = 4, R = 8, M = 1) must pass up to 0.2 of its output rate.
(a)
How much does it droop at that edge?
(b)
How much does it attenuate the band that aliases onto that edge?
Check
A halfband filter has N = 4K − 1 taps with K = 8.
(a)
How long is it?
(b)
How many of its taps are nonzero?
(c)
How many multiplications per output does it need, decimating by 2?
Check
A 6.144 MHz bitstream is decimated to 48 kHz: a CIC by 16, then halfband stages.
(a)
What is the total decimation factor?
(b)
How many halfband stages follow the CIC?
Check
A halfband filter's response is 0.3 at ω = π/2 − x.
(a)
What is it at π/2 + x?
Check
Why can a CIC filter's integrators overflow constantly and still give correct outputs?
Check
A CIC decimator has N stages, decimation R and M = 1; ν is frequency in units of the output rate.
Step 1
What is its DC gain?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
What is its response at ν relative to DC, in dB?
Step 3
How many bits does it add?
Check
Write cic(x, R, N, bits): an N-stage CIC decimator by R (M = 1) on integer input x, with integrators and combs computed modulo and the output read as a signed number; return the list of outputs (one per R inputs, taken at n = R − 1, 2R − 1, …).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why is a CIC filter used for the first stage of high-ratio decimation but not for the last?
A CIC filter needs only adders and registers, no multipliers, and its integrators run at the full input rate while its combs run at the low output rate, so it is the cheapest possible way to reduce a very high sample rate by a large factor. Its nulls fall exactly on the frequency bands that would alias onto DC, so it rejects aliasing well near the band of interest. But its passband droops and its transition is very gradual, so it can't provide a sharp band edge. The last stages, at a much lower rate where multipliers are affordable, use halfband and FIR filters to sharpen the edge and correct the droop.
Practice
Keep practicing
8 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.