Configuring Prefix and Suffix Rules

There are several rules that enforce specific prefixes or suffixes in different name identifiers. It is noted in the documentation, what the default prefixes and suffixes are for each such rule.

All prefix and suffix rules are disabled by default. The defaults for each of these rules can be overridden using a configuration.

Note

Some elements have both prefix and suffix rules. Depending on the desired style, either or both can be enabled.

Overriding Default Prefix Enforcement

The default setting can be changed using a configuration. The rule variable_012 defaults to following prefix: [‘v_’]. We can use the following configuration to change allowed prefix:

rule :
    variable_012:
        # Each prefix rule needs to be enabled explicitly.
        disable: false
        prefixes: ['var_']

Overriding Default Suffix Enforcement

The default setting can be changed using a configuration. For example, the rule port_025 defaults to following suffixes: [‘_I’, ‘_O’, ‘_IO’]. We can use the following configuration to change allowed suffixes:

rule :
    port_025:
        # Each suffix rule needs to be enabled explicitly.
        disable: false
        suffixes: ['_i', '_o']

Exceptions to Prefix and Suffix Enforcement

Exceptions to enforcing prefixes and suffixes can be given using the exceptions option:

rule :
    port_025:
        # Each suffix rule needs to be enabled explicitly.
        disable: false
        suffixes: ['_i', '_o']
        exceptions: ['CLK', '.*_FIELD']

The exceptions option provides a list of keywords, that when matched, prevents the rule from validating the prefix or suffix. The keywords are treated as case insensitive and support regular expressions.

Rules Enforcing Prefixes and Suffixes

Element

Prefix Rule

Suffix Rule

Block Label

block_601

block_600

Constant Identifier

constant_015

constant_600

Function Designator

function_600

function_601

Generate Label

generate_017

generate_600

Generate Parameter Identifier

generate_601

generate_602

Generic Identifier

generic_020

generic_600

Generic Map Identifier

generic_map_601

generic_map_600

Loop Label

loop_600

loop_601

Loop Parameter Identifier

loop_602

loop_603

Package Identifier

package_017

package_016

Package Body Identifier

package_body_601

package_body_600

Port Identifier

port_011

port_025

Process Label

process_036

process_600

Signal Identifier

signal_008

signal_600

Subtype Identifier

subtype_004

subtype_600

Type Identifier

type_definition_015

type_definition_600

Variable Identifier

variable_012

variable_600