====== Constant declarations ====== ===== constant_declaration ===== constant identifier_list : subtype_indication [ := expression ] ; ===== Parents ===== * entity_declarative_part * architecture_declarative_part * package * package_body * block_declarative_part * function_declarative_part * procedure_declarative_part * process_declarative_part ===== Further definitions ===== ==== identifier_list ==== ''[[.:bnf#identifier]] {, [[.:bnf#identifier]] }'' ==== subtype_indication ==== ''[ resolution_function_ [[.:bnf#name]] ] [[.:bnf#type_mark]] [ [[.:bnf#constraint]] ]'' ==== expression ==== * [[.:bnf#relation]] { and relation } * relation { or relation } * relation { xor relation } * relation [ nand relation ] * relation [ nor relation ] * relation { xnor relation } ===== 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 ; ---- * The constant //name// contains the string " //Dupond// ". * The bit vector //address// has the constant value "00110110". * The constant //mask// is declared as a subtype of //bit_vector// with the value "0101". * The constant //bittab// is declared as a subtype of //bit_vector// with the value "000111Z1Z". * The constant //tab// is declared as a subtype of //table_type// with the individual elements being assigned the constant values 2, 3, 4, -2 and 0. 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 ;