function void build();
ovm_factory f;
f=ovm_factory::get();
f.set_type_override_by_name("sequence_1","sequence_2");
endfunction //coded in Test Build function
I have tried overriding the above sequence1 by sequence2. But once the test runs it not happening. Still my sequence1 is being used by the subsequences. please give me a solution. I am new to writing test cases
// sequence_1 is coded in a separate package,eg ., apb_seq_pkg as follows,
class sequence_1 extends apb_seq_pkg::apb_base_seq;
`ovm_sequence_utils(sequence_1, ovm_sequencer)
// sequence_2 is coded below the test itself,
function void build(); //part of test build function alone
ovm_factory f;
f=ovm_factory::get();
f.set_type_override_by_name(“sequence_1”,“sequence_2”);
endfunction
class sequence_2 extends apb_seq_pkg::sequence_1;
`ovm_sequence_utils(sequence_2, ovm_sequencer)
function new();
super.new();
endfunction
task body();
// write_reg(data,status,reg_name,dev_name); //basically i need to disable this write so i am trying to do sequence override. The apb_seq_pkg(sequence_1) is a softlink so i need to do overrride from test only to disable the write. The sequence is called in subsequence through the test.
endtask
function void print_cfg();
endfunction
endclass
This is not working for me. The register write is happening anyway. please help me on this. I am new to ovm.
// sequence_1 is coded in a separate package,eg ., apb_seq_pkg as follows,
class sequence_1 extends apb_seq_pkg::apb_base_seq;
`ovm_sequence_utils(sequence_1, ovm_sequencer)
// sequence_2 is coded below the test itself,
function void build(); //part of test build function alone
ovm_factory f;
f=ovm_factory::get();
f.set_type_override_by_name(“sequence_1”,“sequence_2”);
endfunction
class sequence_2 extends apb_seq_pkg::sequence_1;
`ovm_sequence_utils(sequence_2, ovm_sequencer)
function new();
super.new();
endfunction
task body();
// write_reg(data,status,reg_name,dev_name); //basically i need to disable this write so i am trying to do sequence override. The apb_seq_pkg(sequence_1) is a softlink so i need to do overrride from test only to disable the write. The sequence is called in subsequence through the test.
endtask
function void print_cfg();
endfunction
endclass
This is not working for me. The register write is happening anyway. please help me on this. I am new to ov
You just posted the exact same code as your original question, the declarations for sequence_1 and _2. Where do you call the constructor before starting the sequence? Are you calling new() instead of create()?
In reply to dave_59:
Yes i understand now what you were asking before,
i have used `ovm_do_with(sequence_1, { m_write==local::m_write}); to call the sequence_1 in another sequence named mptb_ack_seq.
But I am not using new() or create() here instead i am directly calling this(ovm_do_with) without registering to the factory. So basically i am not registering the object in the factory. That is reason i am not able to override the sequence from my test. Correct me if i am wrong.