Configuration and initialization, Write transaction creation and execution, Example 6-10. configuration and initialization – Altera Mentor Verification IP Altera Edition AMBA AXI3/4TM User Manual

Page 165

Advertising
background image

SystemVerilog Tutorials

Verifying a Slave DUT

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

147

September 2013

Configuration and Initialization

In an initial block the master test program defines nine transaction variables trans, and trans1 to
trans8, of type axi4_transaction which hold the record of each transaction during its lifetime, as
shown in

Example 6-10

. The initial wait for the ARESETn signal to be deactivated, followed by

a positive ACLK edge, satisfies the protocol requirement detailed in section A3.1.2 of the
Protocol Specification.

Example 6-10. Configuration and Initialization

initial
begin

axi4_transaction trans, trans1, trans2, trans3, trans4;
axi4_transaction trans5, trans6, trans7, trans8;

/*******************
** Initialization **
*******************/
bfm.wait_on(AXI4_RESET_0_TO_1);
bfm.wait_on(AXI4_CLOCK_POSEDGE);

Write Transaction Creation and Execution

To generate AXI4 protocol traffic the Master Test Program must create the transaction trans
before executing it. The code excerpt in

Example 6-11

calls the

create_write_transaction()

function, providing only the start address argument of the transaction. The burst-length
argument automatically defaults to a value of zero—indicating a burst length of a single beat.

This example has an AXI4 data bus width of 32-bits; therefore a single beat of data conveys 4-
bytes across the data bus. The call to 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 AXI4 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 (see

create_write_transaction()

for details).

Advertising