Type Rules

type_001

This rule checks the indent of the type declaration.

Violation

architecture RTL of FIFO is

    type state_machine is (IDLE, WRITE, READ, DONE);

begin

Fix

architecture RTL of FIFO is

  type state_machine is (IDLE, WRITE, READ, DONE);

begin

type_002

This rule checks the type keyword has proper case.

Note

The default is lowercase.

Refer to the section Configuring Uppercase and Lowercase Rules for information on changing the default case.

Violation

TYPE state_machine is (IDLE, WRITE, READ, DONE);

Fix

type state_machine is (IDLE, WRITE, READ, DONE);

type_003

This rule checks for spaces after the type keyword.

Violation

type   state_machine is (IDLE, WRITE, READ, DONE);

Fix

type state_machine is (IDLE, WRITE, READ, DONE);

Note

The number of spaces after the signal keyword is configurable. Use the following YAML file example to change the default number of spaces.


rule:
type_003:
spaces: 3

type_004

This rule checks the type name has proper case.

Note

The default is lowercase.

Refer to the section Configuring Uppercase and Lowercase Rules for information on changing the default case.

Violation

type STATE_MACHINE is (IDLE, WRITE, READ, DONE);

Fix

type state_machine is (IDLE, WRITE, READ, DONE);

type_005

This rule checks the indent of multiline enumerated types.

Violation

type state_machine is (
IDLE,
  WRITE,
READ,
   DONE);

Fix

type state_machine is (
  IDLE,
  WRITE,
  READ,
  DONE);

type_006

This rule checks for a single space before the is keyword.

Violation

type state_machine    is (IDLE, WRITE, READ, DONE);

Fix

type state_machine is (IDLE, WRITE, READ, DONE);

type_007

This rule checks for a single space after the is keyword.

Violation

type state_machine is     (IDLE, WRITE, READ, DONE);

Fix

type state_machine is (IDLE, WRITE, READ, DONE);

type_008

This rule checks the closing parenthesis of multiline enumerated types is on it’s own line.

Violation

type state_machine is (
  IDLE,
  WRITE,
  READ,
  DONE);

Fix

type state_machine is (
  IDLE,
  WRITE,
  READ,
  DONE
);

type_009

This rule checks for an enumerate type after the open parenthesis on multiline enumerated types.

Violation

type state_machine is (IDLE,
  WRITE,
  READ,
  DONE
);

Fix

type state_machine is (
  IDLE,
  WRITE,
  READ,
  DONE
);

type_010

This rule checks for a blank line above the type declaration.

Violation

signal wr_en : std_logic;
type state_machine is (IDLE, WRITE, READ, DONE);

Fix

signal wr_en : std_logic;

type state_machine is (IDLE, WRITE, READ, DONE);

type_011

This rule checks for a blank line below the type declaration.

Violation

type state_machine is (IDLE, WRITE, READ, DONE);
signal sm : state_machine;

Fix

type state_machine is (IDLE, WRITE, READ, DONE);

signal sm : state_machine;

type_012

This rule checks the indent of record elements in record types.

Violation

type interface is record
  data : std_logic_vector(31 downto 0);
chip_select : std_logic;
    wr_en : std_logic;
end record;

Fix

type interface is record
  data : std_logic_vector(31 downto 0);
  chip_select : std_logic;
  wr_en : std_logic;
end record;

type_013

This rule checks the is keyword in type definitions has proper case.

Note

The default is lowercase.

Refer to the section Configuring Uppercase and Lowercase Rules for information on changing the default case.

Violation

type interface IS record
type interface Is record
type interface is record

Fix

type interface is record
type interface is record
type interface is record

type_014

This rule checks for consistent capitalization of type names.

Violation

type state_machine is (IDLE, WRITE, READ, DONE);

signal sm : State_Machine;

Fix

type state_machine is (IDLE, WRITE, READ, DONE);

signal sm : state_machine;

type_015

This rule checks for valid prefixes in user defined type identifiers.

Note

The default new type prefix is “t_”.

Refer to the section Configuring Prefix and Suffix Rules for information on changing the allowed prefixes.

Violation

type my_type is range -5 to 5 ;

Fix

type t_my_type is range -5 to 5 ;