Capturing Code Generation Settings

To save your code generation settings, you can generate a script that includes the options you selected.

The Generate MATLAB code option of the Generate HDL dialog box makes command-line scripting of HDL filter code and test bench generation easier. The option is located in the Target section of the Generate HDL dialog box, as shown in the following figure.

By default, Generate MATLAB code is cleared.

When you select Generate MATLAB code and then generate HDL code, the coder captures nondefault HDL code and test bench generation settings from the UI and writes out a MATLAB® script. You can use this script to regenerate HDL code for the filter, with the same settings. The script contains:

  • Header comments that document the design settings for the filter object from which code was generated.

  • A function that takes a filter object as its argument, and passes the filter object in to the generatehdl command. The property/value pairs passed to these commands correspond to the code generation settings that applied at the time the file was generated.

The coder writes the script to the target folder. The naming convention for the file is filter_generatehdl.m, where filter is the filter name defined in the Name option.

When code generation completes, the generated script opens automatically for inspection and editing.

The script contains comments that describe the configuration of the input filter object. In subsequent sessions, you can use this information to construct a filter object that is compatible with the generatehdl command in the script. Then you can execute the script as a function, passing in the filter object, to generate HDL code.


  • Generate MATLAB code is available only in the UI. The function generatehdl does not have an equivalent property.

Related Topics

Was this topic helpful?