uvm_memory is used to model memory, and have that modeled memory participate with the register models in order to support certain address map verification techniques (like “shadow” memory and randomized configurations of memory and registers).
The choice of how to model memory needs to be made carefully. The model of memory supported by uvm_memory is as follows. uvm_memory “contains” a regular verilog memory - modeled something like bit[7:0]mem[address]; or bit[31:0]mem[address]; or T mem[address];
where T is some typedef (packed struct, union, etc).
The ‘mem’ field is a sparse array, which means it consumes little or no actual space until a value is written to an address.
Within a management memory space, there can be ranges. The ranges can either be unmanaged (holes) or managed. The holes are treated like “illegal” memory access. The managed ranges are treated like memory which “could be used”.
| uvm_memory | |||||||||||||||||
| uvm_memory is used to model memory, and have that modeled memory participate with the register models in order to support certain address map verification techniques (like “shadow” memory and randomized configurations of memory and registers). | |||||||||||||||||
| Class Hierarchy | |||||||||||||||||
| |||||||||||||||||
| Class Declaration | |||||||||||||||||
| |||||||||||||||||
| Variables | |||||||||||||||||
| mem[int] | A “regular” verilog memory implemented as an associative array (sparse array). | ||||||||||||||||
| ranges | This is the list of managed (and unmanaged) addresses. | ||||||||||||||||
| start_address | The first legal address to use in this memory. | ||||||||||||||||
| end_address | The last legal address to use in this memory. | ||||||||||||||||
| Methods | |||||||||||||||||
| mem_poke() | “Write” to the actual memory using address (addr) and data (d). | ||||||||||||||||
| mem_peek() | “Read” from the actual memory using address (addr). | ||||||||||||||||
| mem_poke_bytes() | Given an address (addr) and an array of bytes, write those bytes into the memory, starting at the address supplied. | ||||||||||||||||
| mem_peek_bytes() | Given an address (addr) and a number of bytes to read, return a list of bytes (nbytes long) starting from the address supplied. | ||||||||||||||||
| bus_read() | |||||||||||||||||
T mem[int]
A “regular” verilog memory implemented as an associative array (sparse array). Each memory location is of type ‘T’. Normal access to this memory is to use mem_peek() and mem_poke().
uvm_memory_ranges ranges
This is the list of managed (and unmanaged) addresses. In a future release ‘ranges’ will be ‘rand’.
function void mem_poke( address_t addr, T d )
”Write” to the actual memory using address (addr) and data (d).
function T mem_peek( address_t addr )
”Read” from the actual memory using address (addr). Return the value read.
virtual function void mem_poke_bytes( address_t addr, bytearray_t d )
Given an address (addr) and an array of bytes, write those bytes into the memory, starting at the address supplied.
virtual function void mem_peek_bytes( output bytearray_t d, input address_t addr, int nbytes )
Given an address (addr) and a number of bytes to read, return a list of bytes (nbytes long) starting from the address supplied.
virtual function void bus_read( bytearray_t read_data, address_t address = 0 )
uvm_memory is used to model memory, and have that modeled memory participate with the register models in order to support certain address map verification techniques (like “shadow” memory and randomized configurations of memory and registers).
class uvm_memory #( type T = int ) extends uvm_register#(T)
A “regular” verilog memory implemented as an associative array (sparse array).
T mem[int]
This is the list of managed (and unmanaged) addresses.
uvm_memory_ranges ranges
The first legal address to use in this memory.
address_t start_address
The last legal address to use in this memory.
address_t end_address
“Write” to the actual memory using address (addr) and data (d).
function void mem_poke( address_t addr, T d )
“Read” from the actual memory using address (addr).
function T mem_peek( address_t addr )
Given an address (addr) and an array of bytes, write those bytes into the memory, starting at the address supplied.
virtual function void mem_poke_bytes( address_t addr, bytearray_t d )
Given an address (addr) and a number of bytes to read, return a list of bytes (nbytes long) starting from the address supplied.
virtual function void mem_peek_bytes( output bytearray_t d, input address_t addr, int nbytes )
virtual function void bus_read( bytearray_t read_data, address_t address = 0 )