Usage of config DB(Highest write wins)

Hi All,

Can any please point me to an example code where we say in config DB highest write wins.

For example say there is a variable in driver we want to set. Lets call this variable as “val”. Below are calls made in build phase of each component and according to rule Highest write wins. So Test set should be final value in driver if we display it in driver run_phase , correct ?

Test :- uvm_config_db#(int)::set(null,“uvm_test_top.env.mem_agnt.driver”,“val”,4);
env :- uvm_config_db#(int)::set(uvm_root::get(),“*”,“val”,3)
agent :- uvm_config_db#(int)::set(null,“uvm_test_top.env.mem_agnt*”,“val”,2);
driver :- uvm_config_db#(int)::set(uvm_root::get(),“*”,“val”,1);
uvm_config_db#(int)::get(this, “”,“val”,val);

Please let me know. Thanks

The first argument to uvm_config_db::set/get is a uvm_component context. It does not know where the setting came from without it. You need to put this as the argument, otherwise a null or uvm_root::get() gets interpreted as the highest level. Last setting applies when you have multiple set()s from the same level. So in your exampkle, the setting you made from the driver’s build phase has the highest priority.

Here’s another example you could look at: Example of uvm_config_db settings(1) - EDA Playground