This site uses cookies to deliver our services and to show you relevant ads and job listings. By using our site, you acknowledge that you have read and understand our Cookie Policy , Privacy Policy , and our Terms of Service . Your use of the Related Sites, including DSPRelated.com, FPGARelated.com, EmbeddedRelated.com and Electronics-Related.com, is subject to these policies and terms.

Rick Lyons ● February 15, 2012 ● ● Coded in February 15, 2012Coded in Matlab

The following Matlab code computes the amount register bit-pruning described in Eugene's Hogenauer's famous paper on cascaded integrator-comb (CIC) decimation filters [1]. Although there are many detailed descriptions of CIC filters in the literature [2-6], my notation here corresponds to that used in Hogenauer's IEEE paper.

Figure 1(a) shows a general Nth-order CIC filter and Figure 1(b) shows an example of a 3rd-order CIC filter. Figure 1(c) shows that filter having the following parameters: N=3; R=8; M=1; B in =12; and B out =12. (The variables B in and B out represent the filter's input and output binary word widths respectively.) Due to those parameters, the filter's gain is 512 and all of the stages' adder/accumulator registers must be 21 bits in width. With the output word width being 12 bits, the 'T' block in Figure 1(c) represents a truncation of nine least significant bits (LSBs).

Note in Figure 1(c) that the 12-bit input word, in two's complement format, must be sign-extended (SE) to 21 bits before it's applied to the adder in the 1st integrator.

Figure 1

While Hogenauer's IEEE CIC paper was certainly revolutionary, I believe one of the truly clever aspects of his paper was how he addressed that final 'T' truncation operation. Hogenauer realized that the quantization error induced by that final truncation can be distributed among the individual stages of the filter by truncating LSBs from each stage's adder/accumulator output word. In doing so, he could reduce the stages' computational workloads without increasing the overall filter truncation quantization error. Hogenauer's description of this whole idea is a bit challenging to understand but it's certainly not beyond comprehension. (I had to read his 'distributed truncation' text several times.)

Figure 2 shows an example of the 'distributed truncation', what's called "register pruning", for the filter in Figure 1(c). The variable B j specifies the number of adder/accumulator LSBs can be truncated from the Figure 1(c) filter's jth stage. For example, three LSBs are truncated (loped off) from the output of the first integrator's 21-bit adder/accumulator output word prior to routing to the second integrator. Therefore the second integrator in Figure 2 need only accept an 18-bit input word rather than a 21-bit input word as was the case in Figure 1(c).

Figure 2



The following Matlab code computes the values for B j for the jth stages in Nth-order CIC decimation filters where j = 1, 2, ...2N+1. Note that B 2N+1 represents the final truncation taking place after the final comb stage.

Running the following Matlab code for the Figure 1(c) filter parameters yields a result of:

N = 3, R = 8, M = 1, Bin = 12, Bout = 12

Num of Bits Growth Due To CIC Filter Gain = 9

Num of Accumulator Bits With No Truncation = 21

Stage Bj Accum width

1 0 21

2 3 18

3 4 17

4 5 16

5 6 15

6 7 14

7 9 12 (final truncation)

>>

The Bj values in the above center column are the B j values shown in Figure 2.

Warning: It's possible, for certain combinations of N, R, M, B in , and B out , that negative values of B j are computed, particularly when the product RM is a small number, and B out >B in . When using the following Matlab code, if you compute a negative value of B j then that value should be ignored and no truncation should performed at that jth stage.





References

[1] Eugene Hogenauer, "An Economical Class of Digital Filters For Decimation and Interpolation," IEEE Trans. Acoust. Speech and Signal Proc., Vol. ASSP?29, April 1981, pp. 155-162.

[2] Richard Lyons, "Understanding Cascaded Integrator-comb Filters", Embedded Systems Programming magazine, March 31, 2005. Available at:

http://www.design-reuse.com/articles/10028/underst...

[3] F. Harris, Multirate Signal Processing for Communication Systems, Prentice Hall, Upper Saddle River, New Jersey, 2004, Chapter 11.

[4] Richard Lyons, Understanding Digital Signal Processing, 3rd Ed., Prentice Hall, Upper Saddle River, New Jersey, 2010, Chapter 10.

[5] Peter Thorwartl, "Implementation of Filters", Part 3, lecture notes. Available at:

should be:

https://www.so-logic.net/documents/trainings/03_so_implementation_of_filters.pdf

[6] Uwe Meyer-Baese, "Digital Signal Processing with Field Programmable Gate Arrays" 3rd Ed., Springer Publishing, 2007, Section 5.3.4.

Matlab Code:

Here's the Matlab code that computes CIC decimation filter register pruning for up to 7th-order filters: