A Beginner's Guide To Cascaded Integrator-Comb (CIC) Filters

Rick LyonsMarch 26, 202025 comments

This blog discusses the behavior, mathematics, and implementation of cascaded integrator-comb filters.

Cascaded integrator-comb (CIC) digital filters are computationally-efficient implementations of narrowband lowpass filters, and are often embedded in hardware implementations of decimation, interpolation, and delta-sigma converter filtering.

After describing a few applications of CIC filters, this blog introduces their structure and behavior, presents the frequency-domain performance of CIC filters, and discusses several important practical issues in implementing these filters.

CIC Filter Applications

CIC filters are well-suited for anti-aliasing filtering prior to decimation (sample rate reduction), as shown in Figure 1(a); and for anti-imaging filtering for interpolated signals (sample rate increase) as in Figure 1(b). Both applications are associated with very high-data rate filtering such as hardware quadrature modulation and demodulation in modern wireless systems, and delta-sigma A/D and D/A converters.

Figure 1: CIC filter applications: (a) for decimation; (b) for interpolation.

Because their frequency magnitude responses are sin(x)/x-like, CIC filters are typically followed, or preceded, by linear-phase lowpass tapped-delay line finite impulse response (FIR) filters whose tasks are to compensate for the CIC filter's non-flat passband.

The Figure 1 cascaded-filter architectures have valuable benefits. For example:

* The FIR filters operate at reduced clock rates minimizing power consumption in high-speed hardware applications

* CIC filters are popular in hardware devices; they need no filter coefficient data storage and require no multiplications. The arithmetic needed to implement CIC filters is strictly additions and subtractions only.

* Narrowband lowpass filtering can be attained at a greatly reduced computational complexity compared to using a single lowpass FIR filter. And this property is why CIC filters are so attractive in decimating and interpolating DSP systems.

With that said, let's see how CIC filters operate.

Recursive Running Sum Filter

CIC filters originate from the notion of a recursive running sum filter, which is itself an efficient form of a nonrecursive moving averager. Recall the standard D-point moving-average process in Figure 2(a). There we see that D–1 summations (plus one multiply by 1/D) are necessary to compute the averager's y(n) output sequence.

Figure 2: D-point moving-average and recursive running sum filters.

The D-point moving-average filter's time-domain output is expressed as

$$y(n)=\frac{1}{D}\left[x(n) + x(n–1) + x(n–2) + x(n–3) + ... + x(n–D+1)\right]\qquad\qquad(1)$$

where n is our time-domain index. The z-domain expression for this moving averager's output is

$$Y(z)=\frac{1}{D}\left[X(z) + X(z)z^{–1} + X(z)z^{–2} + ... + X(z)z^{–D+1}\right]\qquad\qquad\qquad\qquad(2)$$

while its z-domain HMA(z) transfer function is

$$H_{\tt{MA}}(z)=\frac{Y(z)}{X(z)}=\frac{1}{D}\left[1 + z^{–1} + z^{–2} + ... + z^{–D+1}\right]=\frac{1}{D}\sum_{n=0}^{D-1} {z^{-n}}\qquad\qquad\qquad(3)$$

We provide these equations not to make things complicated, but because they're useful. Equation (1) tells us how to build a moving averager, and Equation (3) is in the form used by commercial signal processing software to model the frequency-domain behavior of the moving averager.

The next step in our journey toward understanding CIC filters is to consider an equivalent form of the moving averager, the recursive running sum filter depicted in Figure 2(b). Ignoring the 1/D scaling, there we see that the current input sample x(n) is added to, and the oldest input sample x(nD) is subtracted from, the previous output average y(n–1). It's called "recursive" because it has feedback. Each filter output sample is retained and used to compute the next output value. The recursive running sum filter's difference equation is

$$y(n)=\frac{1}{D}\left[x(n) - x(n–D)\right]+y(n-1)\qquad\qquad\qquad\qquad(4)$$

having a z-domain HRRS(z) transfer function of

$$H_{\tt{RRS}}(z)=\frac{Y(z)}{X(z)}=\frac{1}{D}\cdot\frac{1- z^{–D}}{1 - z^{–1}}.\qquad\qquad\qquad\qquad\qquad(5)$$

We use the same H(z) variable for the transfer functions of the moving average filter and the recursive running sum filter because their transfer functions are equal to each other! It's true. Equation (3) is the nonrecursive expression, and Equation (5) is the recursive expression, for a D-point averager. The mathematical proof of this can be found in Appendix B of Reference [1], but shortly I'll demonstrate that equivalency with in example.

