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 |
||
Constant Identifier |
||
Function Designator |
||
Generate Label |
||
Generate Parameter Identifier |
||
Generic Identifier |
||
Generic Map Identifier |
||
Loop Label |
||
Loop Parameter Identifier |
||
Package Identifier |
||
Package Body Identifier |
||
Port Identifier |
||
Process Label |
||
Signal Identifier |
||
Subtype Identifier |
||
Type Identifier |
||
Variable Identifier |