Example 6-2 – Altera Mentor Verification IP Altera Edition AMBA AXI4-Stream User Manual

Page 69

Advertising
background image

SystemVerilog Tutorials

Verifying a Slave DUT

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

69

April 2014

Example 6-2. Master Transaction Creation and Execution

/************************
** Traffic generation: **
************************/
// 10 x packet with
// Number of transfer = i % 10. Values : 1, 2 .. 10
// id = i % 15. Values 0, 1, 2 .. 14
// dest = i %20. Values 0, 1, 2 .. 19
for(int i = 0; i < 10; ++i)
begin

transfer_count = (i % 10) + 1;
trans = bfm.create_master_transaction(transfer_count);
trans.set_id = (i % 15);
trans.set_dest = (i % 20);
for(int j = 0; j < (transfer_count * byte_count); ++j)
begin

trans.set_data(i + j, j);
if(((i + j)% 5) == 0)
begin

trans.set_byte_type(AXI4STREAM_NULL_BYTE, j);

end
else if(((i + j)% 5) == 1)
begin

trans.set_byte_type(AXI4STREAM_POS_BYTE, j);

end
else
begin

trans.set_byte_type(AXI4STREAM_DATA_BYTE, j);

end

end
bfm.execute_transaction(trans);

end

The master test program repeats the creation of master transactions similar to that shown in

Example 6-2

, but instead calls the

execute_transfer()

task per iteration of the inner for loop, as

shown in

Example 6-3

.

Advertising