Read transaction creation and execution, As shown in, Example 11-10 – Altera Mentor Verification IP Altera Edition AMBA AXI3/4TM User Manual

Page 636: This satisfies the protocol requi, Before executing it. the code shown in, Calls the

Advertising
background image

Mentor VIP AE AXI3/4 User Guide, V10.2b

616

VHDL Tutorials
Verifying a Slave DUT

September 2013

All other transaction fields default to legal protocol values (see

create_write_transaction()

procedure for details).

Example 11-10. Write Transaction Creation and Execution

-- 4 x Writes
-- Write data value 1 on byte lanes 1 to address 1.
create_write_transaction(1, tr_id, index, axi4_tr_if_0(index));
data_words(31 downto 0) := x"00000100";
set_data_words(data_words, tr_id, index, axi4_tr_if_0(index));
set_write_strobes(2, tr_id, index, axi4_tr_if_0(index));
report "master_test_program: Writing data (1) to address (1)";

-- By default it will run in Blocking mode
execute_transaction(tr_id, index, axi4_tr_if_0(index));

In the complete Master Test Program three subsequent write transactions are created and
executed in a similar manner to that shown in

Example 11-10

. See

VHDL AXI4 Master BFM

Test Program

for details.

Read Transaction Creation and Execution

The code excerpt in

Example 11-11

reads the data that has been previously written into the

slave memory. The Master Test Program first creates a read transaction by calling the

create_read_transaction()

procedure, providing only the start address argument. The optional

burst-length automatically defaults to a value of zero—indicating a burst length of a single beat.

The

set_size()

procedure is then called to set the transaction size field to a single byte

(AXI4_BYTES_1), and the

set_id()

procedure call sets the transaction id field to be 1. The read

transaction is then executed on the protocol signals by calling the

execute_transaction()

procedure.

The read data is obtained using the

get_data_words()

procedure to get the data_words

transaction field value. The result of the read data is compared with the expected data—and a
message displays the transcript.

Example 11-11. Read Transaction Creation and Execution

--4 x Reads
--Read data from address 1.
create_read_transaction(1, tr_id, index, axi4_tr_if_0(index));
set_id(1, tr_id, index, axi4_tr_if_0(index));
set_size(AXI4_BYTES_1, tr_id, index, axi4_tr_if_0(index));
execute_transaction(tr_id, index, axi4_tr_if_0(index));

get_data_words(data_words, tr_id, index, axi4_tr_if_0(index));
if(data_words(31 downto 0) = x"00000100") then

report "master_test_program: Read correct data (1) at address (1)";

else

hwrite(lp, data_words(31 downto 0));

Advertising