| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Filter Design HDL Coder |
| Contents | Index |
| Learn more about Filter Design HDL Coder |
| On this page… |
|---|
The coder supports code generation for the following types of cascade filters:
Multirate cascade of filter objects ( mfilt.cascade)
Cascade of discrete-time filter objects ( dfilt.cascade)
To generate cascade filter code with FDATool:
Instantiate the filter stages and cascade them in the MATLAB workspace (see the Filter Design Toolbox documentation for the dfilt.cascade and mfilt.cascade filter objects).
The coder currently imposes certain limitations on the filter types allowed in a cascade filter. See Rules and Limitations for Code Generation with Cascade Filters before creating your filter stages and cascade filter object.
Import the cascade filter object into FDATool, as described in Importing and Exporting Quantized Filters in the Filter Design Toolbox documentation.
After you have imported the filter, open the Generate HDL dialog box, set the desired code generation properties, and generate code. See Rules and Limitations for Code Generation with Cascade Filters.
To generate cascade filter code from the command line using fdhdltool:
Instantiate the filter stages and cascade them in the MATLAB workspace (see the Filter Design Toolbox documentation for the dfilt.cascade and mfilt.cascade filter objects).
The coder currently imposes certain limitations on the filter types allowed in a cascade filter. See Rules and Limitations for Code Generation with Cascade Filters before creating your filter stages and cascade filter object.
Call fdhdltool to open the Generate HDL dialog box, passing in the cascade filter object as in the following example:
fdhdltool(my_cascade);
Set the desired code generation properties, and generate code. See Rules and Limitations for Code Generation with Cascade Filters.
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 currently supported, however. If unsupported filter structures or combinations of filter structures are included in the cascade, code generation is disallowed.
For code generation, only a flat (single-level) cascade structure is allowed. Nesting of cascade filters is disallowed.
By default, all input and output registers are removed from the stages of the cascade in generated code, except for the input of the first stage and the output of the final stage. However, if the Add pipeline registers option in Generate HDL dialog box is selected, the output registers for each stage are generated, and internal pipeline registers may be added, depending on the filter structures.
When a cascade filter is passed in to the Generate HDL dialog box, 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 string _stage1, _stage2, ... _stageN to the filter name.
The following figure shows the default settings of the Generate HDL dialog box options when a cascade filter has been designed

![]() | Generating Code for Multirate Filters | Generating Code for Polyphase Sample Rate Converters | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |