Read transaction creation and execution – Altera Mentor Verification IP Altera Edition AMBA AXI3/4TM User Manual

Page 157

Advertising
background image

SystemVerilog Tutorials

Verifying a Slave DUT

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

139

September 2013

This example has an AXI3 data bus width of 32-bits; therefore a single beat of data conveys 4-
bytes across the data bus. The set_data_words() function sets the data_words[0] transaction
field with the value of 1 on byte lane 1, resulting in a value of 32'h0000_0100. However, the
AXI3 protocol permits narrow transfers with the use of the write strobes signal WSTRB to
indicate which byte lane contains valid write data, and therefore indicates to the slave DUT
which data byte lane will be written into memory. Similarly, you can call the
set_write_strobes() function to set the write_strobes[0] transaction field with the value of
4'b0010, indicating that only valid data is being transferred on byte lane 1. The write
transaction, trans, then executes on the protocol signals by calling the

execute_transaction()

function.

All other write transaction fields default to legal protocol values (refer to

“Master BFM

Configuration”

on page 34 for more details).

Example 6-2. Write Transaction Creation and Execution

/************************
** 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, 0);
trans.set_write_strobes(4'b0010, 0);
$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 complete Master Test Program three subsequent write transactions are created and
executed in a similar manner to that shown in

Example 6-2

. See

SystemVerilog AXI3 Master

BFM Test Program

for details.

Read Transaction Creation and Execution

The code excerpt in

Example 6-3

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

create_read_transaction()

function, providing only the start address argument. The optional

burst-length argument automatically defaults to a value of zero—indicating a burst length of a
single beat.

The set_id() function is then called to set the transaction id field to 1, and the set_size()
procedure sets the transaction size field to be a single byte (AXI_BYTES_1). The read
transaction, trans, is then executed onto the protocol signals with a call to the

execute_transaction()

function.

Advertising