Master bfm test program, Traffic generation, Example 11-1. definition and initialization – Altera Mentor Verification IP Altera Edition AMBA AXI4-Stream User Manual

Page 182

Advertising
background image

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

182

VHDL 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 “

VHDL Master

BFM Code Example

” on page 213.

The master test program contains a

Traffic Generation

process that creates and executes master

transactions over the protocol signals. The following section describes the main process and
variables.

Traffic Generation

The traffic generation process creates and executes master transactions, as shown in

Example 11-1

. The process defines a number of local variables to hold the transaction record,

the byte count within a transfer, the transfer count, and inner and outer loop counters. Execution
then waits for the ARESETn signal to be deasserted, followed by a positive ACLK edge. This
satisfies the protocol requirements detailed in Section 2.7.2 of the AMBA 4 AXI4-Stream
Protocol Specification.

Example 11-1. Definition and Initialization

process

variable trans: integer;
variable byte_count : integer := AXI4_DATA_WIDTH/8;
variable transfer_count : integer;
variable k : integer;
variable m : integer;

begin

wait_on(AXI4STREAM_RESET_POSEDGE, index, axi4stream_tr_if_0(index));
wait_on(AXI4STREAM_CLOCK_POSEDGE, index, axi4stream_tr_if_0(index));

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

Example 11-2

. Calling the

create_master_transaction()

procedure creates a master transaction,

passing in the optional transfer_count as an argument to the procedure. 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

set_data()

procedure to load a byte into the data transaction field,

and calls the

set_byte_type()

procedure to load the byte_type transaction field for the byte.

Calling the

execute_transaction()

procedure executes the trans transaction onto the protocol

signals.

Advertising