Hello,
Please find the code snippets for sequencer and sequence I am using
class my_sequencer extends uvm_sequencer#(my_packet);
`uvm_component_utils(my_sequencer)
my_uvc_cfg uvc_cfg;
function new(string name = “my_sequencer”, uvm_component parent);
super.new(name,parent);
endfunction : new
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(!uvm_config_db#(my_uvc_cfg)::get(this,“*”,“uvc_cfg”,uvc_cfg)) begin
`uvm_fatal(get_type_name(),“I am not able to get uvc_cfg handle”);
end
endfunction : build_phase
endclass : my_sequencer
class my_base_sequence extends uvm_sequence#(my_packet);
my_packet pkt;
uvm_object_utils(my_base_sequence)
uvm_declare_p_sequencer(my_sequencer)
function new(string name = “my_base_sequence”);
super.new(name);
endfunction : new
task body();
//create packet
//give some value
//send packet to driver
endtask
endclass : my_base_sequence
//In my agent I have created handle for my_sequencer
//In my env I have created agent handle
//In my test I created handle for my_base_sequence
//Now from run_phase of test I started my_base_sequence
my_base_sequence_handle.start(env.agent.my_sequencer_handle);
What uvm_warning and uvm_fatal I am getting is shown below
UVM_WARNING @ 0: reporter [TPRGED] Type name ‘my_sequencer’ already registered with factory. No string based look up support for multiple types with the same type name.
UVM_WARNING @ 0: reporter [TPRGED] Type name ‘my_uvc_cfg’ already registered with factory. No string based look up support for multiple types with the same type name.
//Then from the run_phase of test I got the below FATAL
UVM_FATAL /file_name @ 0: uvm_test_top.env.agent.my_sequencer_handle@@my_base_sequence_handle [DCLPSQ] my_pkg::my_base_sequence.m_set_p_sequencer uvm_test_top.env.agent.my_sequencer_handle.my_base_sequence_handle Error casting p_sequencer, please verify that this sequence/sequence item is intended to execute on this type of sequencer
//Interestingly if I remove `uvm_declare_p_sequencer(my_sequencer) from sequence this warnings and fatal error gets removed!! But I really require this declaration as I later may added few variables inside sequencer so that someone can update it and my sequence can use this
Can someone help me what went wrong here