Altera® AXI4 Bus Functional Model User Guides

ID 838773
Date 5/19/2025
Public
Document Table of Contents

2.5.1.3.2. Data Members in Class Axi4StreamTransfer

The Axi4StreamTransfer class includes the following data members (variables):

Data Member: master_id {type: protected static uint64_t}

Data Member: transfer_id {type: protected uint64_t}

You can use the master_id and transfer_id data members place a unique, identifying marker on each transfer object created. The master_id is a static unsigned 64-bit integer that is used as a free-running counter for the entire class. master_id counts the number of transfer objects created. The Axi4StreamTransfer object’s constructor increments master_id each time a transfer object is created. The variable transfer_id is a copy of the master_id variable value at creation time. The copy of master_id into transfer_id occurs in the Axi4StreamTransfer object constructor, just after the master_id is incremented. You can use these two values in a variety of ways. For example, you can use these two values:

  • As a unique designator for the object.
  • As a count of how many transfer objects have been created.
  • As a method to determine the location of an object within the overall transfer traffic.

Data Member: master_tid {type: protected static bit [AXI4_STREAMING_TID_WIDTH-1:0]}

Data Member: tid {type: protected bit [AXI4_STREAMING_TID_WIDTH-1:0]}

You can use the master_tid and tid members in a similar manner as the master_id and transfer_id members, except that the static master_tid does not increment. Rather, master_tid remains as a class-wide reference variable that, once modified, keeps a persistent value for all following transfers until explicitly changed. This means that the master_tid is a set-and-forget data member for the class. The tid variable is a local, non-static copy of the master_tid value at object creation time. The tid data member directly represents the TID field on the AXI4 streaming bus. The tid data member is driven on every bus beat during a transfer by the transmitter.

Data Member: master_tdest {type: protected static bit [AXI4_STREAMING_TDEST_WIDTH-1:0]}

Data Member: tdest {type: protected bit [AXI4_STREAMING_TDEST_WIDTH-1:0]}

You can use the master_tdest and tdest members in the same manner as the master_tid and tid members, except that the static master_tdest and tdest represent the TDEST field on the AXI4 streaming bus.

The static master_tdest is kept as a class-wide reference variable that, once modified, keeps a persistent value for all following transfers until explicitly changed. This means that master_tdest is a “set-and-forget” data member for the class. The variable tdest is a local non-static copy of master_tdest’s value when the object was created. The tdest data member directly represents the field TDEST on the AXI4 streaming bus. tdest is driven on every bus beat during a transfer by the transmitter.

Data Member: payload [] {type: Axi4StreamBytes}

A dynamic array of Axi4StreamBytes that contains the data driven on the TDATA bus lanes during transfers. Axi4StreamBytes is a polymorphic class containing the compatible hierarchy of:

  • Data Bytes—Axi4StreamBytesData
  • Position Bytes—Axi4StreamBytesPosition
  • Null Bytes—Axi4StreamBytesNull
  • Data Error Bytes—Axi4StreamBytesDataError
  • Position Error Bytes—Axi4StreamBytesPositionError
  • Null Error Bytes—Axi4StreamBytesNullError

You can add any of the above byte classes to the payload. The Axi4StreamTransfer class supplies the methods set_payload_from_data() and set_payload_from_bytes() to load a transfer’s payload[ ] dynamic array with data from the application. Refer to the Methods section later in this document.

Data Member: creation_time {type: protected realtime}

Aet to the simulation time when the Axi4StreamTransfer object is created. This value is set to the value directive $realtime in the object’s constructor.

Data Member: send_time {type: protected realtime}

Set to the value directive $realtime when the transfer is sent by the BFM transmitter. You can compare the send_time data member to the arrival_time value of the received transfer to measure the transit time of the transfer for performance and latency.

Data Member: arrival_time {type: protected realtime}

Set to the value directive $realtime when the transfer is received by the BFM receiver. You can compare the arrival_time data member to the send_time value of the originally transmitted transfer to measure the transit time of the transfer for performance and latency.

Data Member: master_delay {type: protected static uint32_t}

Kept as a class-wide reference variable that, once modified, keeps a persistent value for all following transfers until it is explicitly changed. Modeling delays is an important part of making the Transmitter BFM better emulate components of a system. Like other static data members, this means that master_delay is a set-and-forget data member for the class. This allows modeling components that have a very set and specific delay or latency.

Data Member: master_gap {type: protected static uint32_t}

Kept as a class-wide reference variable that, once modified, keeps a persistent value for all following transfers until it is explicitly changed. Modeling delays may not just include the latency from the transfer issue to the beginning of the transactions on the AXI4 streaming bus, but it might also include a certain delay after a transfer before another one can begin. Like other static data members, this means that master_gap is a set-and-forget data member for the class. This allows modeling components that have a very set and specific recovery time or recharge latency before they can generate another transfer.

Data Member: data_beats {type: protected uint32_t}

Allows you to determine how many data beats are required to transmit the payload in a transfer. The initial number of beats is calculated by dividing the payload size by the TDATA bus width in bytes. Where the number of data beats required to send the transfer is not an even multiple of the TDATA bus width, the partially utilized data transfer required at the end counts as a full data beat (this is the remainder calculation) and one is added to the number of data_beats required.

Data Member: delay {type: protected uint32_t}

The value set in the variable delay is used by the Transmitter BFM to idle the bus for a number of bus beats prior to sending the payload. The variable delay is assigned the current value of the static variable master_delay when the Axi4StreamTransfer object is created via the class’s constructor. Unless there is a need to change the value of delay, the value continues to be assigned the value in the static master_delay. The delay has both get and set methods to monitor and change the value.

Data Member: gap {type: protected uint32_t}

This value is used by the Transmitter BFM to idle the bus for a number of bus beats after sending the payload. The variable gap is assigned the current value of the static variable master_gap when the Axi4StreamTransfer object is created via the class’s constructor. Unless there is a need to change the value of gap, the value continues to be assigned the value in the static master_gap. The gap has both get and set methods to monitor and change the value.

Changing the value using the set method set_gap() also updates the static variable master_gap so subsequent Axi4StreamTransfer objects created have the updated value.

Use the method get_gap() if there might be multiple blocks updating the value for gap in a simulation. You should validate the value of gap to determine if it needs to be updated for a particular transfer.

Data Member: transfer_sent {type: protected bit}

The status flag transfer_sent alerts when the payload of a transfer is sent by the transmitter. When the variable data_beats_remaining is zero during or after the execution of a data beat when the method data_beat_sent() is called, this bit is set.

Data Member: transfer_received {type: protected bit}

The status flag transfer_received alerts when a transfer has been assembled from data beats in the Receiver BFM. This action completes as part of the execution of the method set_transfer_received().

Data Member: transfer_done {type: protected bit}

The status flag transfer_done alerts when the Transmitter BFM completes sending the transfer. This action completes after sending the gap of the transfer, if it is greater than zero, or after the transmission of the payload data if the gap is equal to zero. The flag value can be read with the get method get_transfer_done().