Hello All,
I guess we have around three common ways to share variable value across UVM components,
- Global variable
- config_db
- uvm_event
In our project, we are interchangeably using these. Some of the places we have used global variable (by declaring in tb_pkg.sv) and at some places we are utilizing config_db.
So I wish to know what is the good programming style to share variable values between components. I am aware that “using global variable” is not a good idea but I am not knowing its disadvantages too.
I am aware if we want to set and get variable onetime(static) then config_db would be the best choice(set/get interface handle,class objects) but if I need to get some variable values per clk (dynamically) then wouldn’t using config_db be a overhead? What should we use in this situation then?
One common good way I am seeing is to make global_cfg class and declare all common variables,methods inside it and set it in a config_db(from the test) and pass the same handle to all the uvm components down the hierarchy without cloning it.
Can anyone help me what should be the good way to share variables based on above situations? (Not sure if this has already been discussed)