Set_type_override gives compile error

I have a base_virt_seq ,which I want to override with block_virt_seq. When I use set_type_override, it gives me error “Target for scope resolution operator does not exist”. What am I doing wrong here:(pseudo code)

class test extends base_test;

function void build_phase(uvm_phase phase);
   super.build_phase(phase);
   set_type_override(base_virt_seq::type_id,block_virt_seq::get_type());
endfunction : build_phase

task main_phase(uvm_phase phase);
get_list();
endtask
endclass

class base_test extends uvm_test;

function get_list;
item_list = base_virt_seq.get_list();
endfunction

endclass

The syntax for function set_type_override is

function void uvm_component::set_type_override (string original_type_name,
                                                string override_type_name,
                                                bit    replace=1);

So the correct way to register the type override would be

set_type_override(base_virt_seq::type_name,block_virt_seq::type_name);

This is assuming you have used `uvm_object_utils( <class_type> ) within your sequence classes : base_virt_seq and block_virt_seq

1 Like

It gives the same error when I use get_type or type_id at both the places.
`uvm_object_utils_begin/end is used in both the classes.

Error-[SV-EEM-SRE] Scope resolution error
test.sv, 64
sv_program_blk, "base_virt_seq::type_id"
  Target for scope resolution operator does not exist. Token 
  'base_virt_seq' is not a class/package.  Originating module 
  'sv_program_blk'.
  Check that class or package exists with referred token as the name.


Error-[SV-EEM-SRE] Scope resolution error
test.sv, 64
sv_program_blk, "block_virt_seq::type_id"
  Target for scope resolution operator does not exist. Token 
  'block_virt_seq' is not a class/package.  Originating module 
  'sv_program_blk'.
  Check that class or package exists with referred token as the name.

The error message says that classes ‘base_virt_seq’ and ‘block_virt_seq’ have not been compiled prior to compiling class ‘test’

Are get_type / type_id correct arguments to function uvm_component::set_type_override ?