How to pass a variable value from env class to transaction class without using config_db?

Hi Folks,
Actually I am trying to pass a variable value from environment class to my transaction class. Please suggest any method to pass value of a variable from my component hierarchy classes to my transaction class except the config_db method.

In reply to pankaj12saha:

If you do not waht to use the config_db you can use parameters, parameterized classes and packages.
The question is why you do not want to use the config_db, because it is the most elegant way.

In reply to pankaj12saha:

I don’t think you can communicate runtime information with help of parameters.

You can use find() method available in uvm_root class. Use this method in transaction class to find instance of Env and access Env properties from there.


// Declare Env class handle in Transaction class
..
  uvm_component_h =  uvm_top.find("*.env_h");

  if($cast(env_h, uvm_component_h))
  ..

In reply to MayurKubavat:

It would really help to know why you have the requirement not to use the config_db — is this an interview question? It’s best not to have handles to components in our downstream classes. This creates circular dependencies.

The ideal solution is using the config_db in your sequence, then pass the value of the variable you want from your env to your sequence item by assigning it directly after creating the sequence_item.

Im not sure why you need to do this, but i think you can do
val= $root.testbench.env.variable
val is transaction class local variable

In reply to dave_59:

Thanks u Dave for answering my question. Actually I tried the config_db and I am able to get the value to transaction class. The main problem which I am facing is, While making multiple instances of transaction class ,I am not getting the value of variable, that is why I asked that above mentioned question.
I got to know one more method by using parameter and `define concept this concept is working fine.
And once again to thank everyone for suggestion of my query.