diff --git a/axi_driver.sv b/axi_driver.sv new file mode 100755 index 0000000..2444e6e --- /dev/null +++ b/axi_driver.sv @@ -0,0 +1,128 @@ + + +//=============================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 + + diff --git a/axi_seq_item.sv b/axi_seq_item.sv index eee6d7b..ae9ed69 100755 --- a/axi_seq_item.sv +++ b/axi_seq_item.sv @@ -76,51 +76,3 @@ constraint wrap_data{ if(AWBURST==2'b10) endclass - - -//=============================AXI SEQUENCE CLASSS ==========================================// -class axi_wrap_sequence extends uvm_sequence #(axi_seq_item); - - `uvm_object_utills(axi_wrap_sequence) - axi_wrap_sequence wrap_xtn; - - function new(string name ="axi_wrap_sequene") - super.new(name); - endfunction - - task body(); - repeat(10) - begin - wrap_xtn=axi_seq_item::type_id::create("wrap_xtn"); - start_item(wrap_xtn); - assert(wrap_xtn.randomize() with {AWBURST==2;}); - finish_item(wrap_xtn); - end -endtask -endclass - - - - -//=============================AXI SEQUENCE CLASSS ==========================================// -class axi_wrap_read_seq extends uvm_sequence #(axi_seq_item); - - `uvm_object_utills(axi_wrap_read_seq) - axi_wrap_sequence rwrap_xtn; - - function new(string name ="axi_wrap_read_seq") - super.new(name); - endfunction - - task body(); - repeat(10) - begin - rwrap_xtn=axi_seq_item::type_id::create("rwrap_xtn"); - start_item(rwrap_xtn); - assert(rwrap_xtn.randomize() with {ARBURST==2;}); - finish_item(rwrap_xtn); - end -endtask -endclass - - diff --git a/axi_seqs.sv b/axi_seqs.sv new file mode 100755 index 0000000..42a8c7c --- /dev/null +++ b/axi_seqs.sv @@ -0,0 +1,49 @@ + + + +//=============================AXI SEQUENCE CLASSS ==========================================// +class axi_wrap_sequence extends uvm_sequence #(axi_seq_item); + + `uvm_object_utills(axi_wrap_sequence) + axi_wrap_sequence wrap_xtn; + + function new(string name ="axi_wrap_sequene") + super.new(name); + endfunction + + task body(); + repeat(10) + begin + wrap_xtn=axi_seq_item::type_id::create("wrap_xtn"); + start_item(wrap_xtn); + assert(wrap_xtn.randomize() with {AWBURST==2;}); + finish_item(wrap_xtn); + end +endtask +endclass + + + + +//=============================AXI SEQUENCE CLASSS ==========================================// +class axi_wrap_read_seq extends uvm_sequence #(axi_seq_item); + + `uvm_object_utills(axi_wrap_read_seq) + axi_wrap_sequence rwrap_xtn; + + function new(string name ="axi_wrap_read_seq") + super.new(name); + endfunction + + task body(); + repeat(10) + begin + rwrap_xtn=axi_seq_item::type_id::create("rwrap_xtn"); + start_item(rwrap_xtn); + assert(rwrap_xtn.randomize() with {ARBURST==2;}); + finish_item(rwrap_xtn); + end +endtask +endclass + + diff --git a/axi_wrap_waveform.png b/axi_wrap_waveform.png new file mode 100755 index 0000000..8425edd Binary files /dev/null and b/axi_wrap_waveform.png differ diff --git a/bmw b/bmw deleted file mode 100644 index e69de29..0000000 diff --git a/bmww b/bmww deleted file mode 100644 index e69de29..0000000