# UVM\_FATAL ----\> send\_request failed to cast sequence item

**URL:** <https://verificationacademy.com/forums/t/uvm-fatal-send-request-failed-to-cast-sequence-item/30958>\
**Category:** UVM\
**Tags:** UVM, virtual-sequence\
**Created:** [August 18, 2015, 10:30am UTC](https://verificationacademy.com/forums/t/uvm-fatal-send-request-failed-to-cast-sequence-item/30958 "2015-08-18T10:30:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![piyushpatel40](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/p/d78d45/32.png) [@piyushpatel40](https://verificationacademy.com/forums/u/piyushpatel40)\
**Post date:** [August 18, 2015, 10:30am UTC](https://verificationacademy.com/forums/t/uvm-fatal-send-request-failed-to-cast-sequence-item/30958/1 "2015-08-18T10:30:09Z")

</div>

i am creating a virtual sequence and calling from a test case but, getting fatal error in simulation as below:  
UVM\_FATAL @ 10: uvm\_test\_top.h\_env.agn2.m\_sequencer [m\_sequencer] send\_request failed to cast sequence item

please, let me know what am i doing wrong ?

for the following code:

```verilog
/////////////////////////////////////////////////////////
////////// Virtual sequence base class //////////////////
/////////////////////////////////////////////////////////
class axi_virtual_base extends uvm_sequence #(uvm_sequence_item) ;
	
	`uvm_object_utils(axi_virtual_base)
	
	uvm_sequencer #(axi_packet) m_seqr ;
	uvm_sequencer #(axi_slave_packet) s_seqr ;

	function new(string name = "axi_virtual_base") ;
		super.new(name) ;
	endfunction	
endclass : axi_virtual_base

///////////////////////////////////////////////////////////////////////////////////////////
/////////////// virtual sequence class extended from virtual sequence base class //////////
///////////////////////////////////////////////////////////////////////////////////////////
class axi_virtual_sequence extends axi_virtual_base ;
	
	`uvm_object_utils(axi_virtual_sequence)
	
	function new(string name = "axi_virtual_sequence");
		super.new(name);
	endfunction
	
	axi_master_sequence_reset ms_reset ;
	axi_slave_sequence_reset ss_reset ;
	
	task body() ;
		ms_reset = axi_master_sequence_reset::type_id::create("ms_reset") ;
		ss_reset = axi_slave_sequence_reset::type_id::create("ss_reset") ;
		fork
			ms_reset.start(m_seqr) ; // NEED
			ss_reset.start(s_seqr) ; // HELP HERE
			$display ("@time -> %0t in virtual test case fork-join",$time) ; // THE SIMULATION STOPS WITH THE ABOVE MENTION FATAL ERROR.
		join
		$display ("@time -> %0t out from fork-join",$time) ;
	endtask : body

endclass : axi_virtual_sequence

/////////////////////////////////////////////
/////////// base test code //////////////////
/////////////////////////////////////////////
class axi_test_base extends uvm_test;

	`uvm_component_utils(axi_test_base)

	axi_environment h_env ;
	
	function new(string name = "axi_test_base", uvm_component parent = null);
		super.new(name, parent);
	endfunction
	
	function void build_phase(uvm_phase phase);
		super.build_phase(phase) ;
		h_env = axi_environment::type_id::create("h_env",this) ;
	endfunction : build_phase
	
        /////// initialization of sequencer handles ///////////
	virtual function void init_vseq(axi_virtual_base avb) ;
			avb.m_seqr = h_env.agn1.m_sequencer ;
			avb.s_seqr = h_env.agn2.m_sequencer ;
	endfunction : init_vseq
	
        ///////// base run phase is empty ////////////////////
	virtual task run_phase(uvm_phase phase) ;
		uvm_report_info(get_full_name(),"run",UVM_LOW) ;
    	
		phase.raise_objection(this) ;

		phase.drop_objection(this) ;
		
	endtask : run_phase

endclass : axi_test_base

////////////////////////////////////////////////////////////////////////////
//////////////// test case extended from base test - reset /////////////////
////////////////////////////////////////////////////////////////////////////
class axi_test_case_reset extends axi_test_base ;

	`uvm_component_utils(axi_test_case_reset)
	
	axi_virtual_sequence avs ;
	
	function new(string name = "axi_test_case_reset", uvm_component parent = null) ;
		super.new(name, parent) ;
	endfunction
	
	task run_phase(uvm_phase phase) ;

		uvm_report_info(get_full_name(),"run",UVM_LOW) ;

		avs = axi_virtual_sequence::type_id::create("avs") ;

		phase.raise_objection(this) ;
			init_vseq(avs) ; ////// calling initialization function in base test ///////
			avs.start(null) ; ////// starting the virtual sequence ////////
		phase.drop_objection(this) ;
	endtask : run_phase

endclass : axi_test_case_reset

```

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [August 18, 2015, 3:37pm UTC](https://verificationacademy.com/forums/t/uvm-fatal-send-request-failed-to-cast-sequence-item/30958/2 "2015-08-18T15:37:11Z")

</div>

Not enough code shown to help you. You need to double-check that all classes involved in the flow of the sequence\_item are parameterized correctly, and the uvm\_objects\_utils have the correct class name. (in drivers, sequencers, agents).

Also, when you start a sequence in a virtual sequence, set the parent argument to ‘this’;

---

<div class="post-metadata">

**Author:** ![piyushpatel40](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/p/d78d45/32.png) [@piyushpatel40](https://verificationacademy.com/forums/u/piyushpatel40)\
**Post date:** [August 18, 2015, 6:29pm UTC](https://verificationacademy.com/forums/t/uvm-fatal-send-request-failed-to-cast-sequence-item/30958/3 "2015-08-18T18:29:53Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/uvm-fatal-send-request-failed-to-cast-sequence-item/30958/2):_

here are some of master side codes, hope this helps →

```verilog

//-------------------------------------------------------------------------------------//
// The reset sequence //
//-------------------------------------------------------------------------------------//
class axi_master_sequence_reset extends uvm_sequence #(axi_packet);

	`uvm_object_utils(axi_master_sequence_reset)
	
	function new(string name = "axi_master_sequence_reset");
		super.new(name);
	endfunction
	
	virtual task body();
		axi_packet pkt_reset;
		pkt_reset = axi_packet::type_id::create("pkt_reset");
		start_item(pkt_reset);
			assert(pkt_reset.randomize() 
				with
					{	
						ARESETn == 0 ;
					});
		finish_item(pkt_reset) ;
	endtask : body

endclass : axi_master_sequence_reset

//-------------------------------------------------------------------------------------//
// The master axi agent //
//-------------------------------------------------------------------------------------//
class axi_master_agent extends uvm_agent ;
	
	`uvm_component_utils(axi_master_agent)
	
	axi_master_driver drv ;
	axi_master_monitor mon ;
	
        /////// HERE IS PARAMETERIZED SEQUENCER //////
	uvm_sequencer #(axi_packet) m_sequencer ;
	
	uvm_analysis_port #(axi_packet) aport ;
	
	function new(string name, uvm_component parent) ;
		super.new(name, parent) ;
	endfunction
	
	function void build_phase(uvm_phase phase) ;
		aport = new("aport", this) ;
		drv = axi_master_driver::type_id::create("drv", this) ;
		mon = axi_master_monitor::type_id::create("mon", this) ;

                ///////////////////// CREATING THE SEQUENCER /////////////////////////////
		m_sequencer = uvm_sequencer #(axi_packet)::type_id::create("m_sequencer", this) ;
	endfunction : build_phase
	
	function void connect_phase(uvm_phase phase) ;
		///////////// sending through m_sequencer ///////////////
		drv.seq_item_port.connect(m_sequencer.seq_item_export) ;

		// this is pass through type analysis port implementation
		mon.aport.connect(aport);
	endfunction : connect_phase

endclass : axi_master_agent

///////////////////////////////////////////////////////////////////////////////
// Class axi_master_driver: this class contains bus functional model for AXI (master side)
///////////////////////////////////////////////////////////////////////////////
class axi_master_driver extends uvm_driver #(axi_packet);

	`uvm_component_utils(axi_master_driver)
	
	virtual axi_master_interface axi_inf ;

        function new(string name, uvm_component parent);
		super.new(name, parent);
	endfunction
	
	function void build_phase(uvm_phase phase) ;
	  uvm_config_db #(virtual axi_master_interface)::get(this,"","axi_ms",axi_inf) ;
        endfunction : build_phase

        virtual task run_phase(uvm_phase phase);

          //////..............some statements..... /////
          @(posedge axi_inf.ACLK);

        	seq_item_port.get_next_item(n_pkt);
                 //////..............some statements..... /////

		`uvm_info("master_driver_run_phase", n_pkt.sprint(), UVM_MEDIUM)
                 //////..............some statements..... /////

                 seq_item_port.item_done()

        endtask : run_phase

           //////.............. rest of the BFM ..... /////

endclass : axi_master_driver

```

---

<div class="post-metadata">

**Author:** ![piyushpatel40](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/p/d78d45/32.png) [@piyushpatel40](https://verificationacademy.com/forums/u/piyushpatel40)\
**Post date:** [August 19, 2015, 9:59am UTC](https://verificationacademy.com/forums/t/uvm-fatal-send-request-failed-to-cast-sequence-item/30958/4 "2015-08-19T09:59:02Z")

</div>

_In reply to [piyushpatel40](https://verificationacademy.com/forums/t/uvm-fatal-send-request-failed-to-cast-sequence-item/30958/3):_

hey !  
thanks Dave, double checked every thing and found the mistake, silly mistake though:

in the packet class one of the variable was not declared as rand → and i was randomizing the packet handle in the sequence class → and running this in the virtual sequence causes the cast error during simulation.