Here is why we care about recursive running sum filters: the standard moving averager in Figure 2(a) must perform D–1 additions per output sample. The recursive running sum filter has the sweet advantage that only one addition and one subtraction are required per output sample, regardless of the delay length D! This computational efficiency makes the recursive running sum filter attractive in many applications seeking noise reduction through averaging. Next we'll see how a CIC filter is, itself, a recursive running sum filter.

CIC Filter Structures

If we condense the delay line representation and ignore the 1/D scaling in Figure 2(b) we obtain the classic form of a 1st-order CIC filter, whose cascade structure is shown in Figure 3.

Figure 3: D-point recursive running sum filter in a cascaded integrator-comb implementation.

The feedforward portion of the CIC filter is called the comb section, whose differential delay is D, while the feedback section is typically called an integrator. The comb stage subtracts a delayed input sample from the current input sample, and the integrator is simply an accumulator. The CIC filter's time-domain difference equation is

$$y(n)=x(n) - x(n–D)+y(n-1)\qquad\qquad\qquad\qquad(6)$$

and its z-domain transfer function is

$$H_{\tt{CIC}}(z)=\frac{Y(z)}{X(z)}=\frac{1- z^{–D}}{1 - z^{–1}}.\qquad\qquad\qquad\qquad\qquad(7)$$

To see why the CIC filter is of interest, first we examine its time-domain behavior, for D = 5, shown in Figure 4. If a unit impulse sequence, a unity-valued sample followed by many zero-valued samples, was applied to the comb stage, that stage's output is as shown in Figure 4(a). Think, now, what would be the output of the integrator if its input was the comb stage's impulse response. The initial positive impulse from the comb filter starts the integrator's all-ones output. Then, D samples later the negative impulse from the comb stage arrives at the integrator to zero all further CIC filter output samples.

Figure 4: Single-stage CIC filter time-domain responses when D = 5.

The key issue is that the combined unit impulse response of the CIC filter, being a rectangular sequence, is identical to the unit impulse responses of a moving average filter and the recursive running sum filter. (Moving averagers, recursive running sum filters, and CIC filters are close kin. They have the same z-domain pole/zero locations, their frequency magnitude responses have identical shapes, their phase responses are identical, and their transfer functions differ only by a constant scale factor.) If you understand the time-domain behavior of a moving averager, then you now understand the time-domain behavior of the CIC filter in Figure 3.

The frequency magnitude and linear-phase response of a D = 5 CIC filter is shown in Figures 5(a) and 5(b) where the frequency fs is the input signal sample rate measured in Hz.

Figure 5: Characteristics of a single-stage CIC filter when D = 5.

The CIC filter's frequency response, derived in Reference [1], is:


If we ignore the phase factor in Eq. (8), that ratio of sin() terms can be approximated by a sin(x)/x function. This means the CIC filter's frequency magnitude response is approximately equal to a sin(x)/x function centered at 0 Hz as we see in Figure 5(a). (This is why CIC filters are sometimes called sinc filters.)

Digital filter designers like to see z-plane pole/zero plots, so I provide the z-plane characteristics of a D = 5 CIC filter in Figure 5(C), where the comb filter produces D zeros, equally spaced around the unit-circle, and the integrator produces a single pole canceling the zero at z = 1. Each of the comb's zeros, being a Dth root of 1, are located at z(m) = ej2pm/D, where m = 0, 1, 2, ..., D–1, corresponding to a magnitude null in Figure 5(a).

The normally risky situation of having a filter pole directly on the z-plane's unit circle need not trouble us here because there can be no coefficient quantization error in our Hcic(z) transfer function. That's because CIC filter coefficients are ones and can be represented with perfect precision with fixed-point number formats. The filter pole will never be outside the unit circle. Although recursive, happily CIC filters are guaranteed-stable, linear-phase, and have finite-length impulse responses.

Again, CIC filters are primarily used for anti-aliasing filtering prior to decimation, and for anti-imaging filtering for interpolated signals. With those notions in mind we swap the order of Figure 2(C)'s comb and integrator—we're permitted to do so because those operations are linear—and include decimation by an integer sample rate change factor R in Figure 6(a). (The reader should prove to themselves that the unit impulse response of the integrator/comb combination, prior to the sample rate change, in Figure 6(a) is equal to that in Figure 4(C).) In most CIC filter applications the rate change R is equal to the comb's differential delay D, but I'll keep them as separate design parameters for now.

Figure 6: Single-stage CIC filters used in (a) decimation and (b) interpolation. (Sample rates fs,in and fs,out are the sample rates of the x(n) and y(n) sequences respectively.)

