vhdl_reference_93:type_declarations

Type declarations

  • full_type_declaration
  • incomplete_type_declaration
  • entity_declarative_part
  • architecture_declarative_part
  • package
  • package_body
  • block_declarative_part
  • function_declarative_part
  • procedure_declarative_part
  • process_declarative_part

type identifier ;

Two Integer types A and B, both of which have a range of 1 to 10, are declared.

TYPE A IS RANGE 1 TO 10 ;
TYPE B IS RANGE 1 TO 10 ;

The physical type capacitance is declared as a Real-type with a range of 0 to 1E16. Afterwards a base unit and units derived from it are declared.

TYPE capacitance IS RANGE 0 TO 1E16
   UNITS
      fF ; -- Femtofarad
      pF = 1000 fF ;  -- Picofarad
      nF = 1000 pF ;  -- Nanofarad
      uF = 1000 nF ;  -- Microfarad
   END UNITS ;

A recursive structure is created. At first type cell is declared incompletely. As a consequence the access type link is declared on the type cell .

Afterwards type cell is declared completely as Record. The elements succ and pred are declared as index types. By doing so an interlinked list can be created in which every element receives an index to both its predecessor and its successor.

TYPE cell ;
 
TYPE link IS ACCESS cell ;
 
TYPE cell IS
   RECORD
      value : integer ;
      succ : link ;
      pred : link ;
   END RECORD ;

These are examples of standard predefined types. boolean , bit and character are enumeration types.

string and bit_vector are arrays which can have any width (RANGE <>) with the maximum width being determined by the corresponding type ( positive , natural ).

TYPE boolean IS ( false, true ) ;
 
TYPE bit IS ( '0', '1' ) ;
 
TYPE string IS ARRAY (positive
      RANGE <>) OF character ;
TYPE bit_vector IS ARRAY
      (natural RANGE <>) OF bit ;