Guidelines for Model Setup and Checking Model Compatibility
Use these guidelines to set up your Simulink® model for HDL code generation compatibility and verify that your design is ready to generate code.
Each guideline has a severity level that indicates the level of compliance requirements. To learn more, see HDL Modeling Guidelines Severity Levels.
Customize hdlsetup Function Based on Target Application
Before generating code, configure the model for HDL code generation by using
hdlsetup function uses the
set_param function to set up models for HDL code generation. To view the settings that
hdlsetup function saves on the model, enter:
You can customize the
hdlsetup.m file to only edit parameters required for your target application. For example, you can disable some of the solver settings in the Configuration Parameters and enable certain model parameters such as displaying port data types.
% following config parameters are disabled. % 'Solver', 'fixedstepdiscrete', ... % 'SaveTime', 'off', ... % 'SaveOutput', 'off', ... % 'DataTypeOverride', 'ForceOff',... % Following model parameters are enabled. set_param(model, 'ShowLineDimensions', 'on') set_param(model, 'ShowPortDataTypes', 'on') set_param(model, 'SampleTimeColors', 'on') set_param(model, 'WideLines', 'on')
To view a custom
hdlsetup function, enter:
myhdlsetup saves some HDL-specific parameters by using
hdlset_param on the model.
Check Subsystem for HDL Compatibility
The compatibility checker generates a report specified system for compatibility problems, such as use of unsupported blocks, illegal data type usage, and so on.
To run the check for HDL compatibility:
From the UI, right-click the DUT Subsystem and select HDL Code > Check Subsystem for HDL compatibility.
At the command line, use the
checkhdlfunction. Select the DUT Subsystem and then enter this command:
See also Check Your Model for HDL Compatibility.
When you run this command, the HDL compatibility checker generates an HDL Code
Generation Check Report. The report is stored in the target
hdlsrc folder. If the report does not display
any errors, it indicates that your model is
compatible for HDL code generation.
### Starting HDL Check. ### HDL Check Complete with 0 errors, warnings and messages.
checkhdl does not detect
all compatibility issues. Even if HDL check
completes without any errors or warnings,
HDL Coder™ can generate errors during code generation.
Run Model Checks for HDL Coder
To see whether your DUT Subsystem is compatible for HDL code generation, run the checks in the HDL Code Advisor or the Simulink Model Advisor checks for HDL Coder.
To open the HDL Code Advisor:
From the UI, in the Apps tab, select HDL Coder. The HDL Code tab appears. Select the DUT Subsystem and then click HDL Code Advisor.
To run the model checks for the Subsystem you want to analyze, right-click that Subsystem, and in the context menu, select HDL Code > HDL Code Advisor.
At the command line, use the
When you run this command, the HDL Code Advisor appears.
You may not have to run all checks in the HDL Code Advisor. For example, if your model does not have single or double data types, you do not have to run the checks in the Native Floating Point checks folder. To learn more about each check and whether to run the check for your model, right-click that check and select What's This?.