hdlcoder.CodingStandard

Create HDL coding standard customization object

Syntax

  • cso = hdlcoder.CodingStandard(standardName)
    example

Description

example

cso = hdlcoder.CodingStandard(standardName) creates an HDL coding standard customization object that you can use to customize the rules and the appearance of the coding standard report.

If you do not want to customize the rules or appearance of the coding standard report, you do not need to create an HDL coding standard customization object.

Examples

collapse all

Create an HDL coding standard customization object, cso.

cso = hdlcoder.CodingStandard('Industry');

Customize the coding standard options as follows:

  • Do not show passing rules in the coding standard report.

  • Set the maximum if-else nesting depth to 2.

  • Disable the check for line length.

cso.ShowPassingRules.enable = false;
cso.IfElseNesting.depth = 2;
cso.LineLength.enable = false;

Create an HDL codegen configuration object.

hdlcfg = coder.config('hdl');

Specify the coding standard and coding standard customization object.

hdlcfg.HDLCodingStandard = 'Industry';
hdlcfg.HDLCodingStandardCustomizations = cso;

Specify your test bench function name. In this example, the test bench function is mlhdlc_dti_tb.

hdlcfg.TestBenchName = 'mlhdlc_dti_tb';

Generate HDL code for the design and check the code according to the customized HDL coding standard rules. In this example, the design function is mlhdlc_dti.

codegen -config hdlcfg mlhdlc_dti

Create an HDL coding standard customization object, cso.

cso = hdlcoder.CodingStandard('Industry');

Customize the coding standard options as follows:

  • Do not show passing rules in the coding standard report.

  • Set the maximum line length to 80 characters.

  • Check that module, instance, and entity names are between 5 and 50 characters long.

cso.ShowPassingRules.enable = false;
cso.LineLength.length = 80;
cso.ModuleInstanceEntityNameLength.length = [5 50];

Generate HDL code for your design and check it according to the customized HDL coding standard rules. In this example, the model is sfir_fixed, with a DUT subsystem, symmetric_fir.

makehdl('sfir_fixed/symmetric_fir','HDLCodingStandard','Industry',...
        'HDLCodingStandardCustomizations',cso)

Related Examples

Input Arguments

collapse all

Specify the HDL coding standard to customize. The standardName value must match the HDLCodingStandard property value.

Example: 'Industry'

Output Arguments

collapse all

HDL coding standard customizations, returned as an HDL coding standard customization object.

Was this topic helpful?