VHDL Data Types:Composite Types (cont.)-- Notes Page -- |
The second VHDL composite type is the record. An object of
type record may contain elements of different types. Again, a
record element may be of any data type, including another
record.
A TYPE declaration is used to define a record. Note that the
types of a record's elements must be defined before the
record is defined. Also notice that there is no semi-colon
after the word RECORD. The RECORD and END RECORD keywords bracket the
field names. After the RECORD keyword, the record's field names
are assigned and their data types are specified.
In the above example, a record type, switch_info, is declared.
This example makes use of the binary enumerated type declared
previously. Note that values are assigned to record elements by use
of the field names.