Configuration and initialization, Create and execute write transactions, Example 6-4. configuration and initialization – Altera Mentor Verification IP Altera Edition AMBA AXI4-Lite User Manual
Page 119

SystemVerilog Tutorials
Verifying a Slave DUT
Mentor Verification IP AE AXI4-Lite User Guide, V10.3
119
April 2014
Configuration and Initialization
In an initial block, the master test program defines the transaction variable trans of type
axi4_transaction, which hold the record of each transaction during its lifetime, as shown in
. 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 AXI Protocol
Specification.
Example 6-4. Configuration and Initialization
initial
begin
axi4_transaction trans;
bit [AXI4_WDATA_WIDTH-1:0] data_word;
/*******************
** Initialization **
*******************/
bfm.wait_on(AXI4_RESET_0_TO_1);
bfm.wait_on(AXI4_CLOCK_POSEDGE);
Create and Execute Write Transactions
To generate AXI4 protocol traffic, the master test program must create the transaction trans
before executing it. The code excerpt in
calls the
function, providing only the start address argument of the transaction.
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
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 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
function.
All other write transaction fields default to legal protocol values (see
for details).