In reply to Tudor Timi:
Thank you Tudor.
It seems that some_reg_file.map($reg_map, …) is not a pre-defined method for uvm_reg_block, right?
Do you mean we can create a “map($reg_map, …)” method inside a $reg_block which takes $reg_map as a argument and calls $reg_map.add_reg(…) to add all registers to that $reg_block, and in system level, that $reg_block.map($sys_reg_map, …) method can be called to map all registers in the block $reg_block to different reg_maps?
But It seems to me that the following code defined in uvm_reg_map requires that the uvm_reg_map and the uvm_reg have the same parent.
So it seems that the multiple reg_maps needed to be defined and instantiated in each block $reg_block, but it is not good since multiple reg_maps should be invisible in block level from block reuse perspective.
function void uvm_reg_map::add_reg(uvm_reg rg,
uvm_reg_addr_t offset,
string rights = "RW",
bit unmapped=0,
uvm_reg_frontdoor frontdoor=null);
if (m_regs_info.exists(rg)) begin
`uvm_error("RegModel", {"Register '",rg.get_name(),
"' has already been added to map '",get_name(),"'"})
return;
end
if (rg.get_parent() != get_parent()) begin
`uvm_error("RegModel",
{"Register '",rg.get_full_name(),"' may not be added to address map '",
get_full_name(),"' : they are not in the same block"})
return;
end
rg.add_map(this);
begin
uvm_reg_map_info info = new;
info.offset = offset;
info.rights = rights;
info.unmapped = unmapped;
info.frontdoor = frontdoor;
m_regs_info[rg] = info;
end
endfunction