Hi all,
I am having question on get_reg_by_offset() method of reg_map. As per the code, it has two arguments, one is offset which should be the address of the register [with additional base offset] for which register handle is needed, and second one is read which is default 1.
Can anyone provide more information about read and offset? where i should pass read as “1” or “0”.
function uvm_reg uvm_reg_map::get_reg_by_offset(uvm_reg_addr_t offset,
bit read = 1);
if (!m_parent.is_locked()) begin
`uvm_error("RegModel", $sformatf("Cannot get register by offset: Block %s is not locked.", m_parent.get_full_name()));
return null;
end
`uvm_info(get_name(), $sformatf("TEST DEBUG 1. : OFFSET %0h IS_READ :%0d REG_EXIST : %0d", offset, read, m_regs_by_offset_wo.exists(offset)), UVM_LOW)
if (!read && m_regs_by_offset_wo.exists(offset))
return m_regs_by_offset_wo[offset];
`uvm_info(get_name(), $sformatf("TEST DEBUG 2. : OFFSET %0h IS_READ :%0d REG_EXIST : %0d", offset, read, m_regs_by_offset.exists(offset)), UVM_LOW)
if (m_regs_by_offset.exists(offset))
return m_regs_by_offset[offset];
return null;
endfunction
Also, i tried one scenario on which, i configured two different register which same address on same map with “RO” and “WO” accesses. then i performed following operations.
1. uvm_reg rg = ral_block.reg_map1.get_reg_by_offset('h64);
2. uvm_reg rg = ral_block.reg_map1.get_reg_by_offset('h64, 0);
First line returns, register handlle configured with “RO” access, and second line returns register handle configured with “WO” access.
Can anyone please tell me that how this happened?
Thanks in advance
Mitesh Patel