Functions that read and write a byte of data to, Internal memory do_byte_read(), Do_byte_write() – Altera Mentor Verification IP Altera Edition AMBA AXI3/4TM User Manual

Page 175: Respectively

Advertising
background image

SystemVerilog Tutorials

Verifying a Master DUT

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

157

September 2013

The

internal memory

for the slave is defined as a sparse array of 8-bits, so that each byte of data

is stored as an address/data pair.

Example 6-17. internal memory

// Storage for a memory
bit [7:0] mem [*];

The

do_byte_read()

function, when called, reads a data byte from the

internal memory

, mem,

given an address location as demonstrated in

Example 6-18

.

You can edit this function to modify the way the read data is extracted from the

internal

memory

.

Example 6-18. do_byte_read()

// Function : do_byte_read
// Function to provide read data byte from memory at
// particular input address
function bit[7:0] do_byte_read(addr_t addr);
return mem[addr];
endfunction

The

do_byte_write()

function, when called, writes a data byte to the

internal memory

, mem,

given an address location as

Example 6-19

illustrates.

You can edit this function to modify the way the write data is stored in the

internal memory

.

Example 6-19. do_byte_write()

// Function : do_byte_write
// Function to write data byte to memory at particular
// input address
function void do_byte_write(addr_t addr, bit [7:0] data);
mem[addr] = data;
endfunction

Advertising