2.5.1.4.3. Methods in Class Axi4StreamPacket
The Axi4StreamPacket class includes the following data members:
Method: get_pending_transfer_number_in_packet(): uint32_t {function}
This method provides the size of the transfers[$] queue. The return value of the function is simply transfers.size() – queue size, which is the number of transfer objects that it contains.
Method: get_completed_transfer_number_in_packet(): uint32_t {function}
This method provides the number of completed transfers held in the transfers_done[$] queue. For encapsulation reasons, the transfers_done[$] queue data member is protected. This method therefore is provided to check the size of the transfers_done[$] queue safely.
The return value of the function is simply transfers_done.size() – queue size, which is the number of transfer objects it contains.
Method: get_pending_transfer_number_of_bytes_in_packet(): uint32_t {function}
This method returns the number of bytes contained in all the pending transfers in the queue transfers[$]. You can calculate the amount of AXI4 streaming bus time required to send all the packet’s pending transfers from this number. You can thus calculate bus congestion for metric purposes.
Method: packet_is_empty(): bit {function}
This is a simple status-check method that returns a value of one if the number of pending transactions is zero. Otherwise, the method returns a zero.
packet_is_not_empty(): bit {function}
This method is a simple status-check method that returns a value of one if the number of pending transactions is one or greater. Otherwise, the method returns a zero.
Method: get_completed_transfer_number_of_bytes_in_packet(): uint32_t {function}
Returns the number of bytes contained in all the completed transfers in the queue transfers_done[$]. You can calculate the amount of AXI4 streaming bus traffic sent by a packet to monitor the amount of bus congestion and throughput in the overall application.
Method: get_packet_id(): uint64_t {function}
Returns the value of the packet’s packet_id value. The packet_id is a 64-bit, unique value assigned to the packet during creation that you can use as a unique designator for the packet.
Method: get_creation_time(): realtime {function}
Returns the value of the packet’s creation_time. The creation_time is a $realtime value captured by the packet by the class’s constructor.
Method: add_transfer_to_packet(tr: Axi4StreamTransfer): void {function}
Adds transfers to the input transfer queue transfers[$]. The argument is a handle of type Axi4StreamTransfer. This method places the transfer at the back of the transfers[$] queue with:
this.transfers.push_back(tr);
The transfers placed into the input queue remain until retrieved, in order, for use as data driving the AXI4 streaming bus.
Method: create_transfer_from_data_and_add_to_packet(data_buf[]: const ref byte_t): void {function}
This method performs the following steps to skip a possible unnecessary step of creating a transfer:
- Create a new transfer.
- Add a payload to this new transfer provided by the dynamic byte_t array data_buf[ ].
- Add this new transfer to the input queue transfers[$].
This method only creates transfers with data payload. That is, bytes of class Axi4StreamBytesData that do not contain position, null, or error bytes. If more complex payloads are required, use the method create_transfer_from_bytes_and_add_to_packet().
Method: create_transfer_from_bytes_and_add_to_packet(bytes_buf[]: const ref Axi4StreamBytes): void {function}
This method performs the following steps to skip a possible unnecessary step of creating a transfer:
- Create a new transfer.
- Add a payload to this new transfer provided by the dynamic Axi4StreamBytes array bytes_buf[ ].
- Add this new transfer to the input queue transfers[$].
This method requires you to create all the byte objects needed for the payload in advance of using this method. You must also place those objects into the dynamic array bytes_buf[ ]. This method allows the use of data, position, null and error bytes in the payload, offering the most flexibility in assembling diverse transfer payloads. If payloads are being generated with only data bytes, then you can use the create_transfer_from_data_and_add_to_packet() method instead to simplify the process by bypassing the byte object creation.
Method: get_next_transfer(): Axi4StreamTransfer {function}
Retrieves a transfer from the pending transfers queue transfers[$].. The method returns a handle for the next transfer object in the queue, and adds the transfer to the completed transfers queue transfers_done[$].
Transfers in transfers_done[$] stay in the queue until the Axi4StreamPacket object is destroyed and may be examined or printed out using other methods in this class.
Method: get_transfers_done(tr_buf[]: ref Axi4StreamTransfer): void {function}
Retrieves transfers contained in the transfers_done[$] queue. The tr_buf[ ] argument is cleared, and then all the transfers in transfers_done[$] are loaded into it. You can then examine all completed transfers.
Method: print_transfers_queue(): void {function}
Performs a print_transfer() print of each transfer in the transfers[$] queue showing the payload in data_value format.
Method: print_transfers_queue_long(): void {function}
Performs a print_transfer_long_long() print of each transfer in the transfers[$] queue, showing the payload in data_value format.
Method: print_transfers_done_queue(): void {function}
Performs a transfer queue printout in the same manner and format as print_transfers_queue(), except that the contents of the transfers_done[$] queue are printed instead of transfers[$].
Method: print_transfers_done_queue_long(): void {function}
Performs a transfer queue printout in the same long-form manner and format as print_transfers_queue_long(), except that the contents of the transfers_done[$] queue are printed instead of transfers[$].
Method: print_packet_short(): void {function}
Prints the following packet information:
- The packet’s 64-bit unique identifier, packet_id.
- The creation time of the packet.
- The number of pending transfers the packet has in its transfers[$] queue.
Method: print_packet(): void {function}
This method prints the following packet information:
- The packet’s 64-bit unique identifier, packet_id.
- The creation time of the packet.
- The number of pending transfers the packet has in its transfers[$] queue.
- The total number of bytes the pending transfer payloads have.
- The total number of completed transfers the packet has in its transfers_done[$] queue.
- The total number of bytes the completed transfer payloads have.
Method: print_packet_long(): void {function}
Prints the same packet information as print_packet(), along with the transfer data and data_value of the payload for each pending transfer in the transfers[$] queue.
Method: print_packet_long_long(): void {function}
Prints the same packet information as print_packet(), along with a long print of each transfer in the transfers[$] queue and the transfers_done[$] queue, showing the detailed byte data for each individual object in each transfer’s payload[i].