[Next] [Up] [Previous] [Contents]
Next: Binary numbers Up: Data types and type Previous: Multidimensional arrays

Generic arrays

Arrays whose elements are of different types can also be declared. This is done by declaraing a generic array, as follows:

        <signal> : array <x>..<y>;
where the type of the elements is unspecified. The types of the elements can then be declared separately. For example:

        state : array 0..2;
        state[0] : {ready, willing};
        state[1] : {ready, willing, able};
        state[2] : {ready, willing, able, exhausted};

This differs from simply declaring the elements of the array in that the generic array declaration tells the compiler the upper and lower bounds of the array and whether its storage order is ``big endian'' or ``little endian''. This allows array references with variable subscripts and binary arithmetic expressions to be compiled.



Ken McMillan
Sat Jun 6 21:41:59 PDT 1998