Table of Contents

Constant declarations

constant_declaration

constant identifier_list : subtype_indication [ := expression ] ;

Parents

Further definitions

identifier_list

identifier {, identifier }

subtype_indication

[ resolution_function_ name ] type_mark [ constraint ]

expression

Examples

The constant cte is of the type integer and has the value 5. The constants Vdd and Vcc are of the type bit and have the value '1'. The constant minimum_setup-_time is of the physical type time and has the value 5 ns.

CONSTANT cte : integer := 5 ;
CONSTANT Vdd, Vcc : bit := '1' ;
CONSTANT minimum_setup_time :
      time := 5 ns ;

CONSTANT name : string := "Dupond" ;
 
CONSTANT address : bit_vector := "00110110" ;
 
CONSTANT mask : bit_vector( 1 TO 3 ) := "0101" ;
 
CONSTANT bittab : bit_vector( 1 TO 9 ) :=
      ( 1 TO 3 => '0', 7 | 9 => 'Z', OTHERS => '1' ) ;
 
CONSTANT tab : table_type( 0 TO 4 ) :=
      ( 2, 3, 4, -2, 0 ) ;

An incomplete declaration of a constant, such as that of deferred shown here, may only be contained in the package declaration. The complete declaration of the constant has to be contained in the package body. If the constant`s value is changed only the PACKAGE BODY has to be newly translated and none of the design units which are constructed upon the package are affected.

PACKAGE P IS
   CONSTANT deferred : integer ;
END P;
 
PACKAGE BODY P IS
   CONSTANT deferred : integer := 200 ;
END P ;