Altera® AXI4 Bus Functional Model User Guides

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

2.4.2. Using the Receiver BFM Flow

The following steps describe implementation of the Receiver BFM from the Quartus® Prime Pro Edition software IP Catalog or from Platform Designer. You can use either the IP Catalog flow to define a single Receiver BFM and testbench, or use the Platform Designer flow to integrate the BFM and testbench into a Platform Designer system.

IP Catalog Receiver BFM Generation Flow

  1. From the Quartus® Prime Pro Edition software IP Catalog, search for the Altera AXI4 Streaming Receiver BFM.
  2. In the IP parameter editor, specify appropriate parameters and generate the HDL for your receiver configuration.
  3. Create a testbench and connect the Receiver BFM to the DUT.
  4. To access the Receiver BFM, use the following hierarchy:
    <bfm inst>.axi4_stream_bfm_ receiver_0.axi4_stream_rx_bfm

Platform Designer Receiver BFM Generation Flow

  1. In the Quartus® Prime Pro Edition software, click Tools > Platform Designer.
  2. In Platform Designer's IP Catalog, search for the Altera AXI4 Streaming Receiver BFM.
  3. In the IP parameter editor, specify appropriate parameters for your receiver configuration.
  4. To generate the Platform Designer system and testbench, click Generate HDL.
  5. To access the Transmitter BFM in the testbench, use the following hierarchy:
    <PD system inst>.<PD bfm inst>.<PD bfm inst>.axi4_stream_rx_bfm

Creating a Testbench using the AXI4 Streaming BFM

  1. Import the required Altera AXI4 Streaming BFM SystemVerilog packages:
    import altera_lnsim_ver.axi4_stream_bfm_types_pkg::*;
    import altera_lnsim_ver.axi4_stream_bytes_class_pkg::*;
    import altera_lnsim_ver.axi4_stream_transfer_class_pkg::*;
    import altera_lnsim_ver.axi4_stream_packet_class_pkg::*;
  2. Create and receive transfers from the Receiver BFM:
    // Receive Transfer
    Axi4StreamTransfer#(.AXI4_STREAMING_DATA_BUS_WIDTH(DATA_BUS_WIDTH),
    .AXI4_STREAMING_TID_WIDTH(TID_WIDTH),
    .AXI4_STREAMING_TDEST_WIDTH(TDEST_WIDTH),
    .AXI4_STREAMING_TUSER_WIDTH(TUSER_WIDTH)) rx_tr;
  3. Use either of the following methods to check the state of received transfers:
    • Option 1: get_number_of_transfers_in_queue()—returns the number of transfers the receiver assembles and places them into an internal queue waiting for read out.
    • Option 2: transfer_available()—returns a one if there are transfers available to be read out of the receiver. Otherwise, returns zero.
In the following code sample, the get_number_of_transfers_in_queue() method determines if expected transfers have arrived. Next, transfer_available() prints out all received transfers.
while (`bfm_rx.receive_bfm.get_number_of_transfers_in_queue() != NUM_TX_TFRS))
	begin
		@(posedge axist_bfm_system_inst_clk_bfm_clk_clk);
	End

while (`bfm_rx.receive_bfm.transfer_available())
	begin
		rx_tr = `bfm_rx.receive_bfm.get_transfer_from_receive();
		rx_tr.print_transfer_long();
	end