4. Current Capabilities

At a bare minimum an interface is a composite with a method to group the subprograms together. To some degree, this can be done using a record for the composite and a package to group the record with the subprograms.

4.1.1. Single Record + Package

Using current language features, an interface could be a record and subprograms defined in a package. Since all of the record elements are not in the same direction, the record object must be an inout of an entity. As a result, all record elements must be of a resolved subtype (based on std_logic). This is shown in the following example:

      type UartTbRecType is record
        CmdRdy            : std_logic ;
        CmdAck            : std_logic ;
        Data              : std_logic_vector (7 downto 0);
        StatusMode        : unsigned ( 3 downto 0) ;
        TbErrCnt          : unsigned (15 downto 0) ;
        UartBaudPeriod    : unsigned (31 downto 0) ;
        NumDataBits       : unsigned ( 2 downto 0) ;
        ParityMode        : unsigned ( 2 downto 0) ;
        NumStopBits       : std_logic ;
      end record ;

To resolve drivers, all of the record elements are initialized to 'Z'. Typically this is done with a constant, such as the one that follows.

      constant InitTbUartTbRec : UartTbRecType := (
         CmdRdy          => 'Z',
         CmdAck          => 'Z',
         Data            => (others => 'Z'),
         StatusMode      => (others => 'Z'),
         TbErrCnt        => (others => 'Z'),
         UartBaudPeriod  => (others => 'Z'),
         NumDataBits     => (others => 'Z'),
         ParityMode      => (others => 'Z'),
         NumStopBits     => (others => 'Z')
      ) ;

In this approach, supporting subprograms are needed for handshaking through the record interface. These are somewhat generic in that any interface that uses the same method for handshaking can use them. In addition, supporting subprograms are also needed for copying values to the record at the start of a transaction and out of the record at the end of a transaction. These would be specific to a particular interface as they have characteristics that are based on the interface itself (address, data, and operation type).

4.1.2. Two Records

There are also transaction-based testbench approaches that use two records: one for "in" and the other for "out". As a result, there are no drivers to resolve. Since this is not a single element, it is not a true interface, but it is "Interface like". When using multiple records, both records must be specified on the interface and with every subprogram call (transaction initiation).

Topic revision: r2 - 2016-01-21 - 11:46:34 - BrentHahoe
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback