2.5.1.3.3. Methods in Class Axi4StreamTransfer
Method: get_payload_size(): uint32_t {virtual function}
Returns the size of the payload[ ] dynamic array. This allows you to the data transfer size.
Method: get_payload_data(get_data_buf[]: ref byte_t): void {virtual function}
Allows you to obtain the data values from the payload[ ] in byte_t format so that the data may be examined and processing in a native logic format compatible with other applications. The data is extracted from each Axi4StreamBytes object by using the get_data() method:
get_data_buf[i] = payload[i].get_data();
The argument to the method, get_data_buf[ ] is how the data is returned. The argument of type ref byte_t, and the get_payload_data() method first clears and resizes get_data_buf[ ] before placing all the data values into it from the payload.
Method: set_payload_from_data(set_data_buf[]: const ref byte_t): void {virtual function}
Load data into the payload[ ] dynamic array by using either the set_payload_from_data() or the set_payload_from_bytes() method of this class. The argument to the set_payload_from_data() method shows the unique nature of this method. The input is a dynamic array of byte_t, rather than Axi4StreamBytes objects. Thus, you can use this method directly with application data during packet and frame segmentation into transfers. This method also performs the task of creating Axi4StreamBytesData objects from the input data array, and places them into the payload[ ] of type Axi4StreamBytes.
This method's limitation is that all data input converts to Data bytes of class Axi4StreamBytesData. If the payload must include Position or Null bytes, then use the set_payload_from_bytes() method. This method uses Axi4StreamBytes as its input array.
Method: get_payload_bytes(get_bytes_buf[]: ref Axi4StreamBytes): void {virtual function}
Provides a way to obtain the bytes from the payload[ ] in their native Axi4StreamBytes format for use in applications like the Transmitter BFM. The transmitter takes the bytes out of each transfer using this method to load the data_queue[$]. Each byte stored in data_queue[$] drives TDATA and the resulting other byte-oriented transmitter-defined fields on the AXI4 streaming bus. Each byte in Axi4StreamBytes format provides the following byte-lane data:
- TDATA
- TKEEP
- TSTRB
- TUSER
Method: set_payload_from_bytes(set_bytes_buf[]: const ref Axi4StreamBytes): void {virtual function}
Load data into the payload[ ] dynamic array using one of two provided methods in this class. This method set_payload_from_bytes() allows you to use bytes of class Axi4StreamBytes to form the payload directly.
The argument to set_payload_from_bytes() is a dynamic array of Axi4StreamBytes objects. This allows you to assign not only Data bytes, but also Position and Null bytes. Additionally, you can use the error byte classes to perform error detection and recovery tests when using this method.
This method requires that the application data is segmented and translated into Axi4StreamBytes prior to using the method.
Method: clear_data_payload(): void {virtual function}
This method performs the task of emptying the dynamic data array payload[ ] if you require. This is not necessary prior to loading the payload[ ] as clearing the array is done as the first step in both set_payload_from_data() and set_payload_from_bytes().
Method: get_transfer_id(): uint64_t {virtual function}
This get-method for retrieving the transfer_id data member. The transfer_id is a unique 64-bit identifier and counter applied to each Axi4StreamTransfer object that is created.
Method: get_tdest(): bit [AXI4_STREAMING_TDEST_WIDTH-1:0] {virtual function}
This is the get-method for the destination routing field tdest for the transfer. This value is driven during the whole transfer on the TDEST field of the AXI4 streaming bus.
Method: set_tdest(tdest: bit [AXI4_STREAMING_TDEST_WIDTH-1:0]): void {virtual function}
This is the set-method for the destination routing field tdest for the transfer. The argument provided sets the transfer object’s tdest value and sets the value of the static master_tdest. Transfer objects subsequently created have the same tdest value unless explicitly changed again using this method.
Method: get_tid(): bit [AXI4_STREAMING_TID_WIDTH-1:0] {virtual function}
This is the get-method for the transfer identification field tid used for routing purposes. This value is driven during the whole transfer on the TID field of the AXI4 streaming bus.
Method: set_tid(tid: bit [AXI4_STREAMING_TID_WIDTH-1:0]): void {virtual function}
This is the set-method for the transfer identification field tid for the transfer. The argument provided sets the transfer object’s tid value and it also sets the value of the static master_tid. Transfer objects subsequently created have the same tid value unless explicitly changed again using this method.
Method: get_creation_time(): realtime {virtual function}
This get-method fetches the value of the data member creation_time, which is a $realtime simulation value assigned to the transfer when the object is created.
Method: get_send_time(): realtime {virtual function}
This get-method fetches the value of the data member send_time. This is a $realtime simulation value assigned to the transfer when the payload of the transfer has been sent on the AXI4 streaming bus.
Method: set_send_time(send_time_in: realtime ): void {virtual function}
This set-method sets the value of the send_time data member to the $realtime input value send_time_in.
Method: get_arrival_time(): realtime {virtual function}
This get-method fetches the value of the data member arrival_time. This is a $realtime simulation value assigned to the transfer when the transfer has been received by the BFM Receiver. The value is assigned after the receiver has assembled the transfer from the data beats on the AXI4 streaming bus.
Method: set_arrival_time(arrival_time_in: realtime): void {virtual function}
The set-method sets the value of the data member arrival_time to the $realtime input value arrival_time_in.
Method: get_delay(): uint32_t {virtual function}
This get-method retrieves the value for the data member delay, the number of bus beats that are idle before transmission of a transfer’s payload begins on the AXI4 streaming bus.
Method: set_delay(input uint32_t delay): void {virtual function}
The set-method sets the value of the data member delay, the number of bus beats that are idle before transmission of a transfer’s payload begins on the AXI4 streaming bus.
Additionally, this method sets the value of the static master_delay which is used by the Axi4StreamTransfer object’s constructor to assign the value of delay for all subsequent objects until explicitly changed using this method. Using this method also initializes the value of delay_remaining to delay.
Method: get_default_delay(): uint32_t {virtual function}
This get-method retrieves the value of the static data member master_delay.
Method: set_default_delay(input uint32_t delay): void {virtual function}
This set-method assigns the input value delay to the static master_delay without changing the value of the local delay. This effectively changes the value that subsequent transfer objects use, without changing the value of the delay in the current transfer.
Method: get_gap(): uint32_t {virtual function}
This get-method fetches the value for the data member gap, the number of bus beats that are idle after the transmission of a transfer’s payload on the AXI4 streaming bus.
Method: set_gap(input uint32_t gap): void {virtual function}
This set-method assigns the input value to the data member gap, the number of bus beats that are idle after the transmission of a transfer’s payload on the AXI4 streaming bus.
Additionally, this method sets the value of the static master_gap which is used by the Axi4StreamTransfer object’s constructor to assign the value of gap for all subsequent objects until explicitly changed using this method. Using this method also initializes the value of gap_remaining to gap.
Method: get_default_gap(): uint32_t {virtual function}
This get-method retrieves the value of the static data member master_gap.
Method: set_default_gap(input uint32_t gap): void {virtual function}
This set-method assigns the input value gap to the static master_gap, without changing the value of the local gap. This effectively changes the value that the subsequent transfer objects use, without changing the value of the gap in the current transfer.
Method: get_transfer_sent(): bit {virtual function}
This get-method retrieves the value of the status bit transfer_sent.
Method: get_transfer_received(): bit {virtual function}
This get-method retrieves the value of the status bit transfer_received.
Method: get_transfer_done(): bit {virtual function}
This get-method retrieves the value of the status flag transfer_done.
Method: sent(): bit {virtual function}
This method for retrieves the transfer_sent flag to check if a transfer has been successfully sent by the AXI4 streaming BFM Transmitter and equivalent to get_transfer_sent().
Method: not_sent(): bit {virtual function}
Retrieves the transfer_sent flag to determine if a transfer has been successfully sent by the transmitter by checking for the negative result.
Method: received(): bit {virtual function}
Retrieves the transfer_received flag to check if a transfer has been successfully received and assembled by the AXI4 streaming BFM Receiver and equivalent to get_transfer_received().
Method: not_received(): bit {virtual function}
Retrieves the transfer_received flag to check if a transfer has been successfully received by the receiver by checking for the negative result.
Method: done(): bit {virtual function}
Retrieves the transfer_done flag to check if a transfer has been successfully sent by the AXI4 streaming BFM Transmitter and equivalent to get_transfer_done().
Method: not_done(): bit {virtual function}
Retrieves the transfer_done flag to check if a transfer has been successfully sent by the transmitter by checking for the negative result.
Method: transfer_has_errors(): bit {virtual function}
Loops through all the bytes in the transfer payload[ ] and checks them individually for errors. If any of the payload bytes is an error byte, then this method returns TRUE and returns FALSE otherwise.
Method: is_equal(tr: Axi4StreamTransfer): bit {virtual function}
Checks to see if the Axi4StreamTransfer object is functionally equal to another by passing an Axi4StreamTransfer object’s is_equal() method an Axi4StreamTransfer object for comparison.
The method compares the payloads for equivalence and then checks the transfer-wide values of tid and tdest to ensure values match those in the transfer argument, tr. If everything matches, this method returns a one. Otherwise, a zero is returned for a failed equivalence check.
Method: is_payload_equal(tr: Axi4StreamTransfer): bit {virtual function}
This method is similar to is_equal() but only checks the equivalence of the two Axi4StreamTransfer object’s payloads. The is_payload_equal() method checks to see if the Axi4StreamTransfer object a user is working with has the same payload as another. This is done by passing an Axi4StreamTransfer object’s is_payload_equal() method an Axi4StreamTransfer object for comparison.
The method compares the payloads for equivalence. If all the bytes in the payload match, the method returns a one. Otherwise, a zero is returned for a failed equivalence check.
Method: is_not_equal(tr: Axi4StreamTransfer): bit {virtual function}
Determines if the Axi4StreamTransfer object is functionally not equivalent to another. This is done by passing an Axi4StreamTransfer object’s is_not_equal() method an Axi4StreamTransfer object to for comparison.
The method compares the payloads for equivalence and then checks the transfer-wide values of tid and tdest to determine if these values do not match those in the transfer argument, tr. If any of these items do not match, the method returns a one, signifying a “non-match”. Otherwise, a zero is returned for two objects that completely match.Method: copy(): Axi4StreamTransfer{virtual function}
Copies the transfer object. The return value of the copy() method is a new object, so you can use the method in an assignment operation where tr2 is assigned a copy of tr1:
tr2 = tr1.copy();
Where tr2 and tr1 are both of class Axi4StreamTransfer.
Method: print_payload(): void {virtual function}
The Axi4StreamTransfer class provides methods to help extract useful information from the transfer objects and print it. The print_payload() method simply prints out the contents of the transfer payload[ ] in data_value format where the data printed is the value provided by the method get_data().
The following is sample output of print_payload() for a transfer in a simulation:
# Transfer Payload....: 16 Bytes # 00000000 --- 00 11 22 33 00 11 22 33 33 11 12 13 14 55 00 17
Method: print_payload_long(): void {virtual function}
This long version of the print payload function prints out the data_value, then the tuser value for the byte object, and then the value of the axi4_stream_bytes_t type for the byte, thus identifying the byte object type.
The following is sample output of print_payload_long() for a transfer in a simulation:
# Transfer Payload....: 16 Bytes # 00000000 --- 00 bcd DATA # 11 bcd DATA # 22 bcd DATA # 33 bcd DATA # 00 bcd DATA # 11 bcd DATA # 22 bcd DATA # 33 123 DATA # 33 123 DATA # 11 123 DATA # 12 123 DATA # 13 123 DATA # 14 123 DATA # 55 123 POSITION # 00 123 NULL # 17 000 DATA
Method: print_transfer_short(): void {virtual function}
Prints the transfer’s key data member values and payload size only, and does not print out any of the payload[ ] information.
The following is sample output of print_transfer_short() for a transfer in a simulation:
# Transfer Info: (Short) # Transfer ID.......: 00000000_00000002 # TID...............: 14 # TDEST.............: 7 # Payload Size......: 16 # Creation Time.....: 0.000ns # Delay (Clocks)....: 0 # Data Beats........: 2 # Gap (Clocks)......: 5
Method: print_transfer(): void {virtual function}
Combines the printing of transfer data member values and payload in the most compact way. The transfer payload[ ] is printed out using the data_value format for the byte objects.
The following is sample output of print_transfer() for a transfer in a simulation:
# Transfer Info: # Transfer ID.........: 00000000_00000002 # TID.................: 14 # TDEST...............: 7 # Creation Time.......: 0.000ns # Sent at Time........: 0.000ns # Received at Time....: 0.000ns # Delay (Clocks)......: 0 # Delay Remaining.....: 0 # Data Beats..........: 2 # Data Beats Remaining: 2 # Gap (Clocks)........: 5 # Gap Remaining.......: 5 # Transfer Sent.......: 0 # Transfer Received...: 0 # Transfer Done.......: 0 # Transfer Payload....: 16 Bytes # 00000000 --- 00 11 22 33 00 11 22 33 33 11 12 13 14 55 00 17
Method: print_transfer_long(): void {virtual function}
Prints out all of the data member information that is printed out in the method print_transfer(), but extends the amount of transfer information printed out in the console. The transfer payload[ ] is printed out in compact “data_value” format as in prior methods, but more information is provided regarding the transfer’s data members. The most notable inclusions in the output are the static data member values that are often used in the object constructors to assign data member values when the next object is created.
The following is sample output of print_transfer_long() for a transfer in a simulation:
# Transfer Info: (Long) # Master ID...........: 00000000_00000002 # Transfer ID.........: 00000000_00000002 # Master TID..........: 14 # TID.................: 14 # Master Destination..: 7 # TDEST...............: 7 # Creation Time.......: 0.000ns # Sent at Time........: 0.000ns # Received at Time....: 0.000ns # Master Delay........: 0 # Delay (Clocks)......: 0 # Delay Remaining.....: 0 # Data Beats..........: 2 # Data Beats Remaining: 2 # Master Gap..........: 5 # Gap (Clocks)........: 5 # Gap Remaining.......: 5 # Transfer Sent.......: 0 # Transfer Received...: 0 # Transfer Done.......: 0 # Transfer Payload....: 16 Bytes # 00000000 --- 00 11 22 33 00 11 22 33 33 11 12 13 14 55 00 17
Method: print_transfer_long_long(): void {virtual function}
Prints out all of the data member information that is printed out in the method print_transfer_long(), but prints out the transfer payload[ ] in a detailed form via print_payload_long().
The following is sample output of print_transfer_long_long() for a transfer in a simulation:
# Transfer Info: (Long++) # Master ID...........: 00000000_00000002 # Transfer ID.........: 00000000_00000002 # Master TID..........: 14 # TID.................: 14 # Master Destination..: 7 # TDEST...............: 7 # Creation Time.......: 0.000ns # Sent at Time........: 0.000ns # Received at Time....: 0.000ns # Master Delay........: 0 # Delay (Clocks)......: 0 # Delay Remaining.....: 0 # Data Beats..........: 2 # Data Beats Remaining: 2 # Master Gap..........: 5 # Gap (Clocks)........: 5 # Gap Remaining.......: 5 # Transfer Sent.......: 0 # Transfer Received...: 0 # Transfer Done.......: 0 # Transfer Payload....: 16 Bytes # 00000000 --- 00 bcd DATA # 11 bcd DATA # 22 bcd DATA # 33 bcd DATA # 00 bcd DATA # 11 bcd DATA # 22 bcd DATA # 33 123 DATA # 33 123 DATA # 11 123 DATA # 12 123 DATA # 13 123 DATA # 14 123 DATA # 55 123 POSITION # 00 123 NULL # 17 000 DATA \