The decimation (also called "down-sampling") operation ↓R means discard all but every Rth sample, resulting in an output sample rate of fs,out = fs,in/R. To investigate a CIC filter's frequency-domain behavior in more detail, Figure 7(a) shows the frequency magnitude response of a D = 8 CIC filter prior to decimation. The spectral band, of width B Hz, centered at 0 Hz is the desired passband of the filter. A key aspect of CIC filters is the spectral folding that takes place due to decimation.

Figure 7: Magnitude response of a 1st-order, D = 8, decimating CIC filter: (a) before decimation; (b) aliasing after R = 8 decimation.

Those B-width shaded spectral bands centered about multiples of fs,in/R in Figure 7(a) will alias directly into our desired passband after decimation by R = 8 as shown in Figure 7(b). Notice how the largest aliased spectral component, in this 1st-order CIC filter example, is 16 dB below the peak of the band of interest. Of course the aliased power levels depend on the bandwidth B; the smaller B the lower the aliased energy after decimation.

Figure 6(b) shows a CIC filter used for interpolation where the ↑R symbol means insert R–1 zeros between each x(n) sample (up-sampling), yielding a y(n)output sample rate of fs,out = Rfs,in. (In this CIC filter discussion, interpolation is defined as zeros-insertion, called "zero stuffing", followed by CIC filter lowpass filtering.)

To illustrate the spectral effects of interpolation by R = 8, Figure 8(a) shows an arbitrary baseband spectrum, with its spectral replications, of a signal applied to the D = R = 8 interpolating CIC filter of Figure 6(c). The interpolation filter's output spectrum in Figure 8(b) shows how imperfect CIC filter lowpass filtering gives rise to the undesired spectral images.

Figure 8: 1st-order, D = R = 8, interpolating CIC filter spectra: (a) input signal spectrum; (b) spectral images of a zero stuffed and CIC lowpass filtered output.

After interpolation, Figure 8(b) shows the unwanted images of the B-width baseband spectrum reside at the null centers, located at integer multiples of fs,out/R. If we follow the CIC filter with a traditional lowpass tapped-delay line FIR filter, whose stopband includes the first image band, fairly high image rejection can be achieved

Improving CIC Filter Attenuation

The most common method to improve CIC filter anti-aliasing and image-reject attenuation is by cascading multiple CIC filters. Figure 9 shows the block diagram and frequency magnitude response, up to the w(n) node, of a 3rd-order (M = 3) CIC decimating filter.

Figure 9: 3rd-order (M = 3) CIC decimation filter structure: (a) block diagram; (b) and frequency magnitude response before down-sampling when D = R = 8.

Notice the increased attenuation at fs,in/R in Figure 9(b) compared to the 1st-order CIC filter in Figure 7(a). Because the M = 3 CIC stages are in cascade, their combined z-domain transfer function will be the product of their individual transfer functions, or

$$H_{\tt{CIC,}\it{M}\tt{th-order}}(z)=\frac{W(z)}{X(z)}=\left[\frac{1- z^{–D}}{1 - z^{–1}}\right]^M.\qquad\qquad\qquad\qquad(9a)$$

It's important to notice the W(z) term in Eq. (9a). The transfer function in Eq. (9a) does not include the down-sampling by R operation of the w(n) sequence in Figure 9(a). (The entire system in Figure 9(a) is a multirate system, and multirate systems do not have z-domain transfer functions. See Reference [2] for more information on this subject.)

The frequency magnitude response of the Figure 9(b) filter, from the x(n) input to the w(n) sequence, is:


The price we pay for improved anti-alias attenuation is additional hardware adders and increased CIC filter passband droop (downward mainlobe curvature). An additional penalty of increased filter order comes from the gain of the filter, which is exponential with the order M. Because CIC filters generally must work with full precision to remain stable, the number of bits in the adders is Mlog2(D), so there is a large data word-width penalty for higher order filters. Even so, because CIC filters drastically simplify narrowband lowpass filtering operations, multistage implementations (M > 1) are common in commercial integrated circuits where an Mth-order CIC filter is often called a sincM filter.

Building a CIC Filter

In CIC filters, the comb section can precede, or follow, the integrator section. However it's sensible to put the comb section on the side of the filter operating at the lower sample rate. Swapping the Figure 6 comb filters with the down-sampling operations results in the most common implementation of CIC filters as shown in Figure 10. This was one of the key features of CIC filters introduced to the world by Hogenauer in 1981 [See Reference 3].

In Figure 10 notice the decimation filter's comb section now has a reduced delay length (differential delay) of N = D/R. That's because an N-sample comb delay after down-sampling by R is equivalent to a D-sample comb delay before down-sampling by R. Likewise for the interpolation filter; an N-sample comb delay before up-sampling by R is equivalent to a D-sample comb delay after up-sampling by R.

