Hi
As per uvm spec if we set a lower level component configuration from different top hierarchy level components then upper hierarchy component always has precedence over lower. but in the given scenario I am setting a variable from the different hierarchy for different scope but I am getting the same value in both scope. Please have a look on the below code and let me know your output, why I am getting the same value for different scope.
-
I am setting a variable name “from_top” from the top module and keeping its scope till uvm_test_top as given below
file top module :
int from_top =10;
uvm_config_db#(int)::set(null, “”, “from_top”, from_top); -
I am setting the same variable from agent and keeping its scope to driver only.
file : agent class
int from_top =5;
uvm_config_db#(int)::set(this, “driver”, “from_top”, from_agent); -
I am trying to get the values from driver class as given below
caseA : if(!uvm_config_db#(int)::get(uvm_root::get(), “”, “from_top”, from_top)) begin
`uvm_error(“”, “From top :uvm_config_db::get failed”)
end
caseB : if(!uvm_config_db#(int)::get(this, “”, “from_top”,from_agent)) begin
`uvm_error(“”, “From agent : uvm_config_db::get failed”)
end
As per my understanding the output for the caseA should be “10” and the output from the caseB should be “5” as the setting scope of this variable are different. but I am getting the value “10” for the both the cases.
from the log massage I can see that the setting/getting scope are different for both case as given below :
set method in top module:
UVM_INFO /home/build/vlib1/vlib/uvm-1.1d/src/base/uvm_resource_db.svh(121) @ 0: reporter [CFGDB/SET] Configuration ‘.from_top’ (type bit signed[31:0]) set by = (bit signed[31:0]) 10
set method in agent class :
UVM_INFO /home/build/vlib1/vlib/uvm-1.1d/src/base/uvm_resource_db.svh(121) @ 0: reporter [CFGDB/SET] Configuration ‘uvm_test_top.env.agent.driver.from_top’ (type bit signed[31:0]) set by uvm_test_top.env.agent = (bit signed[31:0]) 5
Now get method from driver :
caseA :
UVM_INFO /home/build/vlib1/vlib/uvm-1.1d/src/base/uvm_resource_db.svh(121) @ 0: reporter [CFGDB/GET] Configuration ‘.from_top’ (type bit signed[31:0]) read by = (bit signed[31:0]) 10
caseB :
UVM_INFO /home/build/vlib1/vlib/uvm-1.1d/src/base/uvm_resource_db.svh(121) @ 0: reporter [CFGDB/GET] Configuration ‘uvm_test_top.env.agent.driver.from_top’ (type bit signed[31:0]) read by uvm_test_top.env.agent.driver = (bit signed[31:0]) 10
Thanks
Vipan Kumar