Skip to content

Latest commit

 

History

History
564 lines (411 loc) · 24.1 KB

File metadata and controls

564 lines (411 loc) · 24.1 KB

Configuring Uppercase and Lowercase Rules

There are several rules that enforce upper_or_lower, uppercase or lowercase.

There are several options to these rules:

Option Values Default Value Description
case upper lower upper_or_lower camelCase relaxedCamelCase PascalCase RelaxedPascalCase Pascal_Snake_Case regex lower
  • upper = Enforce upper case
  • lower = Enforce lower case
  • upper_or_lower = Allow upper or lower case
  • camelCase = Enforce camelCase with two allowed uppercase characters in a row
  • relaxedCamelCase = Enforce camelCase with any number of uppercase characters in a row
  • PascalCase = Enforce PascalCase with two allowed uppercase characters in a row
  • RelaxedPascalCase = Enforce PascalCase with any number of uppercase characters in a row
  • Pascal_Snake_Case = Enforce Pascal_Snake_Case
  • regex = Enforce user defined regex
prefix_exceptions List of strings Empty list Enforce exception case on prefix if encountered.
suffix_exceptions List of strings Empty list Enforce exception case on suffix if encountered.
case_exceptions List of strings Empty list Enforce case for items in the list.
regex String Empty String Enforce case based on regex string

This is an example of how to configure these options.

rule :
  architecture_004:
     case: 'lower'
     prefix_exceptions:
       - 'G_'
     suffix_exceptions:
       - '_G'
     case_exceptions:
       - 'IEEE'
     regex: ''

The following code snippet is used in the following examples:

constant c_DATA_width : positive := 32;
constant addr_WIDTH_c : positive := 8;

Note

The following examples use rule constant_004.

Example: case set to lower

constant c_data_width : positive := 32;
constant addr_width_c : positive := 8;

Example: case set to upper

constant C_DATA_WIDTH : positive := 32;
constant ADDR_WIDTH_C : positive := 8;

Example: case set to upper_or_lower

This option will not perform any updates to the code as the case could be either upper or lower.

constant c_DATA_width : positive := 32;
constant addr_WIDTH_c : positive := 8;

Example: case set to upper and prefix_exceptions set to c_

constant c_DATA_WIDTH : positive := 32;
constant ADDR_WIDTH_C : positive := 8;

Example: case set to upper and suffix_exceptions set to _c

constant C_DATA_WIDTH : positive := 32;
constant ADDR_WIDTH_c : positive := 8;

Example: case set to upper and case_exceptions set to addr_WIDTH_c

constant C_DATA_WIDTH : positive := 32;
constant addr_WIDTH_c : positive := 8;

Example: case set to regex and regex set to [A-Z][A-Za-z\d]*

The following constant identifiers would pass with the defined regular expression.

constant SPIAccess : std_logic;
constant ADCRegisters : std_logic;

Example: Changing Multiple Case Rules

If there are a lot of case rules you want to change, you can use the global option to reduce the size of the configuration. For example, if you want to uppercase everything except the entity name, you could write the following configuration:

rule :
  global :
    case : 'upper'
  entity_008 :
    case : 'lower'

Rules Enforcing Case