Previous

Record Types

A record is a set of named fields of various types, unlike an array, which is composed of identical anonymous entries. A record's field can be any previously defined type, including another record type.


NOTE

Constants in VHDL of type record are not supported for synthesis (The initialization of records is not supported).


The following example shows a record type declaration (BYTE_AND_IX), three signals of that type, and some assignments.

   constant LEN:  INTEGER := 8;
   
   subtype BYTE_VEC is BIT_VECTOR(LEN-1 downto 0);
   
   type BYTE_AND_IX is 
        record
             BYTE: BYTE_VEC;
             IX:   INTEGER range 0 to LEN;
        end record;
    
   signal X, Y, Z: BYTE_AND_IX;
   
   signal DATA: BYTE_VEC;
   signal NUM:  INTEGER;
   . . .
   
   X.BYTE <= "11110000";
   X.IX   <= 2;
   
   DATA <= Y.BYTE;
   NUM  <= Y.IX;
   
   Z <= X;

As shown in the above example, you can read values from or assign values to records in two ways.

Next