Those Figure 10 configurations yield two major benefits: first, the comb sections' new differential delay lines are decreased in length to N = D/R reducing data storage requirements; second, the comb section now operates at a reduced clock rate. Both of these effects reduce hardware power consumption.

Figure 10: Reduced comb delay, single-stage, CIC filter implementations: (a) for decimation; (b) for interpolation.

The comb section's differential delay design parameter N is typically 1 or 2 for high sample rate ratios as is often used in commercial radio frequency up/down-converters. Variable N effectively sets the number of nulls in the frequency response of a decimation filter, as shown in Figure 11(a).

Figure 11: First-order CIC decimation filter responses: (a) for various values of differential delay N, when R = 8; (b) for two decimation factors when N = 2. (Sample rate fs,out is the sample rate of the decimated output sequence.)

An important characteristic of a fixed-order CIC decimator is the shape of the filter's mainlobe low frequency magnitude response changes very little, as shown in Figure 11(b), as a function of the decimation ratio. For R larger than roughly 16, the change in the filter's low frequency magnitude shape is negligible. This allows the same compensation FIR filter to be used for variable-decimation ratio systems

CIC Filter Gain

The passband gain of a 1st-order CIC decimation filter, derived in Reference [1], is equal to the comb filter delay D = NR at zero Hz (DC). Multistage Mth-order CIC decimation filters, such as in Figure 9(a), have a net gain of (NR)M. The high gain of an Mth-order CIC decimation filter can conveniently be made equal to one by binary right-shifting the filter's output samples by log2((NR)M) bits when (NR)M is restricted to be an integer power of two.

An interpolating CIC filter has zeros inserted between its input samples reducing its gain by a factor of 1/R to account for the zero-valued samples, so the net gain of an interpolating CIC filter is (NR)M/R.

Register Word Widths and Arithmetic Overflow

CIC filters are computationally efficient (i.e., fast). But to be mathematically accurate they must be implemented with appropriate register bit widths. Let's now consider their register bit widths in order to follow the advice of a legendary lawman. ["Fast is important, but accuracy is everything." Wyatt Earp (1848-1929)]

CIC filters suffer from accumulator (adder) arithmetic register overflow because of the unity feedback at each integrator stage. This overflow is of no consequence as long as the following two conditions are met:

* each stage is implemented with two’s complement (non-saturating) arithmetic [1,3], and

* the range of a stage's number system is greater than or equal to the maximum value expected at the stage's output.

When two's complement fixed-point arithmetic is used, the number of bits in an Mth-order CIC decimation filter's integrator and comb registers must accommodate the filter's input signal's maximum amplitude times the filter's total gain of (NR)M. To be specific, overflow errors are avoided if the number of integrator and comb register bit widths is at least

register bit widths = x(n) bits + $\lceil M·log_2(NR)\rceil\qquad\qquad\qquad\qquad\qquad(10)$

where x(n) is the input to the CIC filter, and $\lceil$k$\rceil$ means if k is not an integer, round it up to the next larger integer.

Using Figure 12 as an example, if an M = 3-stage CIC decimation filter accepts 12‑bit binary input words and the decimation factor is R = D = 8, binary overflow errors are avoided if the three integrator and three comb registers' bit widths are no less than

register bit widths = $12 + \lceil 3·log_2(8)\rceil=12+3·3=21\tt\space bits\qquad\qquad(11)$

Figure 12: Filter accumulator register word widths for an M = 3, D = R = 8, decimating CIC filter when the input data word width is 12 bits.

In some CIC filtering applications there is the opportunity to discard some of the least significant bits (LSBs) within the accumulator (adder) stages of an Mth-order CIC decimation filter, at the expense of added noise at the filter's output. The specific effects of this LSB removal (called "register pruning") are, however, a complicated issue so I refer the reader to References [3-5] for more details.

Compensation/Preconditioning FIR Filters

In typical decimation/interpolation filtering applications we desire reasonably flat passband gain and narrow transition region width performance. These desirable properties are not provided by CIC filters alone, with their drooping mainlobe gains and wide transition regions. We can alleviate this problem, in decimation for example, by following the CIC filter with a compensation FIR filter, as in Figure 1(a), to sharpen the CIC filter's frequency rolloff and flatten the CIC filter's passband gain.

The compensation FIR filter's frequency magnitude response, ideally an inverted version of the CIC filter passband magnitude response, is similar to that shown by the long-dash curve in Figure 13(a). That curve represents a simple three-tap FIR filter whose coefficients are [‑1/16, 9/8, ‑1/16] as suggested by Reference [6]. With the short-dash curve representing the uncompensated passband droop of a 1st-order D = R = 8 CIC filter, the solid curve represents the compensated magnitude response of the cascaded filters.

