Main Content

Generate an HDL Coding Standard Report from MATLAB

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 HDL Workflow Advisor

To generate an HDL coding standard report using the HDL Workflow Advisor:

  1. In the HDL Code Generation task, select the Coding Standards tab.

  2. For HDL coding standard, select Industry.

  3. Optionally, using the other options in the Coding Standards tab, customize the coding standard rules.

  4. Click Run to generate code.

    After you generate code, the message window shows a link to the HTML compliance report.

Using the Command Line

To generate an HDL coding standard report using the command line interface, set the HDLCodingStandard property to Industry in the coder.HdlConfig object.

For example, to generate HDL code and an HDL coding standard report for a design, mlhdlc_sfir, with a testbench, mlhdlc_sfir_tb, enter the following commands:

hdlcfg = coder.config('hdl');
hdlcfg.TestBenchName = 'mlhdlc_sfir_tb';
hdlcfg.HDLCodingStandard='Industry';
codegen -config hdlcfg mlhdlc_sfir
### Generating Resource Utilization Report resource_report.html
### Generating default Industry script file mlhdlc_sfir_mlhdlc_sfir_default.prj
### Industry Compliance report with 0 errors, 8 warnings, 4 messages.
### Generating Industry Compliance Report mlhdlc_sfir_Industry_report.html
To open the report, click the report link.

You can customize the coding standard report and coding standard rule checks by specifying an HDL coding standard customization object. For example, suppose you have a design, mlhdlc_sfir, and testbench, mlhdlc_sfir_tb. 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:

hdlcfg = coder.config('hdl');
hdlcfg.TestBenchName = 'mlhdlc_sfir_tb';
hdlcfg.HDLCodingStandard='Industry';
cso = hdlcoder.CodingStandard('Industry');
cso.IfElseChain.length = 5;
hdlcfg.HDLCodingStandardCustomizations = cso;
codegen -config hdlcfg mlhdlc_sfir

See Also

Properties

Related Topics