Sounds good t me.
I believe you do have the right understand when using the arguments of the config_db command.
If the 1st argument is null this indicates you are using an absolute path which requires the whole hierarchy path in the 2nd argument whan using the get.
Using as 1st argument ‘this’ it is indicating a relative path.
An analogy to the uvm_config_db is the Linux file system. The DB is made of name-value pairs while Linux has file-contents. The first two arguments to uvm_config_db form a scope, which is like a Linux directory. The first must be a uvm_component handle, usually this, or null. The handle this is like the current directory, while null is like Linux root or /. A callback class is not derived from uvm_component, so it can’t pass this as the first argument.
When your agent makes the following call, it is using the scope uvm_test_top.env_h.agent_h.callback_h
// In agent
uvm_config_db #(virtual vif)::set(this, "callback_h", "Interface", uvc_if);
That is like the Linux file /uvm_test_top/callback_h/Interface with the contents uvc_if.
[br]
The problem is that a callback is not a component. In your code, callback_h seems to be a property under the agent or driver. So you should use a global scope. If you start the scope with null, that is like the Linux root.
// In test class
uvm_config_db#(virtual vif)::set(null, "Callback", "Interface", uvc_if);
This is like the Linux file /Callback/Interface Then get the value in the callback class with the matching call.
// In callback
uvm_config_db#(virtual vif)::get(null, "Callback", "Interface", uvc_if);
[br]
This works great if every agent has the same callback. If you need different callbacks for different agents … see what you can uniquify that second argument.
Hi chr_sue,
Faced an issue regarding using virtual interface in the object.
If I set the interface provided with the inst_name hierarchy path and try to access the virtual interface in sequence then I use to get error.
uvm_config_db #(virtual intf)::set(null,“uvm_test_top.env.agt”,“vif_intf”,vif);
but if inst_name is simply provided with Asterisk it works fine
uvm_config_db #(virtual intf)::set(null,“*”,“vif_intf”,vif);
So may I know why virtual interface works for sequence only if the inst_name is provided with Asterisk (in my case).
The answer is very simple. The agent belongs to the topology of your UVM environment because it is extended from uvm_component.
Sequences do not belong to the topology. They are transient objects and they are extended from uvm_object. Using the wildcard ‘*’ does not point to a component “uvm_test_top.env.agt”.
BTW you should never use a virtual interface in a sequence.
You are loosing the reusability slow-down your simulation.
Asterick: The get() call tries to match the provided scope and name with scopes and names in the DB. When you call set(null, “*”, …) you are making a scope that matches any get() call.
Thank you chr_sue for the clarification, I am Learning UVM so it’s a curiousity for me like how it is slowing down the simulation if virtual interface is used in the sequence?
BTW I have used virtual interface as well as forever loop in my sequence and at the end of simulation it is not providing UVM Report, so is it because of accessing Virtual Interface?