Sequence accessing config db prior to body() - alternative?

I have a sequence which fetches an object from the config db at the start of its body. It uses get_full_name() to get the ‘sequencer path’.

However I now have a case where the thing that creates the sequence (let’s say the test) should alter something in that config object, prior to starting the sequence.

My initial try was to move the config db access from body() to new():

class myseq extends uvm_sequence #(...);

      some_object my_obj;     // this one is in the config db

      function new(..);
           if(scope_name=="") 
               scope_name = get_full_name(); 
               uvm_config_db #(some_obj)::get(null, scope_name, "my_obj",my_obj)
      endfunction

endclass

This would allow the test to create the sequence, and then do for example

seq.my_obj.something = ...

The issue is that new does not know about the sequencer path yet, so the above code will not let the object be retrieved from the config db.
what would be a good workaround for this?

Some possibilities:

  • get the object from the config db in the test, but this means I have to put the visibility of that object higher than I actually would want to.
  • put a callback or so in the beginning of the body

Keep the config_db access in pre_start method of the sequence

Thanks
Sasi

I think that is a good suggestion as such, but I how would I link my test specific code with pre_start?

I.e. in pre_start I would get the object from the config db, but then I need to alter some members of this object in a test specific way. I could create a test specific sequence with a test specific pre_start method, but that doesn’t seem like a very good solution to me. Or is it?

In reply to NiLu:

What component did the set()?
Does the test not have direct access to that object, wherever it lives?

In reply to Nico75:

It is best practise to get the configuration object in the pre_body method in the base sequence.

You should have a virtual sequence specific to each test and should configure the properties in configuration object there. After configuration you can start the non test specific sequences.

This approach helps maximum reusability of test sequences at sub-system/ system level.

Regards,
Yogesh