Create and execute read transactions, E code excerpt in, Example 6-5 – Altera Mentor Verification IP Altera Edition AMBA AXI4-Lite User Manual
Page 120
Mentor Verification IP AE AXI4-Lite User Guide, V10.3
120
SystemVerilog Tutorials
Verifying a Slave DUT
April 2014
Example 6-5. Create and Execute Write Transactions
/************************
** Traffic generation: **
************************/
// 4 x Writes
// Write data value 1 on byte lanes 1 to address 1.
trans = bfm.create_write_transaction(1);
trans.set_data_words(32'h0000_0100);
trans.set_write_strobes(4'b0010);
$display ( "@ %t, master_test_program: Writing data (1) to address (1)",
$time);
// By default it will run in Blocking mode
bfm.execute_transaction(trans);
In the master test program, three subsequent write transactions are created and executed in a
similar manner to
SystemVerilog AXI4-Lite Master BFM Test
Create and Execute Read Transactions
The code excerpt in
reads the data that has been previously written into the slave
memory. The master test program first creates a read transaction trans by calling the
function, providing only the start address argument.
The read data is obtained by calling the get_data_words function to get the data_words
transaction field value. The result of the read data is compared with the expected data, and a
message displays the transcript.
Example 6-6. Create and Execute Read Transactions
// Read data from address 1.
trans = bfm.create_read_transaction(1);
bfm.execute_transaction(trans);
if (trans.get_data_words == 32'h0000_0100)
$display ( "@ %t, master_test_program: Read correct data (1) at
address (1)", $time);
else
$display ( "@ %t master_test_program: Error: Expected data (1) at
address 1, but got %d", $time, trans.get_data_words);
In the master test program, three subsequent read transactions are created and executed in a
similar manner to