beautypg.com

Advanced slave test program api definition, Initial block(), Example 6-6. initialization – Altera Mentor Verification IP Altera Edition AMBA AXI4-Stream User Manual

Page 73

background image

SystemVerilog Tutorials

Verifying a Master DUT

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

73

April 2014

Advanced Slave Test Program API Definition

Note

You are not required to edit the following Advanced Slave Test Program API unless
further analysis of the protocol transfer is required.

The remaining section of this tutorial presents a walk-through of the Advanced Slave Test
Program API within the slave BFM test program. It consists of a single

initial block()

that

receives protocol transfers, inserting a delay in the assertion of the TREADY signal, as detailed
in the

Basic Slave Test Program API Definition

.

initial block()

Within an initial block, the slave test program defines a transaction variable trans of type
axi4stream_transaction to hold the

Transaction Record

of the transaction, as shown in

Example 6-6

. 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 AXI4-Stream
Protocol Specification.

Example 6-6. Initialization

initial
begin
int i;
bit last;
axi4stream_transaction trans;
/*******************
** Initialisation **
*******************/
bfm.wait_on(AXI4STREAM_RESET_POSEDGE);
bfm.wait_on(AXI4STREAM_CLOCK_POSEDGE);

To receive protocol transfers, you must create a slave transaction. Within a forever loop, the

create_slave_transaction()

function is used to create a slave transaction and assigned to the

transaction variable trans, as shown in

Example 6-7

.

An inner while loop iterates until the last transfer has been received. On each iteration, a delay is
inserted before the TREADY signal is set to 1 by calling the

ready_delay()

task if

m_insert_wait

is set to 1. After any TREADY delay, the blocking

get_transfer()

task is called

and waits for a transfer to be received.

If further analysis of the received transfer is required, you need to edit the Advanced Slave API
to achieve this. You can obtain details of the

Transaction Record

for the received transfer by

using the

get*()

tasks within the

SystemVerilog Slave BFM

.