Master bfm test program, Initial block, Example 6-1. definition and initialization – Altera Mentor Verification IP Altera Edition AMBA AXI4-Stream User Manual

Page 68

Advertising
background image

Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3

68

SystemVerilog Tutorials
Verifying a Slave DUT

April 2014

Master BFM Test Program

A master BFM test program is capable of creating a wide range of stimulus scenarios to verify a
slave DUT. For a complete code listing of this master test program, refer to “

SystemVerilog

Master Test Program

” on page 209.

The master test program contains an

Initial Block

that creates and executes master transactions

over the protocol signals. The following sections describe the main procedures and variables:

Initial Block

Within an initial block, the master test program defines a transaction variable trans of type
axi4stream_transaction to hold a record of a transaction during its life, as shown in

Example 6-1

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

ACLK edge, satisfies the protocol requirement detailed in Section 2.7.2 of the AMBA
AXI4-Stream Protocol Specification.

Example 6-1. Definition and Initialization

initial
begin
axi4stream_transaction trans;
static int byte_count = AXI4_DATA_WIDTH/8;
int transfer_count;
bit last;
/*******************
** Initialisation **
*******************/
bfm.wait_on(AXI4STREAM_RESET_POSEDGE);
bfm.wait_on(AXI4STREAM_CLOCK_POSEDGE);

An outer for loop increments the transfer_count on each iteration of the loop, as shown in

Example 6-2

. Calling the

create_master_transaction()

function creates a master transaction,

passing in the optional transfer_count as an argument to the function. The created master
transaction is then assigned to the transaction variable trans. The TID and TDEST signal values
are then assigned for the data stream. Each iteration of the outer loop creates a master
transaction with the transfer_count per transaction passed as an argument.

An inner for loop calls the trans.set_data() task to load a byte into the data transaction field, and
calls the trans.set_byte_type() task to load the byte_type transaction field for the byte.

Calling the

execute_transaction()

task executes the trans transaction onto the protocol signals.

Advertising