.. _configuring-prefix-and-suffix-rules: 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: .. code-block:: yaml 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: .. code-block:: yaml 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 :code:`exceptions` option: .. code-block:: yaml 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 `_ | +-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+