|
@@ -0,0 +1,124 @@ |
|
|
|
|
|
class axi_drv extends uvm_driver#(axi_trans);
|
|
|
|
|
|
|
|
|
|
|
|
`uvm_component_utils(axi_drv)
|
|
|
|
|
|
virtual axi_if vif;
|
|
|
|
|
|
axi_trans tnx;
|
|
|
|
|
|
|
|
|
|
|
|
function new(string name="axi_drv",uvm_component parent);
|
|
|
|
|
|
super.new(name,parent);
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function void build_phase(uvm_phase phase);
|
|
|
|
|
|
super.build_phase(phase);
|
|
|
|
|
|
if(!uvm_config_db#(virtual axi_if)::get(this,"","vif",vif))
|
|
|
|
|
|
`uvm_error("build_phase","driver virtual interface failed");
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
task run_phase(uvm_phase phase);
|
|
|
|
|
|
`uvm_info("UVM_DRIVER",$sformatf("driver main phase ended"),UVM_LOW);
|
|
|
|
|
|
forever
|
|
|
|
|
|
begin
|
|
|
|
|
|
seq_item_port.get_next_item(tnx);
|
|
|
|
|
|
drive(tnx);
|
|
|
|
|
|
seq_item_port.item_done();
|
|
|
|
|
|
end
|
|
|
|
|
|
endtask
|
|
|
|
|
|
task driver();
|
|
|
|
|
|
begin
|
|
|
|
|
|
axi_write_address();
|
|
|
|
|
|
axi_write_data();
|
|
|
|
|
|
axi_write_resp();
|
|
|
|
|
|
axi_read_address();
|
|
|
|
|
|
axi_read_data();
|
|
|
|
|
|
end
|
|
|
|
|
|
endtask
|
|
|
|
|
|
task axi_write_addr(axi_trans txn);
|
|
|
|
|
|
$display("start of drive_awaddr");
|
|
|
|
|
|
vif.drv_cb.AWVALID <= 1;
|
|
|
|
|
|
vif.drv_cb.AWADDR <= txn.AWADDR;
|
|
|
|
|
|
vif.drv_cb.AWSIZE <= txn.AWSIZE;
|
|
|
|
|
|
vif.drv_cb.AWID <= txn.AWID;
|
|
|
|
|
|
vif.drv_cb.AWLEN <= txn.AWLEN;
|
|
|
|
|
|
vif.drv_cb.AWBURST <= txn.AWBURST;
|
|
|
|
|
|
|
|
|
|
|
|
@(vif.drv_cb);
|
|
|
|
|
|
wait(vif.drv_cb.AWREADY)
|
|
|
|
|
|
vif.drv_cb.AWVALID <= 0;
|
|
|
|
|
|
|
|
|
|
|
|
repeat
|
|
|
|
|
|
@(vif.drv_cb);
|
|
|
|
|
|
|
|
|
|
|
|
$display("end of drive_awaddr");
|
|
|
|
|
|
endtask
|
|
|
|
|
|
task axi_write_data(axi_trans txn);
|
|
|
|
|
|
|
|
|
|
|
|
$display("start of drive_wdata");
|
|
|
|
|
|
foreach(txn.WDATA[i])
|
|
|
|
|
|
begin
|
|
|
|
|
|
vif.drv_cb.WVALID <= 1;
|
|
|
|
|
|
vif.drv_cb.WDATA <= txn.WDATA[i];
|
|
|
|
|
|
vif.drv_cb.WSTRB <= txn.WSTRB[i];
|
|
|
|
|
|
vif.drv_cb.WID <= txn.WID;
|
|
|
|
|
|
if(i==(txn.AWLEN))
|
|
|
|
|
|
vif.drv_cb.WLAST <= 1;
|
|
|
|
|
|
else
|
|
|
|
|
|
vif.drv_cb.WLAST <= 0;
|
|
|
|
|
|
|
|
|
|
|
|
@(vif.drv_cb);
|
|
|
|
|
|
wait(vif.drv_cb.WREADY)
|
|
|
|
|
|
vif.drv_cb.WVALID <= 0;
|
|
|
|
|
|
vif.drv_cb.WLAST <= 0;
|
|
|
|
|
|
|
|
|
|
|
|
repeat
|
|
|
|
|
|
@(vif.drv_cb);
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
$display("end of drive_wdata");
|
|
|
|
|
|
endtask
|
|
|
|
|
|
|
|
|
|
|
|
task axi_write_resp(axi_trans txn);
|
|
|
|
|
|
|
|
|
|
|
|
$display("start of drive_bresp");
|
|
|
|
|
|
foreach(tnx.)
|
|
|
|
|
|
vif.drv_cb.BREADY<=1;
|
|
|
|
|
|
@(vif.drv_cb)
|
|
|
|
|
|
wait(vif.drv_cb.BVALID)
|
|
|
|
|
|
vif.drv_cb.BREADY<=0;
|
|
|
|
|
|
repeat
|
|
|
|
|
|
@(vif.drv_cb);
|
|
|
|
|
|
$display("end of drive_bresp");
|
|
|
|
|
|
endtask
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* task drive(axi_trans trans);
|
|
|
|
|
|
begin
|
|
|
|
|
|
`uvm_info("UVM_DRIVER",$sformatf("driver run driver task entered"),UVM_LOW);
|
|
|
|
|
|
@(this.vif.drv_cb);
|
|
|
|
|
|
|
|
|
|
|
|
`uvm_info("UVM_DRIVER",$sformatf("driver run drive task ended"),UVM_LOW);
|
|
|
|
|
|
end
|
|
|
|
|
|
endtask
|
|
|
|
|
|
endclass*/
|