Driver Code -
class d_driver extends uvm_driver #(seq_item);
`uvm_component_utils(d_driver)
virtual d_interface intf1;
function new (string name,uvm_component parent);
super.new(name,parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(!uvm_config_db#(virtual d_interface)::get(this,“”,“d_interface”,intf1))
`uvm_error(“”, “uvm_config_db::get - Failed”)
endfunction
task run_phase(uvm_phase phase);
phase.raise_objection(this);
seq_item_port.get_next_item(req);
$display(“--------------------------------- Received Item------------------------------”);
req.print();
seq_item_port.item_done();
#20;
put_data();
phase.drop_objection(this);
endtask
task put_data();
intf1.addr <= req.addr;
intf1.data <= req.data;
intf1.rd_en <= req.rd_en;
intf1.wr_en <= req.wr_en;
endtask
endclass
top code -
include "uvm_macros.svh" import uvm_pkg::*;
include “d_interface.sv”
include "d_dut.v"
include “seq_item.sv”
include "s_sequencer.sv"
include “s_sequence.sv”
include "d_driver.sv"
include “d_env.sv”
`include “d_test.sv”
module tb_top;
d_interface d1();
d_dut dut1(.intf(d1));
initial begin
uvm_config_db#(virtual d_interface)::set(null,"*","d_interface",d1);
uvm_top.finish_on_completion = 1;
run_test("d_test");
end
endmodule
Error -
** Fatal: Illegal virtual interface dereference.
I don’t think there is any error in interface file. But in case you need other file as well let me know.