I am trying to use ovm_do in the body task of my sequence to create a packet object but everytime i get the following error :-
Error-[DCF] Dynamic cast failed
dri_seq.sv, 205
Casting of source class type ‘ovm_sequence_item’ to destination class type
‘my_packet’ failed due to type mismatch.
Please ensure matching types for dynamic cast
my packet type of object is derived from ovm_sequence_item so i dont know what i am missing here.
here’s the snippet from my sequence :-
class err_crc extends ovm_sequence;
`ovm_object_utils(err_crc)
rand int xy;
constraint ra {xy inside {0,1};}
function new (string name = “err_crc”);
super.new(name);
endfunction
my_packet pkt;
virtual task body();
$display("Hello , Sending packets with CRC error ",$time);
`ovm_do(pkt)
here’s my env :-
class my_env extends ovm_component;
my_driver _driver;
err_crc _crc_seq;
// bad_seq_no bad_seq;
//ovm_sequencer #(simple_item) main_seq;
my_sequencer my_seq;
`ovm_component_utils(my_env);
function new (string name,ovm_component parent = null);
super.new(name,parent);
endfunction
virtual function void build();
super.build();
_crc_seq = err_crc::type_id::create("_crc_seq",this);
_driver = my_driver::type_id::create("_driver",this);
my_seq = my_sequencer::type_id::create("my_seq",this);
endfunction:build
virtual function void connect();
_driver.seq_item_port.connect(my_seq.seq_item_export);
endfunction:connect
task run();
$display(“Hello , I am in Environment’s super.run”,$time);
_crc_seq.start(my_seq);
global_stop_request();
//super.run();
endtask:run
endclass:my_env
Can somebody suggest what i am missing here ?
Thanks
vikram