The composite data types have complex values and have several components associated with it and it also represents an array of values with some relationship to one another. Arrays The data type in which each element has the same subtype i.e. homogeneous elements is called as an array. There are generally two predefined array types namely string and Bit_Vector. The former is used to define a character of elements and the latter is used to define an array of bits. They are- Type string is array (positive range <>) of character; Type Bit_Vector is array (natural range <>) of bit; ?2? Here the notation <> means the range is unconstrained, which indicates the user must specify the range when declaring the object. Both string and Bit_Vector are unconstrained and the user has to specify a range n positive for sting and in natural numbers for Bit_Vector. Some of the user defined array data types Type REGISTER_32_Bit is array (31 downto 0) of Bit; Subtype BITVECT3 is Bit_Vector (0 to 2); The REGISTER_32_Bit is a constrained array type which is descending in value. As the Bit vector is an unconstrained data type, subtypes with specific index ranges can be declared. BITVECT3 is a subtype of type Bit_Vector with an ascending index range 0 to 2. Declaration of data objects Before the referencing of the data types in assignment statement they must be declared. These declared objects are subsequently used in the further section for various other statements. Declaration of constants In declaration of the constants it is imperial that their values are specified. The constant name is separated from the type name by : delimiter and the type name is separated from a constant value by := delimiter. Some examples are-
The composite data types have complex values and have several components associated with it and it also represents an array of values with some relationship to one another. Arrays The data type in which each element has the same subtype i.e. homogeneous elements is called as an array. There are generally two predefined array types namely string and Bit_Vector. The former is used to define a character of elements and the latter is used to define an array of bits. They are- Type string is array (positive range <>) of character; Type Bit_Vector is array (natural range <>) of bit; ?2? Here the notation <> means the range is unconstrained, which indicates the user must specify the range when declaring the object. Both string and Bit_Vector are unconstrained and the user has to specify a range n positive for sting and in natural numbers for Bit_Vector. Some of the user defined array data types Type REGISTER_32_Bit is array (31 downto 0) of Bit; Subtype BITVECT3 is Bit_Vector (0 to 2); The REGISTER_32_Bit is a constrained array type which is descending in value. As the Bit vector is an unconstrained data type, subtypes with specific index ranges can be declared. BITVECT3 is a subtype of type Bit_Vector with an ascending index range 0 to 2. Declaration of data objects Before the referencing of the data types in assignment statement they must be declared. These declared objects are subsequently used in the further section for various other statements. Declaration of constants In declaration of the constants it is imperial that their values are specified. The constant name is separated from the type name by : delimiter and the type name is separated from a constant value by := delimiter. Some examples are-