Accelerating the pace of engineering and science

# CIC Decimation

Decimate signal using Cascaded Integrator-Comb filter

## Library

Filtering / Multirate Filters

dspmlti4

## Description

The CIC Decimation block performs a sample rate decrease (decimation) on an input signal by an integer factor. Cascaded Integrator-Comb (CIC) filters are a class of linear phase FIR filters comprised of a comb part and an integrator part.

The transfer function of a CIC decimator filter is

$H\left(z\right)={H}_{I}{}^{N}\left(z\right){H}_{c}{}^{N}\left(z\right)=\frac{{\left(1-{z}^{-RM}\right)}^{N}}{{\left(1-{z}^{-1}\right)}^{N}}={\left[\sum _{k=0}^{RM-1}{z}^{-k}\right]}^{N}$

where

• HI is the transfer function of the integrator part of the filter.

• HC is the transfer function of the comb part of the filter.

• N is the number of sections. The number of sections in a CIC filter is defined as the number of sections in either the comb part or the integrator part of the filter. This value does not represent the total number of sections throughout the entire filter.

• R is the decimation factor.

• M is the differential delay.

The CIC Decimation block requires a Fixed-Point Designer™ license.

The block supports real and complex fixed-point inputs. In its normal mode of operation, the CIC Decimation block allows the adder's numeric values to overflow and wrap around [1] [3]. The Fixed-Point infrastructure then causes overflow warnings to appear on the command line. This overflow is of no consequence.

### CIC Filter Structure

The filter structures supported by the CIC Decimation and CIC Interpolation blocks exactly match those created by the mfilt.cicdecim and mfilt.cicinterp objects. You can create an mfilt object in any workspace and specify that object in the Multirate filter variable parameter of this block. Alternatively, you can set the Coefficient source to Dialog parameters and specify information about the CIC filter using the available block dialog parameters.

You can use this block to create the following CIC filter structure. This decimator has a latency of N, where N is the number of sections in either the comb or the integrator part of the filter.

## Examples

See GSM Digital Down ConverterGSM Digital Down Converter for an example using the CIC Decimation block.

## Dialog Box

### Coefficient Source

The CIC Decimation block can operate in two different modes. Select the mode in the Coefficient source group box. If you select

• Dialog parameters, you enter information about the filter such as structure and coefficients in the block mask.

• Multirate filter object (MFILT), you specify the filter using an mfilt object.

Different items appear on the CIC Decimation block dialog depending on whether you select Dialog parameters or Multirate filter object (MFILT) in the Coefficient source group box. See the following sections for details:

### Specify Filter Characteristics in Dialog

The Main pane of the CIC Decimation block dialog appears as follows when you select Dialog parameters in the Coefficient source group box.

Decimation factor (R)

Specify the decimation factor of the filter.

Differential delay (M)

Specify the differential delay of the comb part of the filter, M, as shown in the diagram in CIC Filter Structure.

Number of sections (N)

Specify the number of filter sections. The number you specify determines the number of sections in either the comb part of the filter or the integrator part of the filter. This value does not represent the total number of sections in the comb and integrator parts combined.

Data type specification mode

Choose how you specify the fixed-point word length and fraction length of the filter sections and/or output.

• Full precision — In this mode, the word and fraction lengths of the filter sections and outputs are automatically selected for you. All word lengths are set to

where

• I = input word length

• M = differential delay

• N = number of sections

• R = decimation factor

All fraction lengths are set to the input fraction length.

• Minimum section word lengths — In this mode, you specify the word length of the filter output in the Output word length parameter. The block automatically selects the word lengths of the filter sections and all fraction lengths such that each of the section word lengths is as small as possible. The precision of each filter section is less than in Full precision mode, but the range of each section is preserved.

• Specify word lengths — In this mode you specify the word lengths of the filter sections and output in the Section word lengths and Output word length parameters. The block automatically selects fraction lengths for the filter sections and output such that the range of each section is preserved when the least significant bits are discarded.

• Binary point scaling — In this mode you fully specify the word and fraction lengths of the filter sections and output in the Section word lengths, Section fraction lengths, Output word length, and Output fraction length parameters.

