Hi,
I have an existing base test class that is extended from uvm_test.
It consists of various objects such as env1, env2, cfg1, cfg2.
And the intent of this base test class, is to powerup the x1 DUT.
Now, I would like to leverage uvm_test, to form a new testbench, where x2 DUT will instantiated.
I am thinking of changing base test class to be extended from uvm_test, and create a new base_new class which will instantiate x2 of base.
Is this approach reasonable? Or is there a typical approach that should be used in a uvm platform?
Is it correct to use uvm_config_db in order to access base_test objects, therefore existing tests which used to control x1 DUT could still be leveraged?
Example:
[a] Original base test class
Class base_test extends uvm_test
my_env env1;
my_env env2;
my_cfg cfg1;
my_cfg cfg2;
…
virtual function void build_phase(uvm_phase phase);
cfg1 = my_cfg::type_id::create(“cfg1”,this);
cfg2 = my_cfg::type_id::create(“cfg2”,this);
uvm_config_db#(my_cfg)::set(this,“env”, “my_cfg”, this.cfg1);
uvm_config_db#(my_cfg)::set(this,“env1”, “my_cfg”, this.cfg2);
… likewise for my_env
endfunction
…
endclass
[b] Change to “Class base_test extends uvm_env”, and create base_new_test as follows:
Class base_new_test extends uvm_test
base_test base1;
base_test base2;
my_env env1;
my_env env2;
my_cfg cfg1;
my_cfg cfg2;
virtual function void build_phase(uvm_phase phase);
base1 = base_test::type_id::create(“base1”, this);
base2 = base_test::type_id::create(“base2”, this);
cfg1 = my_cfg::type_id::create(“cfg1”,this);
cfg2 = my_cfg::type_id::create(“cfg2”,this);
uvm_config_db#(my_cfg)::get(this,“”, “my_cfg”, this.cfg1);
uvm_config_db#(my_cfg)::get(this,“”, “my_cfg”, this.cfg2);
… likewise for my_env
endfunction
endclass