Figure 13: Compensation FIR filter responses: (a) with a 1st-order (M = 1) decimation CIC filter; (b) with a 3rd-order (M = 3) decimation CIC filter.

If either the passband bandwidth or CIC filter order increases the correction becomes more robust, requiring more compensation FIR filter taps. An example of this situation is shown in Figure 13(b) where the dotted curve represents the passband droop of a 3rd-order D = R = 8 CIC filter and the dashed curve, taking the form of [x/sin(x)]3, is the response of a 15-tap linear-phase compensation FIR filter having the coefficients [‑1, 4, ‑16, 32, ‑64, 136, ‑352, 1312, ‑352, 136, ‑64, 32, ‑16, 4, ‑1].

Those dashed curves in Figure 13 represent the frequency magnitude responses of compensating FIR filters within which no sample rate change takes place. (The FIR filters' input and output sample rates are equal to the fs,out output rate of the decimating CIC filter.)

For completeness I'll mention that Reference [6] also presents a low-order IIR compensation filter for decimation applications where linear-phase filtering is not necessary. That simple IIR filter's z-domain transfer function is:

$$H_{\tt{IIR}}(z)=\frac{9/8}{1 -(1/8) z^{–1}}.\qquad\qquad\qquad\qquad\qquad(12)$$

A Simple and Efficient FIR Compensation Filter

I recently reviewed a copy of Reference [7] that recommends the simple and computationally-efficient decimation FIR compensation filter shown in Figure 14(a). The three-tap FIR compensation filter has only one non-unity coefficient. The coefficient's value depends on the order, M, of the CIC decimation filter being compensated, as shown in the table in Figure 14(A).

Figure 14: Decimation compensation filters: (a) three-tap FIR compensation filter; (b) multiplier-free compensation filter when A = —10.

This compensation filter deserves consideration because it's linear-phase and was designed to be implemented without multiplication. Figure 14(b) shows how to use binary bit left-shifting and one addition to perform a multiplication by A = —10.

A Decimation-By-Two FIR Compensation Filter

I've seen decimation applications where a compensating FIR filter is designed to enable an additional, and final, output decimation by two operation. That is, a CIC filter is followed by a compensation filter whose output is decimated by a factor of two.

Such a compensation filter's frequency magnitude response looks similar to that in Figure 15, where fs,in is the compensation filter's input sample rate. Again, the decimate-by-two compensation FIR filter's frequency magnitude response is ideally an inverted version of a CIC filter's passband magnitude response from zero Hz up to approximately fs,in/4. In such applications the transition region width of the cascaded CIC and compensation filter is determined by the transition region width of the compensation filter.

Figure 15: Frequency magnitude response of a decimate-by-2 compensation FIR filter.

Appendix A of the downloadable PDF file associated with this blog presents MATLAB code for designing decimating FIR compensation filters similar to that shown in Figure 15.


Here's the bottom line of our CIC filter presentation: a decimating CIC filter is merely a very efficient recursive implementation of a moving average filter, with NR taps, whose output is decimated by R. Likewise, an interpolating CIC filter is insertion of R–1 zero samples between each input sample followed by an NR tap moving average filter running at the output sample rate fs,out. The cascade implementations in Figure 1 result in total computational workloads far less than using a single FIR filter alone for high sample rate change decimation and interpolation. CIC filters are designed to maximize the amount of low sample rate processing to minimize power consumption in high-speed hardware applications.

Again, CIC filters require no multiplications, their arithmetic is strictly additions and subtractions. Their performance allows us to state that, technically speaking, CIC filters are lean mean fat-free filtering machines. In closing, be informed that there are ways to build nonrecursive CIC filters, and this eases the word width growth problem of the above traditional recursive CIC filters. Those advanced CIC filter architectures are discussed in Reference [1].

In case you're interested, the history of CIC filters is presented in Reference [8].


[1] Lyons, R., Understanding Digital Signal Processing, 2nd Ed., Prentice Hall, Upper Saddle River, New Jersey, 2004, pp. 550–566.

[2] Lyons, R., "Do Multirate Systems Have Transfer Functions?". Available online at:

[3] Hogenauer, E. "An Economical Class of Digital Filters For Decimation and Interpolation," IEEE Trans. Acoust. Speech and Signal Proc., Vol. ASSP–29, pp. 155–162, April 1981. Available online at:

[4] harris, f., Multirate Signal Processing for Communication Systems, Prentice-Hall, Upper Saddle River, New Jersey, 2004, pp. 341-358.

[5] Lyons, R., "Computing CIC Filter Register Pruning Using Matlab". Available online at:

[6] Mitra, S., Digital Signal Processing, A computer-Based Approach, McGraw-Hill, New York, New York, 2011, pp. 885.

[7] Jovanovic Dolecek, G., and harris, f., “Design of Wideband CIC Compensation Filter for a Digital IF Receiver” Digital Signal Processing, (Elsevier) Vol. 19, No. 5, pp. 827-837, Sept, 2009.

[8] Lyons, R., "The History of CIC Filters: The Untold Story". Available online at:

[ - ]
Comment by jms_nhJuly 4, 2020

Neat article! I'm a big fan of CIC filters; they're one of my favorite little tricks.

The LaTeX proofreader in me has two suggestions: use a backslash before standard functions like log and sin (compare $log x$ and $\log x$, also $sin x$ and $\sin x$) as in eqns 8, 9b, 10, 11.

[ - ]
Comment by Rick LyonsJuly 4, 2020

Hi Jason. Thanks.

Yep, CIC filters are interesting. Their block diagrams aren't too complicated but there are all sorts of practical subtleties in their behavior and implementation. There must be a hundred papers written about different aspects of, and variations on, CIC filters.

As for LateX, my reliability in creating correct LaTeX symbols is equivalent to the reliability of the paper towel dispenser in the Men's Room of your local bar.

By the way Jason, I'm a big fan of all of your interesting, entertaining, and educational blogs.

[ - ]
Comment by mortlOctober 16, 2020

Nice article!

I'm not sure but isn't there a negative sign missing in the phase term of Eq. 8?


[ - ]
Comment by Rick LyonsOctober 18, 2020

Hello mortl. Yes yes. You are correct! There's a missing minus sign just before the 'j' in the exponent of my Eq. (8). I tried to correct that "typo" but for some reason the blog "editor" software is giving me error messages. I've asked web master Stephane Boucher for help.

In any case mortl. Thanks for pointing that typo out to me! 

Oct. 19 Update: The typo in this blog's Eq. (8) has been corrected by Stephane Boucher.

[ - ]
Comment by GrittyEngineerNovember 17, 2020

Great article. I've been wanting to learn more about CIC filters for a while and this was a great primer. I'm a little confused on a couple of details. First, the passband B. Is this the bandwidth of your desired signal or the 3 dB point of your filter? Or is it just the region that will be contaminated by the spectral folding? 

Second, if I wanted to use a CIC filter instead of a linear interpolator would I just use the CIC filter illustrated in Figure 6 b?

[ - ]
Comment by Rick LyonsNovember 18, 2020

Hi GrittyEngineer. To answer your first question: With decimation in Figure 7 and Figure 9, the shaded bandwidth of B Hz is the double-sided bandwidth of your desired signal of interest. However, after decimation as shown in Figure 7(b), the attenuated shaded spectral images centered about multiples of fs,in/R in Figure 7(a) will alias (spectrally fold) directly into our desired signal's B Hz passband centered at zero Hz. [Of course, with interpolation no aliasing (spectral folding) occurs.]

To answer your second question: Yes, you could use the interpolating lowpass filter in Figure 6(b). But it would be much better to use the "decreased-delay-line" interpolating lowpass filter in Figure 10(b).

GrittyEngineer, by the way, there's another linear interpolation method that might interest you. That method is described in my blog at:

[ - ]
Comment by GrittyEngineerNovember 18, 2020

Thank you Rick, that clears it up for me. I also found the other post useful. One last question, a while back I saw a Hilbert filter implemented without using any multiplies. I was younger then and I think someone mentioned it was possible through comb filters. Is it possible to create more complicated filters that through CIC and comb filters and what would be a good starting place to learn how?

[ - ]
Comment by Rick LyonsNovember 19, 2020
Hi GrittyEngineer. I don't know of any way to implement a Hilbert transformer without using any multiplies. There may be a way to implement a Hilbert transformer using a tapped-delay line network and canonical signed digit (CSD) arithmetic processing. But I have never explored (studied) such a CSD Hilbert transformer implementation. [CSD processing is explained at:]

If you have a way to implement a Hilbert transformer without using any multiplies I'd like to learn about such a process.

As for creating more complicated filters using CIC and comb filters, off the top of my head I don't have any suggestions for you. Sorry about that!

[ - ]
Comment by GrittyEngineerNovember 19, 2020

Thanks Rick. You're probably right, it was most likely canonical multiplies. That's probably why I was struggling to figure out how to get a CIC filter to do something different. Thanks for your help! 

[ - ]
Comment by dfreedJanuary 6, 2021
As a newcomer to CIC filters, I found this article to be very helpful.  Thank you for writing it and making it freely available!

I did have one question about Figure 9b.  If I run the CIC filter design portion of your MATLAB code with M=3, R=8, and N=1, it produces a figure that doesn't quite match Figure 9b.  The MATLAB figure has sidelobe peaks at -38.4, -49.3, and -53.7 dB, but Figure 9b has sidelobe peaks at (very roughly) -39, -52, and -62 dB.  The MATLAB code looks right to me, so perhaps there's a problem with Figure 9b?
[ - ]
Comment by Rick LyonsJanuary 7, 2021

Hi dfreed. You are correct, the sidelobe levels in Figure 9(b) are too low. (I couldn't locate the MATLAB code, written many years ago, to see what went wrong when I created that figure .) I've corrected Figure 9(b) and I'll ask web master Stephane Boucher to update this blog's PDF file as soon as possible.

Thanks for pointing this issue out to me dfreed.

[ - ]
Comment by dfreedJanuary 7, 2021

Thanks!  I see that the corrected PDF is now available.  I really appreciate your quick response!

[ - ]
Comment by Rick LyonsJanuary 8, 2021

Hi dfreed. You're most welcome. Again, thanks for notifying me about the error in Figure 9.

[ - ]
Comment by Ethan_SFebruary 3, 2021

Thank you for this nice article! It's really helpful for a dsp beginner just like me. Good job.

[ - ]
Comment by VetteMaxApril 2, 2021

Many thanks for your article.

You're the first one I read that care about the infinite gain at DC. That cause the sum of integrator filter to overflow when it's on the input side. I'm more on software side, maybe it's why I'm really concerned by this kind of problems.

To be honest, the first time I read this article, I did not catch the way it works (the wrap around). But in another of your articles (on it became all clear with this paragraph : 

"Although the gain of an Mth-order CIC decimation filter is (NR )individual integrators can experience overflow. (Their gain is infinite at DC.) As such, the use of two's complement arithmetic resolves this overflow situation just so long as the integrator word width accommodates the maximum difference between any two successive samples (in other words, the difference causes no more than a single overflow). Using the two's complement binary format, with its modular wrap-around property, the follow-on comb filter will properly compute the correct difference between two successive integrator output samples."

I understand quick, but you need to explain for a long time ;)

[ - ]
Comment by Rick LyonsApril 2, 2021

Hello VetteMax. I'm happy to hear that my CIC filter material has been of some value to you.

CIC filters certainly are interesting, are they not?

[ - ]
Comment by dfreedMay 7, 2021
Hi Rick (and everyone else) -- I have a question about using a CIC filter as a decimator for a 1-bit input, such as the signal from a PDM microphone.

A PDM signal has values of {0, 1}.  It's typical (I believe) to map these values to {-1, +1} before processing.  This turns the 1-bit unsigned PDM signal into a 2-bit two's-complement signal.  If you have a CIC filter with G bits of growth, then you need a wordlength of G+2 in the CIC filter.  For example, if R=4, M=4, and N=1, then the CIC filter has a gain of 4^4 = 256 and G = 8, so you need a 10-bit wordlength.

Looked at another way, if the input signal has values {-1, +1} and the CIC filter has a gain of 256, then the output signal range is -256 to +256.  This requires a 10-bit wordlength.  In particular, the fact that +256 is included in the output range pushes you into requiring a 10-bit wordlength, because a 9-bit wordlength can only cover the range -256 to +255.

One of my colleagues posed an interesting question.  What if we were confident that the output would never (or almost never) actually hit the +256 rail?  Based on the microphone sensitivity, this might be a reasonable assumption.  Could we then get away with using a 9-bit wordlength?  Or would we run into problems at the internal nodes of the filter?  In particular, intermediate signals at the integrators could certainly hit +256 (and beyond).  Would wraparound work correctly as long as the final output never hit +256?

An alternative is to map the PDM signal values to {-1, 0} instead of {-1, +1}.  Then the input to the CIC filter is 1-bit two's-complement rather than 2-bit two's-complement, so you only need a wordlength of G+1 bits.  But then you wind up with an output signal that has a large DC component and only covers half of the signed range (-256 to 0), and you have to do something about that before any subsequent processing.  It's easy to address, but it does require a little extra work.

So what is standard practice when decimating a 1-bit signal with a CIC filter?
[ - ]
Comment by Rick LyonsMay 10, 2021

Hi dfreed. Sorry for my delayed reply to your Comment.

In your 2nd paragraph you wrote, "G = 8". What does the letter "G" represent?

Regarding your 3rd paragraph's question, "Could we then get away with using a 9-bit wordlength?", if R=4, M=4, N=1, and the input wordwidth is two then you could use a 9-bit wordlength for the filter's 4th stage if you can be sure that the 4th-order CIC filter's input never has more than three consecutive +1-valued, or three consecutive -1-valued, input samples.

Regarding your last paragraph, I think if the 4th-order CIC filter's input samples were zeros and +1's then you'll need the same wordwidths as when the input samples were -1's and +1's.

[ - ]
Comment by dfreedMay 10, 2021
Hi Rick -- Thanks very much for your response!

I intended "G" to refer to the number of bits of growth in the CIC filter.  That is, G = M*log2(N*R).  So for R=4, M=4, and N=1, G = 8.  I'm sorry that was unclear.

It sounds like you agree with my colleague's suggestion that 9 bits would be sufficient if we were sure that the output would never hit the +256 rail.  That's good news!

I'm interested in your statement that 9 bits would be sufficient if the input "never has more than three consecutive +1-valued, or three consecutive -1-valued, input samples".  I tried to figure out how many consecutive +1-valued samples would be required to hit the +256 output rail, and I came up with a different answer.  Here's my reasoning: For R=4 M=4 N=1, the CIC filter is equivalent to a cascade of 4 moving average filters, each of which is 4 points long.  The impulse response of each moving average filter is [1 1 1 1].  The impulse response of the CIC filter is [1 1 1 1] convolved with itself 4 times, which is [1 4 10 20 31 40 44 31 20 10 4 1], a 13-point impulse response that sums to +256.  This implies that we would need 13 consecutive +1-valued samples to hit the +256 output rail.  Does this make sense, or have I taken a wrong turn somewhere?

-- Dan
[ - ]
Comment by Rick LyonsMay 10, 2021

Dan, I updated my Reply some minutes ago so it looks like you're responding to my original Reply. Check out my current Reply. Gotta run. I'll thoroughly read your latest Reply later today.

[ - ]
Comment by dfreedMay 10, 2021
Thanks!  I edited my Reply to take account of the edits in your original Reply.
[ - ]
Comment by Rick LyonsMay 11, 2021

Hi Dan. When R=4 M=4 N=1, the CIC filter will have the following impulse response:

[1 4 10 20 31 40 44 40 31 20 10 4 1]

(The above 2nd ‘40’ was missing in your 4th paragraph.)

My MATLAB testing results of your 4th-order agree with what you wrote. That is, , and 13 consecutive -1-valued samples will produce an output sample whose amplitude is -256. (Isn’t it comforting when two guys obtain the same results in their independent testing(!)?) In this situation 10-bit wordwidths will avoid accumulator data overflow.

I believe when the input wordwidth is two bits and you use 9-bit accumulator wordwidths then we want the maximum and minimum output samples to be to be +128 and -128. In that situation, to avoid accumulator overflow, we must be sure that the filter's input never has more than three consecutive +1-valued, or three consecutive -1-valued, input samples. 

Dan, does that agree with your 9-bit wordwidth testing?

[ - ]
Comment by dfreedMay 11, 2021
Hi Rick --

Thanks for your response, and for catching my error in the CIC impulse response.

I think we're in agreement that 13 consecutive +1-valued samples can produce an output of +256, and 13 consecutive -1-valued samples can produce an output of -256.  I think we're also in agreement that more than 3 consecutive +1-valued samples can produce an output > +128, and more than 3 consecutive -1-valued samples can produce an output < -128.

The range of values accommodated by different wordwidths are:
    10-bit: -512 to +511
    9-bit: -256 to +255
    8-bit: -128 to +127

This leads me to the following rules:

1. A 10-bit wordwidth can handle any number of consecutive +1 or -1 samples.

2. A 9-bit wordwidth can handle any number of consecutive -1 samples, but only up to 12 consecutive +1 samples.

3. An 8-bit wordwidth can handle up to 3 consecutive +1 or -1 samples.

Does that sound right?

-- Dan
[ - ]
Comment by Rick LyonsMay 13, 2021

Hi Dan. Sorry for my delayed reply to your latest Comment. I'm in the midst of a significant family emergency and I don't have the free time to sufficiently investigate your Rules# 2 & 3.

My only suggestion is for you to experiment with your 4th-order CIC filter using various input sequences to see what outputs your filter produces. Good Luck.

[ - ]
Comment by dfreedMay 13, 2021

Hi Rick -- I'm so sorry to hear that.  Thank you for the time you've spent on this; your comments have been very helpful.  I hope that everything turns out OK for you and your family.  Take care.

-- Dan

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Registering will allow you to participate to the forums on ALL the related sites and give you access to all pdf downloads.

Sign up

I agree with the terms of use and privacy policy.

Try our occasional but popular newsletter. VERY easy to unsubscribe.
or Sign in