Example 6-29. handle_read, Handle_read – Altera Mentor Verification IP Altera Edition AMBA AXI3/4TM User Manual

Page 183

Advertising
background image

SystemVerilog Tutorials

Verifying a Master DUT

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

165

September 2013

The Slave BFM helper function set_read_data() then fills a complete read data bus width of
data into the Slave BFM data_words[] array. At this point a read data phase is executed on to
the read data channel if the

slave_mode

setting is AXI_PHASE_SLAVE, otherwise it executes a

complete read data burst only when the Slave BFM data_words[] array contains a complete
burst of read data.

Example 6-29. handle_read

// Task : handle_read
// This method reads data from memory and send read data/response
// either at burst or phase level depending upon slave working
// mode.
task automatic handle_read(input axi_transaction read_trans);
addr_t addr[];
bit [7:0] mem_data[];

set_read_data_valid_delay(read_trans);

for(int i = 0; bfm.get_read_addr(read_trans, i, addr); i++)
begin
mem_data = new[addr.size()];
for (int j = 0; j < addr.size(); j++)
mem_data[j] = do_byte_read(addr[j]);

bfm.set_read_data(read_trans, i, addr, mem_data);

if (slave_mode == AXI_PHASE_SLAVE)
bfm.execute_read_data_phase(read_trans, i);
end

if (slave_mode == AXI_TRANSACTION_SLAVE)

bfm.execute_read_data_burst(read_trans);

endtask

The processing of write transactions in the Slave Test Program works in a similar way as that
described for read transactions. Processing a write transaction requires both a

process_write

task and a

handle_write

task.

The main difference is that the write transaction handling gets the write data burst and stores it
in the Slave Test Program

internal memory

depending on the

slave_mode

setting, adhering to

the state of the write strobes signal WSTRB. There is also an additional write response phase that
is required for the AXI3 write channel.

Advertising