VHDL303: Only synthesizable and allowed types should be used in design

Summary

Count: 1

ReliabilitySecurityMaintainabilityCode attributeEffort to fixTags
HIGH--Intentionality | Logical20minsynthesis, linter, cnes, cnes-std-05800

Description

Restrict the usage of allowed types in your design:

  • bit
  • bit_vector
  • integer
  • natural
  • positive
  • signed
  • std_logic
  • std_logic_vector
  • std_ulogic
  • std_ulogic_vector
  • unsigned
.

Array of those types and record of those types are also allowed.

Additional types are allowed for generics:

  • boolean

Note that the list of allowed types can be customized through parameters.

Noncompliant code example

With the default values of allowed types: integer,signed,std_logic,std_logic_vector,unsigned
architecture a of e is
  signal s : bit; -- Noncompliant
  constant c : bit; -- Noncompliant

  type my_record_type is record
    a : bit;
    b : std_logic;
  end record;
  signal r : my_record_type; -- Noncompliant: See above record has 'bit' type

  type my_array_type is array(3 downto 0) of bit;
  signal a : my_array_type; -- Noncompliant: See above array type of 'bit'

begin
  process is
    variable v : bit; -- Noncompliant
  begin
  end process;
end;

Compliant solution

With the default values of allowed types: integer,signed,std_logic,std_logic_vector,unsigned
architecture a of e is
  signal s : std_logic;
  constant c : std_logic;

  type my_record_type is record
    a : std_logic;
    b : std_logic;
  end record;

  signal r : my_record_type;

  type my_array_type is array(3 downto 0) of std_logic;
  signal a : my_array_type;

begin
  process is
    variable v : std_logic;
  begin
  end process;
end;

Parameters

Count: 3

ParameterValueDescription
allowAllEnumeratedTypestrueSet to 'true' to allow all enumerated types. Set to 'false' otherwise.
allowedTypesbit,bit_vector,integer,natural,positive,signed,std_logic,std_logic_vector,std_ulogic,std_ulogic_vector,unsignedComma separated list of allowed types.
additionalAllowedTypesForGenericbooleanComma separated list of additional allowed types for generics.