The coder supports code generation for a multirate cascade of
filter objects (
Instantiate the filter stages and cascade them in the MATLAB® workspace.
hm1 = dsp.FIRDecimator('DecimationFactor',12); hm2 = dsp.FIRDecimator('DecimationFactor',4); my_cascade = dsp.FilterCascade(hm1,hm2);
dsp.FilterCascadein the DSP System Toolbox™ documentation.
The coder currently imposes certain limitations on the filter types allowed in a cascade filter. See Limitations for Code Generation with Cascade Filters before creating your filter stages and cascade filter object.
fdhdltool to open the Generate HDL dialog
box, passing in the cascade filter System object™ and the fixed-point
input data type.
generatehdl to generate HDL code for
your filter, passing in the cascade filter System object, the
fixed-point input data type, and code generation properties as desired.
The following rules and limitations apply to cascade filters when used for code generation:
You can generate code for cascades that combine the following filter types:
Decimators and/or single-rate filter structures
Interpolators and/or single-rate filter structures
Code generation for cascades that include both decimators and interpolators is not supported. If unsupported filter structures or combinations of filter structures are included in the cascade, code generation returns an error.
For code generation, only a flat (single-level) cascade structure is allowed. Nesting of cascade filters is disallowed.
By default, generated HDL code excludes the input and output registers from the stages of the cascade, except for:
The input of the first stage and the output of the final stage.
The input registers of interpolator stages.
To generate output registers for each stage, select the Add pipeline registers option in the Generate HDL dialog box. When using this option, internal pipeline registers might also be added, depending on the filter structures.
When a cascade filter is passed to
the FIR adder style option is disabled. If you
require tree adders for FIR filters in a cascade, select the Add
pipeline registers option (since pipelines require tree
style FIR adders).
The coder generates separate HDL code files for each
stage of the cascade, in addition to the top-level code for the cascade
filter itself. The filter stage code files are identified by appending
the filter name.
The figure shows the default settings of the Generate HDL dialog box options for a cascade filter design.