Example 11-2, Calling – Altera Mentor Verification IP Altera Edition AMBA AXI4-Stream User Manual

Page 183

Advertising
background image

VHDL Tutorials

Verifying a Slave DUT

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

183

April 2014

Example 11-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 i in 0 to 9 loop

transfer_count := (i mod 10) + 1;
create_master_transaction(transfer_count, trans, index,

axi4stream_tr_if_0(index));

set_id(i mod 15, trans, index, axi4stream_tr_if_0(index));
set_dest(i mod 20, trans, index, axi4stream_tr_if_0(index));
for j in 0 to ((transfer_count * byte_count) - 1) loop

set_data(i + j, j, trans, index, axi4stream_tr_if_0(index));
if(((i + j) mod 5) = 0) then

set_byte_type(AXI4STREAM_NULL_BYTE, j, trans, index,

axi4stream_tr_if_0(index));

elsif(((i + j) mod 5) = 1) then

set_byte_type(AXI4STREAM_POS_BYTE, j, trans, index,

axi4stream_tr_if_0(index));

else

set_byte_type(AXI4STREAM_DATA_BYTE, j, trans, index,

axi4stream_tr_if_0(index));

end if;

end loop;
execute_transaction(trans, index, axi4stream_tr_if_0(index));

end loop;

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

Example 11-2

, but instead calls the

execute_transfer()

task per iteration of the inner for loop, as

shown in

Example 11-3

.

Advertising