Hi Team.,
I have doubt that why we need not to create an transaction type handle which we will pass in get_next_item in driver.
Ex:-
class my_driver extends uvm_driver#(my_txn);
`uvm_component_utils(my_driver);
function new(string name = "my_driver", uvm_component parent = null);
super.new(name, parent);
endfunction: new
my_txn txn;
virtual my_interface vif;
extern virtual function void build_phase(uvm_phase phase);
extern virtual task run_phase(uvm_phase phase);
endclass: my_driver
function void my_driver::build_phase(uvm_phase phase);
super.build_phase(phase);
// txn = my_txn::type_id::create("txn"); //**Need not to create transaction.**
if(!uvm_config_db#(virtual my_interface)::get(this,"","my_intrf", vif))
begin
`uvm_fatal("my_driver001","Can not get vif in my_driver");
end
endfunction:build_phase
task my_driver::run_phase(uvm_phase phase);
forever
begin
seq_item_port.get_next_item(txn); //**But we are passing the txn handle without creating txn.**
@(vif.driver_cb)
begin
if(vif.reset ==1)
begin
@(vif.driver_cb);
end
else
begin
if(txn.sel == 0)
begin
`uvm_info(get_full_name(),$sformatf("Do not have any read transaction"),UVM_NONE);
end
else
begin
vif.driver_mp.driver_cb.addr <= txn.addr;
vif.driver_mp.driver_cb.wdata <= txn.data;
vif.driver_mp.driver_cb.sel <= txn.sel;
end
end
end
seq_item_port.item_done();
end
endtask: run_phase