Example 6-5, Reads the first two data beats fr – Altera Mentor Verification IP Altera Edition AMBA AXI3/4TM User Manual

Page 160

Advertising
background image

Mentor VIP AE AXI3/4 User Guide, V10.2b

142

SystemVerilog Tutorials
Verifying a Slave DUT

September 2013

The read transaction, trans, is then executed onto the protocol signals by calling the

execute_transaction()

function. The read data is obtained by calling the get_data_words(n)

function to get the data_words[n] transaction field value. The result of the read data is
compared with the expected data—and a message displays the transcript.

Example 6-5. Read Burst Transaction Creation and Execution

// Read data burst of length 1 from address 16.
trans = bfm.create_read_transaction(16, 1);

bfm.execute_transaction(trans);
if (trans.get_data_words(0) == 'hACE0ACE1)

$display ( "@ %t, master_test_program: Read correct data (hACE0ACE1) at

address (16)", $time);

else

$display ( "@ %t, master_test_program: Error: Expected data (hACE0ACE1)

at address (16), but got %h", $time, trans.get_data_words(0));

if (trans.get_data_words(1) == 'hACE2ACE3)

$display ( "@ %t, master_test_program: Read correct data (hACE2ACE3) at

address (20)", $time);

else

$display ( "@ %t, master_test_program: Error: Expected data (hACE2ACE3)

at address (20), but got %h", $time, trans.get_data_words(1));

In the complete Master Test Program, a subsequent read transaction is created and executed in a
similar manner to that shown in

Example 6-3

. See the

SystemVerilog AXI3 Master BFM Test

Program

listing for details.

Outstanding Write Burst Transaction Creation and Execution

The code excerpt in

Example 6-6

uses the AXI3 Master BFM

create_write_transaction()

function to create a write burst transaction trans1 by providing the start address and burst length
arguments. The actual length of the burst on the protocol wires is 3+1=4.

Note

The burst length argument passed to the

create_write_transaction()

function is 1 less than

the number of transfers (beats) in the burst. This aligns the burst length argument value
with the value placed on the AWLEN protocol signals.

The set_data_words() function is then called four times to set the data_words field of the write
transaction for each beat of the data burst. For this write transaction all data byte lanes contain
valid data on each beat of the data burst, therefore a for loop uses the set_write_strobes()
function to set the write_strobes fields of the transaction to 4’b1111.

Advertising