Explorar el Código

axi_seqs.sv

main
prasad_madala hace 6 meses
padre
commit
c8e81e1123
Se han modificado 6 ficheros con 177 adiciones y 48 borrados
  1. +128
    -0
      axi_driver.sv
  2. +0
    -48
      axi_seq_item.sv
  3. +49
    -0
      axi_seqs.sv
  4. BIN
      axi_wrap_waveform.png
  5. +0
    -0
      bmw
  6. +0
    -0
      bmww

+ 128
- 0
axi_driver.sv Ver fichero

@@ -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

+ 0
- 48
axi_seq_item.sv Ver fichero

@@ -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

+ 49
- 0
axi_seqs.sv Ver fichero

@@ -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

BIN
axi_wrap_waveform.png Ver fichero

Antes Después
Anchura: 1920  |  Altura: 1080  |  Tamaño: 572 KiB

+ 0
- 0
bmw Ver fichero


+ 0
- 0
bmww Ver fichero


Cargando…
Cancelar
Guardar