MATLAB Examples

Check Your Model for HDL Compatibility

This example shows how to check whether a subsystem or model is compatible for HDL code generation by using the HDL compatibility checker. The HDL compatibility checker examines the specified system for compatibility problems, such as use of unsupported blocks, illegal data type usage, and so on. The HDL compatibility checker generates an HDL Code Generation Check Report. The report is stored in the target hdlsrc folder. The report file naming convention is system_report.html, where system is the name of the subsystem or model that is passed to the HDL compatibility checker. The HDL Code Generation Check Report is displayed in a MATLAB™ web browser window. Each entry in the HDL Code Generation Check Report has hyperlinks to the block or subsystem that is not compatible for HDL code generation.

Open this Simulink™ model that has a Product block inside a DUT Subsystem. The inputs to the block are a mix of double and integer data types.

load_system('hdlcoder_product_mixed_types')
open_system('hdlcoder_product_mixed_types/DUT')

To check whether the DUT Subsystem is compatible for HDL code generation, run the compatibility checker. To run the checker from the command line, use the checkhdl function. To learn more about the checkhdl function, see checkhdl.

checkhdl('hdlcoder_product_mixed_types/DUT', ...
    'TargetDirectory','C:/HDL_Checks/hdlsrc')
### Starting HDL check.
### Creating HDL Code Generation Check Report file://C:\HDL_Checks\hdlsrc\hdlcoder_product_mixed_types\DUT_report.html
### HDL check for 'hdlcoder_product_mixed_types' complete with 1 errors, 1 warnings, and 0 messages.

Click the hdlcoder_product_mixed_types/DUT/Product link to highlight the Product block inside the DUT Subsystem.

To run the compatibility checker from the UI:

  1. Open the Configuration Parameters dialog box or the Model Explorer. Select the HDL Code Generation pane.
  2. From the Generate HDL for dropdown, select the DUT Subsystem you want to check.
  3. Click the Run Compatibility Checker button.

For a Subsystem that passes the HDL compatibility check, the HDL Code Generation Check Report contains a hyperlink to that subsystem.