Meaning of Syntax in this uvm_config_db eg

uvm_config_db #(uvm_object_wrapper)::set(this, "i_agt.sqr.main_phase", "default_sequence", packet_sequence::get_type());

Hi,
Can someone explain the meaning of above line in detail point by point especially about uvm_object_wrapper, main_phase, default sequence, the above line is defined in uvm environment.

If I am not wrong using this we can start particular sequence on the sequencer. if it so, then do we need start method in test class as well.

Thanks,

Mukul

In reply to mukul1996:

Its quite an interesting question after taking a deeper look. Let me give an attempt

Below is the method prototype of set


static function void set(
   	uvm_component 	cntxt,
   	string 	inst_name,
   	string 	field_name,
   	T 	value
)

So here w.r.t your code above
cntx = this : Specifies the starting point of the hierarchy from this is set
inst_name = “i_agt.sqr.main_phase” : Specifies the hierarchical name of the target w.r.t cntx
field_name = “default_sequence” : Specifies the key with which the value is retrieved
value = “packet_sequence::get_type()” : Specifies the value and the type ‘T’ here is uvm_object wrapper

Here there are two parts which might confuse than typical style of uvm_config_db usage to set class objeccts

  1. Type being uvm_object wrapper. Typically, we pass ‘T’ as <class_name> and ‘value’ by a non-null object of same or derived class type. As you might know every class gets a proxy (by name type_id) when registered with factory. The base class for this proxy is uvm_object_wrapper. Here the get_type method actually fetches the singleton object of the proxy for that respective class.

I’m not precisely sure why UVM took this approach for default_sequence instead of typical style <class_name> as ‘T’ and a simple non-null object as value. But it could be something to ease the factory access within the uvm_sequencer base code.

  1. inst_name being “i_agt.sqr.main_phase”. This could be slightly misleading that agent is an object inside ‘cntx’, ‘sqr’ is an object inside ‘i_agt’ and ‘main_phase’ is an object inside sqr. It is true until ‘sqr’ while ‘main_phase’ is just a method inside the ‘sqr’ and not an object.

The uvm_sequencer base code might handle the equivalent ‘get’ something like (not exactly)


uvm_config_db #(uvm_object_wrapper)::get(this, "main_phase", "default_sequence", <some_identifier>);

IMHO, instead of having phase information (e.g. “main_phase”) as part of the ‘inst_name’, they could have moved it to the ‘field_name’ (for e.g. main_phase_default_sequence) and handled internally for each phase appropriately.

Hope this helps.

Regards,
Prem

In reply to mukul1996:

uvm_config_db #(uvm_object_wrapper)::set(this, "i_agt.sqr.main_phase", "default_sequence", packet_sequence::get_type());

Hi,
Can someone explain the meaning of above line in detail point by point especially about uvm_object_wrapper, main_phase, default sequence, the above line is defined in uvm environment.
If I am not wrong using this we can start particular sequence on the sequencer. if it so, then do we need start method in test class as well.
Thanks,
Mukul

The UVM provides you 2 different methods to start sequences:
(1) Using the start method, i.e. starting a sequence on a sequencer manually.
(2) Starting a sequence automatically by using the default_sequence approach.
In your acse you are declaring the sequence packet_sequence as your default_sequence.
You do not have to do any get on the config_db for this case.
This is the only approach which is still inherited from the OVM.
It is not recommended to use the default_sequence approach.
The uvm_object_wrapper is the class type related to the default_sequence. That’s a definition.
You are setting the default_sequence for the run_phase or main_phase of the corresponding sequencer on which the sequence is intended to run.