Set and get in object class

Hello,

Suppose,if i want to set an int in sequence and get it in other object class, than is this possible with uvm_config_db set and get.
As i am having a requirement of such config, both sequence and object class in which i want get that int are directly or indirectly extended from uvm_object, than what should the path be given during set and get.

Please someone can explain the set and get in proper manner to use them in object class.

Thank you,
Dhruvesh.b

In reply to Dhruvesh.b:

See Config/ConfiguringSequences | Verification Academy

In reply to dave_59:

Thanks Dave,

The reference you shared cleared my perspective on sequences and passing configs to it.

But is it valid to set a config int in sequence and get that int in another object class,

For an instance


class my_bus_seq extends uvm_sequence #( my_bus_sequence_item );
  string scope_name = "";
 
  task body();
    my_bus_config m_config;
 
    if( scope_name == "" ) begin
      scope_name = get_full_name(); // this is { sequencer.get_full_name() , get_name() }
    end

    // Setting int in sequence
    `uvm_config_db #( int )::set( uvm_root::get() , scope_name , "counter_low" , 12 ) )
   
  endtask
endclass

And getting this counter_low in another object class,
Till now i have always seen getting the values in sequence,what if i want set the values in sequence and pass to other object class.

I don’t know this is relevant or not,please guide me through this.

Thank you,
Dhruvesh.b

In reply to Dhruvesh.b:

What is your use case? You can always set this counter_low from anywhere in the test bench and use a get in the sequence to update it right? Anytime you want to access this from any other object you can do a get again to see the updated value.

In reply to Dhruvesh.b:

You just need to make sure the set() is applied before the get(). You can also use uvm_config_db::wait_modified() to wait for the set() (BTW, I think this misleadingly named wait_modified(). It just waits for another set(); it doesn’t matter if the value has changed or not.