I'm trying to override a sequence by instance. An example code will describe it best:
class my_vir_seq extends base_vir_seq;
my_seq_c seq1, seq2;
`uvm_object_utils_begin(my_vir_seq)
`uvm_field_object(seq1, UVM_ALL_ON)
`uvm_field_object(seq2, UVM_ALL_ON)
`uvm_object_utils_end
`uvm_declare_p_sequencer(v_seqr)
function new(string name = "my_vir_seq");
super.new(name);
endfunction // new
virtual task body();
`uvm_do_on(seq1, p_sequencer.my_seqr)
`uvm_do_on(seq2, p_sequencer.my_seqr)
endtask // body
endclass
class my_err_vir_seq extends my_vir_seq;
my_err_seq_c seq3;
`uvm_object_utils_begin(my_err_vir_seq)
`uvm_field_object(seq3, UVM_ALL_ON)
`uvm_object_utils_end
`uvm_declare_p_sequencer(v_seqr)
function new(string name = "my_err_vir_seq");
super.new(name);
my_seq_c::type_id::set_inst_override(my_err_seq_c::get_type(), "sve.v_seqr.my_err_vir_seq.seq2" );
endfunction // new
endclass
My aim is to only override seq2
with seq3
(its type extends seq2
's type).
I don't get any errors, but the original sequence runs,
What am I doing wrong?
Thanks in advance,
Izhar
Doing type overrides by instance is (I think) conceptually intended for instances of classes that derive from
uvm_component
, because they have a specific hierarchical path.There is a trick to do it for sequences as well, using the sequencer's path as an argument to
set_inst_override(...)
(kind of what you tried). You need to do a few changes to your sequence to support this, though. When creatingseq1
andseq2
you have to give them a context (shown only forseq2
) so that the factory can find them:After you created your sequence, you can start it using
start(...)
:The idea is from a DVCon 2013 paper that you can find here: DVCon 2013 paper