Hi, I have an error injection class where i’m injecting error using callback class function. Below is the code snippet of my class.
class hs_pl_crc_ffff_for_wc_grt_0_error_callback extends svt_my_xmtr_callback;
function new(string name = "hs_pl_crc_ffff_for_wc_grt_0_error_callback");
super.new(name);
endfunction : new
/** Set the checksum value to 16'hFFFF */
function void packet_cov(svt_my_xmtr xmtr, svt_my_packet xact);
// This is a virtual function declared inside svt_my_xmtr_callback class.
xact.checksum = 16'hFFFF; // A field of my data packet.
endfunction
endclass
class hs_pl_crc_ffff_for_wc_grt_0_error extends my_base_test;
/** Instance for the callback class */
hs_pl_crc_ffff_for_wc_grt_0_error_callback error_cb;
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
// Other configurations are also set here. But not shown.
uvm_config_db#(uvm_object_wrapper)::set(this, "env.xmtr_agent.sequencer.main_phase", "default_sequence", svt_vc_interleaved_data_sequence::type_id::get());
add_check_to_demote("checksum_check",1);
endfunction
/** Function for End of elaboration phase */
virtual function void end_of_elaboration_phase(uvm_phase phase);
`uvm_info("end_of_elaboration_phase", "Entered ...", UVM_HIGH)
error_cb = new("error_cb");
super.end_of_elaboration_phase(phase);
svt_my_xmtr_callback_pool::add(env.xmtr_agent.driver,error_cb);
`uvm_info("end_of_elaboration_phase", "Exited ...", UVM_HIGH)
endfunction :end_of_elaboration_phase
endclass
Now I want to inject this error in my sequence class instead of using callback.
Any Idea please…
If anything can be done using pre_body()/post_body() tasks of my sequence, then it would be great.