Section word lengths

Specify the word length, in bits, of the filter sections.

This parameter is only visible if Specify word lengths or Binary point scaling is selected for the Data type specification mode parameter.

Section fraction lengths

Specify the fraction length of the filter sections.

This parameter is only visible if Binary point scaling is selected for the Data type specification mode parameter.

Output word length

Specify the word length, in bits, of the filter output.

This parameter is only visible if you select Minimum section word lengths, Specify word lengths, or Binary point scaling for the Data type specification mode parameter.

Output fraction length

Specify the fraction length of the filter output.

This parameter is only visible if Binary point scaling is selected for the Data type specification mode parameter.

Rate options

Specify the rate processing rule for the block. You can select one of the following options:

• Enforce single-rate processing — When you select this option, the block performs frame-based processing and produces an output that has the same sample rate as the input. To decimate the signal while maintaining the input sample rate, the block decreases the output frame size. In this mode, the input column size must be a multiple of the decimation factor, R.

• Allow multirate processing — When you select this option, the block performs sample-based processing. In this mode, the block produces an output with a sample rate that is R times slower than the input sample rate.

 Note:   The option Inherit from input (this choice will be removed - see release notes) will be removed in a future release. See Frame-Based Processing in the DSP System Toolbox™ Release Notes for more information.
View filter response

This button opens the Filter Visualization Tool (fvtool) from the Signal Processing Toolbox™ product and displays the filter response of the filter defined in the block. For more information on FVTool, see the Signal Processing Toolbox documentation.

 Note:   If you specify an mfilt object in the Multirate filter variable parameter, you must click the Apply button to apply the filter before using the View filter response button.

### Specify Multirate Filter Object

The Main pane of the CIC Decimation block dialog appears as follows when you select Multirate filter object (MFILT) in the Coefficient source group box.

Multirate filter variable

Specify the multirate filter object (mfilt) that you would like the block to implement. You can specify the mfilt object in one of three ways:

• You can fully specify the mfilt object in the block mask.

• You can enter the variable name of a mfilt object that is defined in any workspace.

• You can enter a variable name for a mfilt object that is not yet defined, as shown in the default value.

For more information on creating mfilt objects, see the mfilt function reference page.

Rate options

Specify the rate processing rule for the block. You can select one of the following options:

• Enforce single-rate processing — When you select this option, the block performs frame-based processing and produces an output that has the same sample rate as the input. To decimate the signal while maintaining the input sample rate, the block decreases the output frame size. In this mode, the input column size must be a multiple of the decimation factor, R.

• Allow multirate processing — When you select this option, the block performs sample-based processing and produces an output with a sample rate that is R times slower than the input sample rate.

 Note:   The option Inherit from input (this choice will be removed - see release notes) will be removed in a future release. See Frame-Based Processing in the DSP System Toolbox Release Notes for more information.
View filter response

This button opens the Filter Visualization Tool (fvtool) from the Signal Processing Toolbox product and displays the filter response of the mfilt object specified in the Multirate filter variable parameter. For more information on FVTool, see the Signal Processing Toolbox documentation.

 Note:   If you specify an mfilt object in the Multirate filter variable parameter, you must click the Apply button to apply the filter before using the View filter response button.

## HDL Code Generation

This block supports HDL code generation using HDL Coder™. HDL Coder provides additional configuration options that affect HDL implementation and synthesized logic. For more information on implementations, properties, and restrictions for HDL code generation, see CIC Decimation.

## References

[1] Hogenauer, E.B., "An Economical Class of Digital Filters for Decimation and Interpolation," IEEE Transactions on Acoustics, Speech and Signal Processing, ASSP-29(2): pp. 155–162, 1981.

[2] Meyer-Baese, U., Digital Signal Processing with Field Programmable Gate Arrays, Springer Verlag, 2001.

[3] Harris, Fredric J., Multirate Signal Processing for Communication Systems, Prentice Hall PTR, 2004.

## Supported Data Types

• Fixed point (signed only)

• 8-, 16-, and 32-bit signed integers