accellera-official / uvm-core

Apache License 2.0
45 stars 19 forks source link

uvm_reg_map get_size method ignores the n_bytes attribute #7

Closed rahultadak closed 4 months ago

rahultadak commented 6 months ago

In the uvm_reg_map::get_size method, the output comes from last known register's address. At the end of the method, the return value is: return max_addr + 1;

https://github.com/accellera-official/uvm-core/blob/b5f8562d8bee8ea11b06fc2692ed2ba0b5b7eeb7/src/reg/uvm_reg_map.svh#L1324C4-L1324C23

Instead, the function should return: return max_addr + n_bytes;

Which would return the right value. I've created a playground to demonstrate it: https://www.edaplayground.com/x/mhic

I have 3 64b registers in the map. I expect the get_size method to return 'd24, because the total map occupies 24 bytes. Instead it returns 'd17

UVM_INFO testbench.sv(69) @ 0: uvm_test_top [uvm_test_top] Size of reg map is 17

  1. UVM Version - UVM 1.2
  2. Platform, Compiler, Simulator, Flags - EDA Playground, Synopsys VCS 2021.09, vcs -licqueue '-timescale=1ns/1ns' '+vcs+flush+all' '+warn=all' '-sverilog' +incdir+$UVM_HOME/src $UVM_HOME/src/uvm.sv $UVM_HOME/src/dpi/uvm_dpi.cc -CFLAGS -DVCS design.sv testbench.sv && ./simv +vcs+lic+wait
  3. Compile/runtime warnings and errors
    
    Warning-[SV-ICHU] Illegal class handle usage
    /apps/vcsmx/vcs/S-2021.09//etc/uvm-1.2/src/vcs/snps_reg.svh, 180
    $unit
    Illegal '!' operator on class handle 'rg'.
    As per LRM(P1800-2009), section 8.4. only ==, !=, ===, !== and conditional 
    operator are allowed operators on class handles.
    Source Expression: (!rg)

Warning-[SV-ICHU] Illegal class handle usage /apps/vcsmx/vcs/S-2021.09//etc/uvm-1.2/src/vcs/snps_reg.svh, 247 $unit Illegal '!' operator on class handle 'rg'. As per LRM(P1800-2009), section 8.4. only ==, !=, ===, !== and conditional operator are allowed operators on class handles. Source Expression: (!rg)

Warning-[SV-ICHU] Illegal class handle usage /apps/vcsmx/vcs/S-2021.09//etc/uvm-1.2/src/vcs/snps_reg.svh, 165 $unit Illegal '!' operator on class handle 'this.m_use_map'. As per LRM(P1800-2009), section 8.4. only ==, !=, ===, !== and conditional operator are allowed operators on class handles. Source Expression: (!this.m_use_map)

Warning-[SV-ICHU] Illegal class handle usage /apps/vcsmx/vcs/S-2021.09//etc/uvm-1.2/src/vcs/snps_reg.svh, 167 $unit Illegal '!' operator on class handle 'rg'. As per LRM(P1800-2009), section 8.4. only ==, !=, ===, !== and conditional operator are allowed operators on class handles. Source Expression: (!rg)

mstrickland-mrvl commented 5 months ago

Thanks for your submission! The committee has reviewed this, but we see that the method in question is not documented and is just an internal function in the library. We do not see the need to change an internal function. However, if you were seeing a bug manifest in a documented API for the library from this source, please provide us with details of that bug and we would be glad to look at it.

mstrickland-mrvl commented 4 months ago

Close for now, re-open if there is follow-up