Generate HDL Coding Standard Report from Simulink
You can generate an HDL coding standard report that shows how well your generated code follows industry standards. You can optionally customize the coding standard report and the coding standard rules.
Using the Configuration Parameters Dialog Box
To generate an HDL coding standard report using the Configuration Parameters dialog box:
To open the Configuration Parameters dialog box, in the Apps gallery, click HDL Coder. The HDL Code tab in the Simulink® toolstrip appears. In the Prepare section, click Settings.
In the HDL Code Generation > Global Settings pane of the Configuration Parameters dialog box, select the Coding standards tab.
For the HDL coding standard parameter, select Industry and click Apply.
Optionally, use the other options in the Coding standards tab to customize the coding standard rules and click Apply.
You can then generate HDL code by clicking the Generate HDL Code button in the HDL Code tab in the Simulink toolstrip.
After you generate code, the message window shows a link to the HTML compliance report. To open the report, click the report link.
Using the Command Line
To generate an HDL coding standard report using the command-line
interface, set the HDLCodingStandard
property
to Industry
by using makehdl
or
hdlset_param
.
For example, to generate HDL code and an HDL coding standard report
for a subsystem, sfir_fixed/symmetric_sfir
, enter
the following
command:
makehdl('sfir_fixed/symmetric_fir','HDLCodingStandard','Industry')
### Generating HDL for 'sfir_fixed/symmetric_fir'. ### Starting HDL check. ### HDL check for 'sfir_fixed' complete with 0 errors, 0 warnings, and 0 messages. ### Begin VHDL Code Generation for 'sfir_fixed'. ### Working on sfir_fixed/symmetric_fir as hdlsrc\sfir_fixed\symmetric_fir.vhd ### Industry Compliance report with 4 errors, 18 warnings, 5 messages. ### Generating Industry Compliance Report symmetric_fir_Industry_report.html ### Generating SpyGlass script file sfir_fixed_symmetric_fir_spyglass.prj ### HDL code generation complete.
You can customize the coding standard report and coding standard rule
checks by specifying an HDL coding standard customization object.
For example, for a subsystem,
sfir_fixed/symmetric_sfir
, you can create
an HDL coding standard customization object,
cso
, set the maximum if-else
statement chain length to 5 by using the
IfElseChain
property, and generate
code:
cso = hdlcoder.CodingStandard('Industry'); cso.IfElseChain.length = 5; makehdl('sfir_fixed/symmetric_fir','HDLCodingStandard','Industry', ... 'HDLCodingStandardCustomizations',cso)