In reply to dave_59:
In reply to peter:
Your problem is you extended uvm_driver without specifying a parameter (mem_seq_item) for REQ.
Thanks Dave, i fixed the code. it worked! But , addr ,wr_en, rd_en, wdata ,rdata are unknown,
i used req.randomize() in body task. why the addr,wr_en, rd_en, wdata ,rdata can not be randomized?
Here is new driver code
`define DRIV_IF pointer_to_interface.DRIVER.driver_cb
class mem_driver extends uvm_driver #(mem_seq_item);
`uvm_component_utils(mem_driver);
virtual mem_if pointer_to_interface;
function new (string name, 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 #(virtual mem_if)::get(null, "*","pointer_to_interface", pointer_to_interface))
$fatal("Failed to get BFM");
endfunction : build_phase
task run_phase(uvm_phase phase);
phase.raise_objection(this);
forever begin
seq_item_port.get_next_item(req);
drive();
seq_item_port.item_done();
end
phase.drop_objection(this);
endtask : run_phase
virtual task drive();
`DRIV_IF.wr_en <= 0;
`DRIV_IF.rd_en <= 0;
@(posedge pointer_to_interface.DRIVER.clk);
`DRIV_IF.addr <= req.addr;
if(req.wr_en) begin
`DRIV_IF.wr_en <= req.wr_en;
`DRIV_IF.wdata <= req.wdata;
@(posedge pointer_to_interface.DRIVER.clk);
//end
if(req.rd_en) begin
`DRIV_IF.rd_en <= req.rd_en;
@(posedge pointer_to_interface.DRIVER.clk);
`DRIV_IF.rd_en <= 0;
@(posedge pointer_to_interface.DRIVER.clk);
req.rdata = `DRIV_IF.rdata;
end
endtask : drive
endclass