Hi everyone,
I was reading Sunburst papers and found the recommendation that config_db should generally not be used inside uvm_objects such as sequences and sequence_items because they are not part of the UVM component hierarchy.
To understand this better, I did the following experiment.
In my test, I set a value using:
uvm_config_db#(int)::set(null, “*”, “a”, 10);
Then inside a sequence (derived from uvm_sequence), I tried two different get() calls:
- Using this: uvm_config_db#(int)::get(this, “”, “a”, B);
This failed to compile because get() expects a uvm_component context, while a sequence is a uvm_object.
- Using null: uvm_config_db#(int)::get(null, “”, “a”, B);
This worked successfully, and the sequence was able to retrieve the value.
From this observation, it seems that config_db access from a sequence is technically possible when using null as the context, even though using this is illegal.
My question is:
-
What are the advantages and disadvantages of using get(null, …) inside a sequence or other uvm_objects?
-
Is this considered acceptable UVM methodology, or should it still be avoided?
-
Does using null effectively turn the lookup into a global search and therefore reduce reusability/debuggability?
-
In real projects, would you recommend using get(null, …) from sequences, or is it better to pass configuration data through sequence fields, resources, or some other mechanism?
I would appreciate understanding not only whether this works, but also the methodology implications and best practices used in production UVM environments.
Thanks!