Interpolate signal using cascaded integrator-comb filter
DSP System Toolbox / Filtering / Multirate Filters
DSP System Toolbox HDL Support / Filtering
The CIC Interpolation block performs a sample rate increase (interpolation) on an input signal by an integer factor. cascaded integrator-comb (CIC) filters are a class of linear phase FIR filters that consist of a comb part and an integrator part.
The CIC Interpolation block requires a Fixed-Point Designer™ license.
Port_1
— Input signalData input, specified as a vector or matrix. If the input is fixed point, it must be signed integer or signed fixed point with power-of-two slope and zero bias.
Data Types: int8
| int16
| int32
| int64
| fixed point
Complex Number Support: Yes
Port_1
— CIC interpolated outputCIC interpolated output, returned as a vector or a matrix. The data type of the output is determined by the settings in the block dialog. The complexity of the output matches that of the input. The number of output rows is R✕Num, where R is the interpolation factor and Num is the number of input rows.
Data Types: int8
| int16
| int32
| int64
| fixed point
Complex Number Support: Yes
Coefficient source
— Source of filter informationDialog parameters
(default) | Filter object
Source of the filter information, specified as one of the following:
Dialog parameters
— Enter information about
the filter, such as Interpolation factor (R),
Differential delay (M) and Number of sections
(N), in the block dialog.
Filter object
— Specify the filter using a
dsp.CICInterpolator
System object™.
Interpolation factor (R)
— Interpolation factor2
(default) | integerInterpolation factor of the filter, specified as an integer greater than 1.
This parameter appears when you set Coefficient source to
Dialog parameters
.
Differential Delay (M)
— Differential delay1
(default) | positive integerSpecify the differential delay of the comb part of the filter, M, as a positive integer. For more details, see CIC Filter Structure.
This parameter appears when you set Coefficient source to
Dialog parameters
.
Number of sections (N)
— Number of filter sections2
(default) | positive integerSpecify 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.
This parameter appears when you set Coefficient source to
Dialog parameters
.
Data type specification mode
— Specify word length and fraction length of filter sections and outputFull precision
(default) | Minimum section word lengths
| Specify word lengths
| Binary point scaling
Choose how you specify the fixed-point word length and fraction length of the filter sections and/or output:
Full precision
— The word and fraction
lengths of the filter sections and outputs are automatically selected for you. The
output and last section word lengths (WL) are set to:
where,
I –– Input word length
M –– Differential delay
N –– Number of sections
R –– Interpolation factor
The other section word lengths are set to accommodate the bit growth, as described in Hogenauer's paper [1]. All fraction lengths are set to the input fraction length.
Minimum section word lengths
— Specify the
word length of the filter output in the Output word length
parameter. The word lengths of the filter sections are set in the same way as in
Full precision
mode.
The section fraction lengths are set to the input fraction length. The output fraction length is set to the input fraction length minus the difference between the last section word length and the output word length.
Specify word lengths
— Specify the word
lengths of the filter sections and output in the Section word
lengths and Output word length parameters. The
fraction lengths of the filter sections are set such that the spread between word
length and fraction length is the same as in full-precision mode. The output
fraction length is set to the input fraction length minus the difference between
the last section word length and the output word length.
Binary point scaling
— 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.
This parameter appears when you set Coefficient source to
Dialog parameters
.
Section word lengths
— Word length of filter sections16 16 16 16
] (default) | scalar | row vectorWord lengths of filter sections, specified as a scalar or a vector of length equal to 2N, where N is the number of filter sections. The section word length must be in the range [2, 128].
This parameter appears when you set Coefficient source to
Dialog parameters
and Data type specification
mode to either Specify word lengths
or
Binary point scaling
.
Section fraction lengths
— Fraction length of filter sections0
(default) | integerFraction lengths of filter sections, specified as an integer.
This parameter appears when you set Coefficient source to
Dialog parameters
and Data type specification
mode to Binary point scaling
.
Output word length
— Word length of filter output32
(default) | integerWord length of the filter output, specified as an integer in the range [2, 128].
This parameter appears when you set Coefficient source to
Dialog parameters
and Data type specification
mode to any option other than Full
precision
.
Output fraction length
— Fraction length of filter output0
(default) | integerFraction length of the filter output, specified as an integer.
This parameter appears when you set Coefficient source to
Dialog parameters
and Data type specification
mode to Binary point scaling
.
Input processing
— Method of processing inputColumns as channels (frame based)
(default) | Elements as channels (sample based)
Specify how the block should process the input. You can set this parameter to one of the following options:
Columns as channels (frame based)
— The block
treats each column of the input as a separate channel. In this mode, the block
always performs single-rate processing.
Elements as channels (sample based)
— The
block treats each element of the input as a separate channel. In this mode, the
input to the block must be a scalar or a vector. You can use the Rate
options parameter to specify whether the block performs single-rate or
multirate processing.
Rate options
— Rate processing ruleEnforce single-rate processing
(default) | Allow multirate processing
Specify the rate processing rule for the block. You can select one of the following options:
Enforce single-rate processing
— The block
maintains the sample rate of the input.
Allow multirate processing
— The block
produces an output with a sample rate that is R times faster than
the input sample rate. To select this option, you must set the Input
processing parameter to Elements as channels (sample
based)
.
Filter object
— Multirate filter objectdsp.CICInterpolator
System object
Specify the name of the multirate filter object that you want the block to
implement. You must specify the filter as a dsp.CICInterpolator
System object.
You can define the System object in the block dialog or in a MATLAB® workspace variable.
For information on creating System objects, see Define Basic System Objects.
This parameter appears when you set Coefficient source to
Filter object
.
View Filter Response
— View filter responseThis 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 a filter in the Filter object parameter, you must apply the filter by clicking the Apply button before using the View Filter Response button.
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
The transfer function of a CIC interpolator filter is
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 interpolation factor.
M is the differential delay.
The CIC Interpolation block has the following CIC filter structure. The structure consists of N sections of cascaded comb filters, followed by a rate change by a factor R, followed by N sections of cascaded integrators [1] .
The unit delay in the integrator portion of the CIC Filter can be located in either the feed-forward or the feedback path. These two configurations yield an identical filter frequency response. However, the numerical outputs from these two configurations are different due to the latency. This block puts the unit delay in the feed-forward path of the integrator because that configuration is preferred for HDL implementation.
[1] Hogenauer, E.B. “An Economical Class of Digital Filters for Decimation and Interpolation” IEEE Transactions on Acoustics, Speech and Signal Processing. Vol. 29, Number 2, 1981, pp. 155–162, 1981.
[2] Meyer-Baese, U. Digital Signal Processing with Field Programmable Gate Arrays. New York: Springer Verlag, 2001.
[3] Harris, Fredric J., Multirate Signal Processing for Communication Systems. Upper Saddle River, NJ: Prentice Hall PTR, 2004.
Generated code relies on memcpy
or
memset
functions (string.h
) under certain
conditions.
HDL Coder™ provides additional configuration options that affect HDL implementation and synthesized logic.
HDL Coder supports Coefficient source options Dialog parameters and Filter object.
When you use AddPipelineRegisters, registers are placed based on the filter structure. The pipeline register placement determines the latency.
Pipeline Register Placement | Latency (clock cycles) |
---|---|
A pipeline register is added between the comb stages of the differentiators. | NS , the number of sections (at the input side). |
AddPipelineRegisters | Insert a pipeline register between stages of computation in a filter. See also AddPipelineRegisters (HDL Coder). |
ConstrainedOutputPipeline | Number of registers to place at
the outputs by moving existing delays within your design. Distributed
pipelining does not redistribute these registers. The default is
|
InputPipeline | Number of input pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
OutputPipeline | Number of output pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
Vector and frame inputs are not supported for HDL code generation.
When you select Dialog parameters, the Filter
Structure option Zero-latency interpolator
is
not supported for HDL code generation. From the Filter Structure
drop-down list, select Interpolator
.
When you use AddPipelineRegisters, delays in parallel paths are not automatically balanced. Manually add delays where required by your design.
If the input is fixed point, it must be signed integer or signed fixed point with power-of-two slope and zero bias.
dsp.CICCompensationDecimator
| dsp.CICCompensationInterpolator
| dsp.CICDecimator
| dsp.CICInterpolator
| dsp.FIRDecimator
| dsp.FIRHalfbandDecimator
| dsp.FIRHalfbandInterpolator
| dsp.FIRInterpolator