Main Content

Check if-else statement nesting depth

Specify whether to check if-else statement nesting depth

Since R2020b

Model Configuration Pane: Global Settings / Coding standards

Description

Specify whether to check if-else statement nesting depth. This check corresponds to CGSL-2.G.C.1a of the Industry standard guidelines.

Dependencies

To clear the Check if-else statement nesting depth check box, set the HDL coding standard parameter to Industry.

Settings

on (default) | off

Default: On

on

Check if-else statement nesting depth.

Depth

Maximum if-else statement nesting depth, specified as a positive integer. The default is 3.

off

Do not check if-else statement nesting depth.

Tips

To set this property:

  1. Create an HDL coding standard customization object.

    cso = hdlcoder.CodingStandard('Industry');

  2. Set the IfElseNesting property of the HDL coding standard customization object.

    For example, to enable the check for if-else statement nesting depth with a maximum depth of 5, enter:

    cso.IfElseNesting.enable = true;
    cso.IfElseNesting.depth = 5;

  3. Set the HDLCodingStandardCustomizations property to the HDL coding standard customization object, specify the coding standard, and generate code.

    For example, if your DUT is sfir_fixed/symmetric_fir, enter:

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

Recommended Settings

No recommended settings.

Programmatic Use

Parameter: IfElseNesting property of hdlcoder.CodingStandard object
Type: character vector
Values: 'on' | 'off'
Default: 'on'

Version History

Introduced in R2020b