Array
Formal Definition
A type, the value of which
consists of elements that are all of the same subtype (and hence, of
the same type). Each element is uniquely distinguished by an index
(for a onedimensional array) or by a sequence of indexes (for a
multidimensional array). Each index must be a value of a discrete
type and must lie in the correct index range.
Simplified Syntax
type type_name is
array (range) of element_type
type type_name is
array (type range <>)
of element_type
Description
The array is a composite
object, which elements are of the same subtype. Each of the elements
is indexed by one or more indices belonging to specified discrete
types. The number of indices is the number of dimensions, i.e.
onedimensional array has one index, twodimensional has two indices,
etc. The order of indices is significant and follows the order of
dimensions in the type declaration (example 1).
An array may be either constrained or unconstrained. The array is
constrained if the size of the array is constrained. The size of the
array can be constrained using a discrete type mark or a range. In
both cases, the number of the elements in the array is known during
the compilation. Several declarations of constrained arrays are
presented in example 1.
The array is said to be unconstrained if its size is unconstrained:
the size of the unconstrained array is declared in the form of the
name of the discrete type, which range is unconstrained. The number
of elements of unconstrained array type is unknown. The size of a
particular object is specified only when it is declared. Example 2
presents several declarations of unconstrained arrays.
Package STANDARD contains declarations of two onedimensional
unconstrained predefined array types: STRING and BIT_VECTOR. The
elements of the STRING type are of the type CHARACTER and are indexed
by positive values (i.e. counted from 1), and the elements of the
BIT_VECTOR type are of the type BIT and are indexed by natural values
(i.e. counted from 0). See string type
and Bit_Vector for details.
Array elements are referenced by indices and can be assigned values
individually or using concatenation,
aggregates, slices or any mixture of those methods. See
respective topics for details.
Examples
Example 1
type Real_Matrix
is array (1 to 10)
of REAL;
type BYTE is array
(0 to 7) of BIT;
type Log_4_Vector
is array (POSITIVE range 1
to 8, POSITIVE
range 1 to 2) of Log_4;
type X
is (LOW, HIGH);
type DATA_BUS
is array (0 to 7, X)
of BIT;
The type Real_Matrix is an array consisting of 10 elements, each of
which is of the type REAL. Log_4_Vector is a twodimensional array 82
and its elements are of type Log_4 (which must have been declared
earlier). Also the type DATA_BUS is a twodimensional array of the
same size, but note that one of the dimensions is defined as
enumeration type.
Example 2
 unconstrained array of element of Real type:
type Real_Matrix is array
(POSITIVE range <>) of Real;
variable Real_Matrix_Object
: Real_Matrix (1 to 8);
 unconstrained array of elements of Log_4 type:
type Log_4_Vector is array
(NATURAL range <>,
POSITIVE range<>) of Log_4;
variable L4_Object :
Log_4_Vector (0 to 7, 1 to 2);
Examples of unconstrained types: Real_Matrix is when an unconstrained
type and an object of this type is declared (Real_Matrix_Object) it
is restricted to 8 elements. In similar way L4_Object is constrained
from an unconstrained twodimensional type Log_4_Vector.
Important Notes

Synthesis tools do generally not support multidimensional arrays. The
only exceptions to this are twodimensional "vectors of
vectors". Some synthesis tools allow twodimensional arrays.

Arrays may not be composed of files.
