class alu_driver extends uvm_driver #(alu_seq_item);
`uvm_component_utils(alu_driver)
virtual alu_interface vif;
alu_seq_item seq;
//---------------------------------------------------------------
//Constructor
//---------------------------------------------------------------
function new(string name="alu_driver",uvm_component parent=null);
super.new(name,parent);
`uvm_info("alu_driver","Inside Constructors!",UVM_HIGH)
endfunction : new
//---------------------------------------------------------------
//build_phase
//---------------------------------------------------------------
function void build_phase(uvm_phase phase);
super.build_phase(phase);
`uvm_info("alu_driver","Build Phase!",UVM_HIGH)
if(!(uvm_config_db #(virtual alu_interface)::get(this,"*","vif",vif)))
begin
`uvm_error("alu_driver", "Failed to get Virtual Interface from config_db!")
end
endfunction : build_phase
//---------------------------------------------------------------
//connect_phase
//---------------------------------------------------------------
function void connect_phase(uvm_phase phase);
// super.build_phase(phase);
`uvm_info("alu_driver","Connect Phase!",UVM_HIGH)
endfunction : connect_phase
//---------------------------------------------------------------
//run_phase
//---------------------------------------------------------------
task run_phase(uvm_phase phase);
`uvm_info("alu_driver","Inside Run Phase!",UVM_HIGH)
forever
begin
seq=alu_seq_item::type_id::create("seq");
seq_item_port.get_next_item(seq);
drive(seq);
seq_item_port.item_done();
end
endtask : run_phase
//---------------------------------------------------------------
//drive
//---------------------------------------------------------------
task drive(alu_seq_item seq);
@(posedge vif.clk);
vif.reset <= seq.reset;
vif.A <= seq.A;
vif.B <= seq.B;
vif.alu_sel <= seq.alu_sel;
endtask : drive
endclass : alu_driver
In reply to pwe_pwe:
Are you facing uvm_error or not ?
For config_db 1st check that you set the interface in appropriate way or not.
In reply to pwe_pwe:
Please share the code foruvm_config_db#(virtual alu_interface)::set
Also note that creation of the alu_seq_item in the driver isn’t required.
Your sequence would be creating the alu_seq_item and send it via the sequencer to the driver ( on calling: seq_item_port.get_next_item(seq); )(