Instant CIC

A floating point model for a CIC decimator, including the frequency response.

Description:

A CIC filter relies on a peculiarity of its fixed-point implementation: Normal operation involves repeated internal overflows that have no effect to the output signal, as they cancel in the following stage.

One way to put it intuitively is that only the speed (and rate of change) of every little "wheel" in the clockworks carries information, but its absolute position is arbitrary.

Modeling a CIC filter without use of bit-accurate numbers is not completely straightforward. Here, I'll show some "instant" solution for the decimating variant. Just add water and stir.

The good. The bad. The ugly.

Let's start with "ugly".

The "time domain" implementation (complete code below) is what I get when I close my eyes to the numerical overflow problem and simply write the CIC difference equations with floats.

Now double precision arithmetics are quite forgiving, and it works well enough. It should do fine for a classroom demo (and please don't use it in the next Mars mission).

Then, the "frequency domain" implementation:

Take the FFT of the signal (assuming for simplicity it wraps around at the end - one cycle of an infinitely periodic signal - Fourier theory applies)

evaluate the known frequency response of a CIC filter at the FFT frequency bins. Reference: [1], eq. 3

Multiply

Use IFFT to go back to the time domain

Decimate

This is only "bad", as taking the FFT of the whole signal all at once might be inconvenient.

The plot shows that all three methods give exactly the same impulse response (accurate to ~10-15). Decimating discards three samples out of four, leaving only red-trace samples that coincide with the other two traces.

Frequency response:

The frequency response is evaluated on the higher (input) rate. Therefore, it is straightforward to investigate the rejection on input frequencies that will cause aliasing, once decimated.

Conclusion

The example shows how to model a CIC decimator in floating point as a conventional FIR filter by sampling the finite-length impulse response.

Sign in

About Markus Nentwig

Markus received his Dipl. Ing. degree in electrical engineering / communications in 1999. Work interests include RF transceiver system design, implementation, modeling and verification. He works as senior architect for Renesas Mobile Europe in Finland.