4.1 Type declarations

...
ENTITY e IS
    ...
BEGIN
    ...
END e ;

...
ARCHITECTURE a OF e IS
    ...
BEGIN
    ...
END a ;

...
CONFIGURATION c
        OF e IS
    ...
    ...
    ...
END


...
PACKAGE pkg IS
    ...
    ...
    ...
END pkg ;


type declaration ::=

      full_type_declaration
    | incomplete_type_declaration


..
PACKAGE BODY pck
        IS
    ...
    ...
    ...
END pck ;

...
b: BLOCK IS
    ...
BEGIN
    ...
END BLOCK b ;

FUNCTION f (...)
    RETURN r IS
    ...
BEGIN
    ...
END f ;

PROCEDURE p (...) IS
    ...
BEGIN
    ...
END p ;

p : PROCESS
    ...
BEGIN
    ...
END PROCESS p ;

4.1.1 Further definitions

full_type_declaration ::=
    type identifier is type_definition ;

incomplete_type_declaration ::=
    type identifier ;

4.1.2 Examples

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

Two Integer types A and B, both of which have a
range of 1 to 10, 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 ;


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 cell ;

TYPE
link IS ACCESS cell ;

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

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 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 ;

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 ).