Hi,
I've defined a base testing virtual class (
base_tester.sv). In my
env.sv file I instantiate the base_tester object, then in my test (
random_test.sv) I do a set_type_override to cast all factory creations of base_tester into the child class
random_tester.sv
class random_test extends uvm_test;
`uvm_component_utils(random_test);
env env_h;
function new (string name, uvm_component parent);
super.new(name, parent);
endfunction : new
function void build_phase (uvm_phase phase);
base_tester::type_id::set_type_override(random_tester::get_type()); env_h = env::type_id::create("env_h", this);
endfunction : build_phase
endclass : random_test
class env extends uvm_env;
`uvm_component_utils(env);
base_tester tester_h;
coverage coverage_h;
scoreboard scoreboard_h;
function new (string name, uvm_component parent);
super.new(name, parent);
endfunction : new
function void build_phase(uvm_phase phase);
tester_h = base_tester::type_id::create("tester_h", this);
coverage_h = coverage::type_id::create("coverage_h", this);
scoreboard_h = scoreboard::type_id::create("scoreboard_h", this);
endfunction : build_phase
endclass : env
I'm am receiving this error from the compiler:
ERROR VCP2937 "Cannot instantiate abstract class: base_tester." "../../../../../home/runner/uvm-1.2/src/base/uvm_registry.svh" 66 28
My understanding is that since I declard set_type_override in random_test.sv to convert all base_testers to random_testers, I should not be hitting an error where the compiler thinks I am trying to instantiate the virtual base class. However the error seems to disagree. Can anybody see what I may be doing wrong?