Category Archives: UVM

Universal Verification Methodology

Mapping between MMR addresses and UVM registers

Using logical names instead of hard coded addresses is an advantage for any software development – including verification. That doesn’t mean that logical names are always better than addresses. Some times an address is handy and other times I would really have wished for the register name. Fortunately UVM has methods to convert from one to another:

function uvm_reg_addr_t uvm_reg::get_address(uvm_reg_map map = null)
function uvm_reg_addr_t uvm_mem::get_address(uvm_reg_addr_t offset = 0, uvm_reg_map map = null)
function uvm_reg uvm_reg_map::get_reg_by_offset(uvm_reg_addr_t offset, bit read = 1)

Example one-liners:

uvm_reg_addr_t addr;
uvm_reg rg;
uvm_mem mem;
addr = regmodel0.MY_BLOCK0.MY_REG0.get_address();
addr = regmodel0.MY_BLOCK0.MY_MEM0.get_address(addr);
rg = regmodel0.default_map.get_reg_by_offset(addr);
mem = regmodel0.default_map.get_mem_by_offset(addr);

Note that the UVM Register Layer allows a register to span multiple addresses.