Check HDL Compatibility of Simulink Model Using HDL Code Advisor
The HDL Code Advisor verifies and updates your Simulink® model or subsystem for compatibility with HDL code generation. The Model Checker checks for model configuration settings, ports and subsystem settings, block settings, support for native floating point, and conformance to the industry-standard rules. The Code Advisor produces a report that lists suboptimal conditions or settings, and then proposes better model configuration settings.
The HDL Code Advisor has these caveats:
If you reference one model in another by using a Model block, the HDL Code Advisor checks the model configurations or settings of the parent model. To check whether the referenced model is compatible with HDL code generation, open the HDL Code Advisor for the referenced model, and then run the checks.
If you run the checks on masked library blocks in your Simulink model, the Code Advisor cannot verify whether the blocks inside the library blocks have HDL-compatible settings.
When you apply Model Advisor checks to your model, it increases the likelihood that your model does not violate certain modeling standards or guidelines. However, it does not guarantee that the design is ready for HDL code generation. Make sure that you verify the design by using multiple methods for HDL code generation readiness.
Open the HDL Code Advisor
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 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, enter
systemis a handle or name of the model or subsystem that you want to check. For more information, see
In the HDL Code Advisor, the left pane lists the folders in the hierarchy. Each folder represents a group or category of related checks. Expanding the folders shows available checks in each folder. From the left pane, you can select a folder or an individual check. The HDL Code Advisor displays information about the selected folder or check in the right pane. The content of the right pane depends on the selected folder or check. The right pane has a Result subpane that contains a display area for status messages and other task results.
To learn more about each individual check, right-click that check, and select What's This?.
Run Checks In the HDL Code Advisor
In the HDL Code Advisor window, you can run individual checks or a group of checks. To run a check, Select that check and then click Run This Check. For example, to run the Check for safe model parameters, select the check box, and then click Run This Check.
In the HDL Code Advisor window, you can run a group of checks within a folder.
Select the checks that you want to run.
Select the folder that contains these checks and then click Run Selected Checks.
This example shows how to run selected checks in the Model configuration checks folder.
Fix HDL Code Advisor Warnings or Failures
In the HDL Code Advisor, if a check fails, the right pane shows the warning or failure information in a Result subpane. The Result subpane displays model settings that are not compliant. For some tasks, use the Action subpane to apply the Code Advisor recommended settings. This example displays the incorrect model settings that caused the Check for safe model parameters to fail.
To apply the corresponding model configuration settings that the code generator reported in the Result subpane, click the Modify Settings button. After you click Modify Settings, the Result subpane reports the changes that were applied. You can now run this check.
View and Save HDL Code Advisor Reports
When you run checks in the HDL Code Advisor, HDL Coder™ generates an HTML report of the check results. Each folder in the HDL Code Advisor contains a report for the checks within that folder and its subfolders. To access reports, select a folder such as Model configuration checks, and in the Report subpane, click Save As. If you rerun the HDL Code Advisor, the report is updated in the working folder, not in the save location.
This report shows typical results for a run of the Model configuration checks folder.
As you run the checks, the HDL Code Advisor updates the reports with the latest information for each check in the folder. When you run the checks at different times, timestamps appear at the top right of the report to indicate when checks have been run. Checks that occurred during previous runs have a timestamp following the check name. You can filter checks in the report such that tasks that are Not Run do not appear or show tasks that Passed, and so on. To view the report for a folder each time the tasks for the folder have been run, select Show report after run.