Sequence overriding in factory

I am trying to override my interface sequence (Seq1) with extended sequence of that (Seq2) in extended top level sequence (topSeq1). But my testcase is hanging, i.e. raised objections in topSeq is not dropping. Here is what I am trying.

class topSeq extends uvm_sequence;

virtual task pre_body();
raise_objection;
endtask

virtual task body();
repeat(10) begin
seq1=type::type_id::create(); //create base interface sequence
seq1.start(topseqr.iseqr);
end
endtask

virtual task post_body();
drop_objection;
endtask

endclass

class topSeq1 extends topSeq;

virtual task pre_body();
super.pre_body();
seq1::type_id::set_type_override(seq2::get_type(),1); //from this seq, i am trying to override seq1 with seq2
//factory.set_override_type_by_type(seq1::get_type(),seq2::get_type()); //this too is not working
endtask

virtual task body();
//do some process
endtask

endclass

In reply to sridar:

Hi Sridhar,

Not sure about your code, but you can override the sequences/components from your test buildphase.

Thanks,
Vikas Billa

In reply to vikasbilla:

There was actuall another file with the name TopSeq1 which got compiled first and it had some issues. Now, when I rename TopSeq1 to other name, override is happening now

In reply to sridar:

Just a comment that you should never raise or drop objections from a sequence. The reason for this is because pre_body() and post_body() aren’t always called, resulting in difficulties re-using your sequence library. Additionally, you can incur some performance penalties when running a large number of sequences.

Instead, you should only raise and drop objections from your tests.