next up previous contents
Next: 3.3 Access Types Up: 3. Data Types Previous: 3.1 Scalar Types

3.2 Composite Types

Array:
Similarly to other programming languages, an array consists of consecutively numbered elements of the same type. The declaration of an array type includes the name of the array type, the description of the index type and range, and the specification of the element type.

Syntax:
type array_name is array (index_description) of element_type;

Possibilities for index_description:
index_range
|                 integer range
index_type
|      enumeration type as index
index_type range index_range
|   general description
index_type range <>       
unconstrained type;
   
range must be specified in variable/signal declaration

Certain characteristics of arrays are explained in the following examples:

The following array types are predefined in the appropriate packages:

Record:
Data elements of different types can be collected in one data object by defining a record type. This is useful for abstract data objects. Single elements of a record can be accessed by their name.

Example:
type TWO_DIGIT is       
numbers from -99 to +99
  record   SIGN: bit;
          MSD   : integer range 0 to 9;
          LSD   : integer range 0 to 9;
  end record;
...
process ...
  variable ACNTR, BCNTR: TWO_DIGIT;
begin
  ACNTR.SIGN := '1';             
access to a element
  ACNTR.MSD := 1;
  ACNTR.LSD := ACNTR.MSD;
  ...
  BCNTR := TWO_DIGIT'('0',3,6);   
aggregate, type qualified
  ...
end process;


next up previous contents
Next: 3.3 Access Types Up: 3. Data Types Previous: 3.1 Scalar Types
Richard Geissler
1998-10-07