Set virtual interface in uvm_config_db

Hi forum,
I see both in example from the net and in real chip environments,
that setting the virtual interfaces to uvm_config_db are done in 2 main ways.

 uvm_config_db#(virtual some_if)::set(null, "*", "m_some_if", m_some_if); 
 uvm_config_db#(virtual some_if)::set(uvm_root::get(), "uvm_test_top.some_component*", "m_some_if", m_some_if); 

Why not to use option 1, so all components can get interfaces easily?
In option 2 usually the base test or some other component get the interface and set them hierarchically between components. it is more complicated.

In reply to shimonc:

Why not to use option 1, so all components can get interfaces easily?
In option 2 usually the base test or some other component get the interface and set them hierarchically between components. it is more complicated.

Hi Shimonc,

Depends on requirements,if we take an example let’s say we have multi instance of same IP (4-5 slaves ), if our architecture is like we have to connect all individually then we must have to pass interface with hair we can not use global scope for that , and if we do that we end up with disaster.


| | | |
| |============>>| S-1 |
| MASTER | ||
| | __________________
| | | |
| |============>>| S-2 |
|
| |_______________|

in this case if you pass interface with “" both instance get same interface handle so you have to pass using "s-1.” and “s-2.*”, i hope you get it.

In reply to shimonc:

As Dhaval mentioned, when you have multiple instances of the same interface type, you can’t use “*” as this will result in all agents getting the same interface handle.

The recommended approach is to target “uvm_test_top” for all interfaces, with a unique string identifier for each one. The test will then get each interface handle and store it in the appropriate agent configuration object, which is then passed to the agent.

By putting the interface handle in the agent configuration object, you minimize the number of config_db() calls that the agent has to make.

In reply to shimonc:

Hi forum,
I see both in example from the net and in real chip environments,
that setting the virtual interfaces to uvm_config_db are done in 2 main ways.

 uvm_config_db#(virtual some_if)::set(null, "*", "m_some_if", m_some_if); 
 uvm_config_db#(virtual some_if)::set(uvm_root::get(), "uvm_test_top.some_component*", "m_some_if", m_some_if); 

Why not to use option 1, so all components can get interfaces easily?
In option 2 usually the base test or some other component get the interface and set them hierarchically between components. it is more complicated.

You are addressing diiferent aspects:
(1) arg1: is mostly this or null. ‘this’ indicates the pathe shown in the 2nd arg has to be considered as relative path. ‘null’ indicates an absolute path.
(2) arg2: limits the access of the corresponding entry. If you are using a wildcard any component/object can access the data.