|
-
-
- //=============================AXI DRIVER CLASS====================================//
- class axi_driver extends uvm_driver;
- `uvm_component_utils(axi_driver)
-
- virtual axi_if.DRV_MP mif;
- axi_config axi_cfg;
- axi_xtn xtn;
-
- function new(string name="axi_driver", uvm_component parent);
- super.new(name,parent);
- endfunction
-
- function void build_phase(uvm_phase phase);
- if(!uvm_config_db#(axi_config)::get(this,"","axi_config",axi_cfg))
- `uvm_fatal(get_type_name(),"cannot get the configuration database have you set it?")
- endfunction
-
- function void connect_phase(uvm_phase phase)
- axi_cfg.vif=vif;
- endfunction
-
- task run_phase(uvm_phase phase);
- forever
- begin
- seq_item_port.get_next_item(xtn);
- driver(xtn);
- seq_item_port.item_done();
- end
- endtask
-
-
- task driver();
- if(xtn.write==1)
-
- begin
- axi_write_address();
- axi_write_data();
- axi_write_resp();
- end
- else
- begin
- axi_read_address();
- axi_read_data();
- end
-
- endtask
-
- task axi_write_addr(axi_xtn xtn);
- $display("start of drive_awaddr");
- mif.mst_drv_cb.AWVALID <= 1;
- mif.mst_drv_cb.AWADDR <= xtn.AWADDR;
- mif.mst_drv_cb.AWSIZE <= xtn.AWSIZE;
- mif.mst_drv_cb.AWID <= xtn.AWID;
- mif.mst_drv_cb.AWLEN <= xtn.AWLEN;
- mif.mst_drv_cb.AWBURST <= xtn.AWBURST;
-
- @(mif.mst_drv_cb);
- wait(mif.mst_drv_cb.AWREADY)
- mif.mst_drv_cb.AWVALID <= 0;
-
- repeat($urandom_range(1,5))
- @(mif.mst_drv_cb);
-
- $display("end of drive_awaddr");
- endtask
-
- task axi_write_data(axi_xtn xtn);
-
- $display("start of drive_wdata");
- foreach(xtn.WDATA[i])
- begin
- mif.drv_cb.WVALID <= 1;
- mif.drv_cb.WDATA <= xtn.WDATA[i];
- mif.drv_cb.WSTRB <= xtn.WSTRB[i];
- mif.drv_cb.WID <= xtn.WID;
- if(i==(xtn.AWLEN))
- mif.drv_cb.WLAST <= 1;
- else
- mif.drv_cb.WLAST <= 0;
-
- @(mif.drv_cb);
- wait(mif.drv_cb.WREADY)
- mif.drv_cb.WVALID <= 0;
- mif.drv_cb.WLAST <= 0;
-
- repeat($urandom_range(1,5))
- @(mif.drv_cb);
- end
-
- $display("end of drive_wdata");
- endtask
-
- task axi_write_resp(axi_xtn xtn);
- $display("start of drive_bresp");
- mif.drv_cb.BREADY<=1;
- @(mif.drv_cb)
- wait(mif.drv_cb.BVALID)
- mif.drv_cb.BREADY<=0;
- repeat($urandom_range(1,5))
- @(mif.drv_cb);
- $display("end of drive_bresp");
- endtask
-
- task axi_read_addr(axi_xtn xtn);
- $display("start of drive_raddr");
- repeat($urandom_range(1,3))
- @(mif.drv_cb);
- mif.drv_cb.ARID<=xtn.ARID;
- mif.drv_cb.ARLEN<=xtn.ARLEN;
- mif.drv_cb.ARSIZE<=xtn.ARSIZE;
- mif.drv_cb.ARBURST<=xtn.ARBURST;
- mif.drv_cb.ARADDR<=xtn.ARADDR;
- mif.drv_cb.ARVALID<=1;
- @(mif.drv_cb);
- $display("inside drive_read_addr before wait ARREADY");
- wait(mif.drv_cb.ARREADY)
- mif.drv_cb.ARVALID<=0;
- repeat($urandom_range(1,5))
- @(mif.drv_cb);
-
- $display("end of drive_raddr");
-
- endtask
- endclass
-
-
|