Send_request failed to cast sequence item

In reply to hellolife:

hi,
when I integrated vip and vip’s lagacy uvm testcase into testbench, met error, can you help me ? thanks.
UVM_FATAL @3.0ns: uvm_test_top.blkEnv.tester0.agent.sequencer [sequencer] send_request failed to cast sequence item.
debug information flag111 printed but flag222 not printed.
===================================================================================================
================================
class control_item extends uvm_sequence_item
class start_app_item extends control_item
================================
typedef uvm_driver #(control_item) m_driver;
class agent extends uvm_agent;
uvm_sequencer #(control_item) sequencer;
m_driver driver;

function new(string name = “agent”, uvm_component parent =null);
super.new(name,parent);
endfunction

endclass
class my_sequence extends uvm_sequence #(control_item);

extern virtual task body();

endclass
task body();

start_app_item app_item;
$cast(app_item,create_item(app_item.get_type(),m_sequencer,“app_item”));
start_item(app_item);
$display(“======flag111======”);
finish_item(app_item);
$display(“======flag222======”);

endtask

You have 2 weaknesses in your code:
(1) your driver is not simply a typedef of the uvm_driver, parameterized for yor the corresponding seq_item.
(2) You should construct you r seq_irem by using the type_id::create of the factory like this:

app_item = start_app_item::type_id::create("app_item");