Configdb scope path issue

Need some help, I’m trying to perform a configdb set/get access but it is not functioning as expected.

At my top test level, I perform the following set command:

uvm_config_db #(some_object_type)::set(null, "*", "super_cool_object", env_h.agent_h.some_object);

There is a uvm_reg_sequence class in my environment that is performing a configdb get like so:

uvm_config_db#(some_object_type)::get(get_sequencer(),"","super_cool_object", some_object_container)

In this case, get_sequencer() returns a path to uvm sequencer defined in my env.

The simulator is telling me that it couldn’t find “super_cool_object” even though at the test top level I set “*” which I thought means the set object is visible to anyone, but it’s not working. Can anybody correct me on how my configdb set should be written to make the connection work?

Thanks!

In reply to silverace99:

You want to use ‘m_sequencer’ instead of get_sequencer():


uvm_config_db#(some_object_type)::get(m_sequencer,"","super_cool_object", some_object_container)

In reply to cgales:
You want to use ‘m_sequencer’ instead of get_sequencer():


uvm_config_db#(some_object_type)::get(m_sequencer,"","super_cool_object", some_object_container)

It’s not clear to me…what is the difference in using m_sequencer vs get_sequencer() here? Shouldn’t they both return to me the sequencer that I invoked when I called my sequence.start() method?

In reply to silverace99:

get_sequencer returns an object of type uvm_sequencer_base.
See here:

virtual function uvm_sequencer_base get_sequencer (....);

This is your Problem. You have to perform y type Cast to your sequencer type.
Declaring the p_sequncer using this UVM macro

`uvm_declare_p_sequencer(my_sequencer)


is doing this work for you.
It is equivalent to

my_sequencer p_sequencer;
if ( ! $cast(p_sequencer, get_sequencer()) )
  `uvm_fatal(...)

In reply to chr_sue:

In reply to silverace99:
get_sequencer returns an object of type uvm_sequencer_base.
See here:

virtual function uvm_sequencer_base get_sequencer (....);

This is your Problem. You have to perform y type Cast to your sequencer type.
Declaring the p_sequncer using this UVM macro

`uvm_declare_p_sequencer(my_sequencer)

is doing this work for you.
It is equivalent to

my_sequencer p_sequencer;
if ( ! $cast(p_sequencer, get_sequencer()) )
`uvm_fatal(...)

Ok. To be clear, what you are saying is that get_sequencer() is returning a base sequencer object instead of the derived sequencer object that I am using, and therefore even if the path string is correct the uvm_config_db get() will fail to on it’s database key search?

Because when I look at uvm debug menu via waveform gui, I can see that the path string is matching. Or perhaps I am misunderstanding how uvm_config_db get() works.

In reply to silverace99:

Looking at the code and tests I ran, the get_sequencer() call returns the same handle as m_sequencer, so there should be no difference.

I would therefor look at something not matching in the set() hierarchy. I noticed that you used ‘null’ in the set, where typically ‘this’ is used when within the UVM environment.

In reply to cgales:

Yes, get_sequencer returns the wrong type. You have to perform a type cast like this:

$cast(p_sequencer, get_sequencer();

In reply to cgales:

In reply to silverace99:
Looking at the code and tests I ran, the get_sequencer() call returns the same handle as m_sequencer, so there should be no difference.
I would therefor look at something not matching in the set() hierarchy. I noticed that you used ‘null’ in the set, where typically ‘this’ is used when within the UVM environment.

The question is, which kind of object is m_sequencer?

In reply to chr_sue:

Here is the code for the get() function:


  static function bit get(uvm_component cntxt,
                          string inst_name,
                          string field_name,
                          inout T value);
//TBD: add file/line
    int unsigned p;
    uvm_resource#(T) r, rt;
    uvm_resource_pool rp = uvm_resource_pool::get();
    uvm_resource_types::rsrc_q_t rq;

    if(cntxt == null) 
      cntxt = uvm_root::get();
    if(inst_name == "") 
      inst_name = cntxt.get_full_name();
    else if(cntxt.get_full_name() != "") 
      inst_name = {cntxt.get_full_name(), ".", inst_name};

m_sequencer is of type uvm_sequencer_base. get_sequencer also returns a uvm_sequencer_base. Both are sufficient for the cntxt.get_full_name() call.

p_sequencer is only defined if the `uvm_declare_p_sequencer macro is used, which is not required nor recommended.

There is absolutely no need for any casting to be done. Please be sure to post correct information.

In reply to cgales:

Chuck, the macro `uvm_declare_p_sequencer is part of the UVM base class library, i.e. intended to be used.
The question is what is useful!
In my projects I recommend my customers to use virtual sequences or to start a sequence explicitely on a specific sequencer.

Hey thanks guys for the information. I understand the issue better now.

My problem isn’t the use of get_sequencer() vs m_sequencer, but that somehow my pathing is incorrect. But that is probably a topic for another thread, which I will post later.

In reply to silverace99:

Why can’t we use “this” or “null” instead of get_sequencer in get method of sequence class?

In reply to A_123:

Because the sequences does not have a position in the topology of the testbenc. You have to look for a component which relates to the sequence. This is a sequencer.