manojkumar пре 8 месеци
родитељ
комит
1fdf535aaf
3 измењених фајлова са 134 додато и 0 уклоњено
  1. +28
    -0
      axi_agent.sv
  2. +98
    -0
      axi_monitor.sv
  3. +8
    -0
      axi_sqr.sv

+ 28
- 0
axi_agent.sv Прегледај датотеку

@@ -0,0 +1,28 @@
`include "uvm_macros.svh"
import uvm_pkg::*;
class axi_m_Agent extends uvm_agent;
`uvm_component_utils(axi_m_Agent);
AXI_SLAVE_SEQR seq;
AXI_SLAVE_DRV drv;
AXI_SLAVE_MON mon;
function new(string name = "axi_m_Agent", uvm_component parent);
super.new(name, parent);
endfunction :
function void build_phase(uvm_phase phase);
super.build_phase(phase);
seq = AXI_SLAVE_SEQR::type_id::create("seq", this);
drv = AXI_SLAVE_DRV::type_id::create("drv", this);
mon = AXI_SLAVE_MON::type_id::create("mon", this);
endfunction : build_phase
function void connect_phase(uvm_phase phase);
drv.seq_item_port.connect(seq.seq_item_export);
endfunction : connect_phase
endclass

+ 98
- 0
axi_monitor.sv Прегледај датотеку

@@ -0,0 +1,98 @@
`include "uvm_macros.svh"
import uvm_pkg::*;
class axi_mon1 extends uvm_monitor;
`uvm_component_utils axi_mon1;
virtual axi_slave_if mon_avif;
uvm_analysis_port #(axi_txn) a_mon_ap;
axi_txn w_trans;
axi_txn r_trans;
function new(string name axi_mon1",uvm_component parent =null);
super.new(name, parent);
// w_done =1;
//r_done =1;
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
`uvm_info("monitor","build_phase",UVM_MEDIUM)
a_mon_ap=new("a_mon_ap",this);
w_trans= axi_txn :: type_id :: create("axi_mon_txn");
r_trans= axi_txn :: typeid :: create(" r_trans");
endfunction:build_phase
task run_phase(uvm_phase phase);
forever begin
// run_mon(phase);
//@(mon_avif.clk);
fork
begin
write_monitor();
read_monitor();
end
join_none
end
endtask: run_phase
/* task run_mon(uvm_phase phase);
fork
if(w_done) begin
phase.raise_objection(this);
w_done=0;
write_monitor();
w_done=1;
phase.drop_objection(this);
end
if(r_done) begin
phase.raise_objection(this);
r_done=0;
read_monitor();
r_done=1;
phase.drop_objection(this);
end
join_none
endtask: run_mon */
task write_monitor();
if( mon_avif.awvalid && mon_avif.awready) begin
w_trans = axi_txn ::type_id::create("w_trans");
w_trans.awaddr = mon_avif.awaddr;
w_trans.awid = mon_avif.awid;
w_trans.awsize = mon_avif.awsize;
w_trans.awlen = mon_avif.awlen;
w_trans.awburst = mon_avif.awburst;
w_trans.wdata = new [w_trans.awlen+1];
for (int i=0; i<w_trans.awlen+1; i++) begin
@( mon_avif.clk);
wait( mon_avif.wvalid && mon_avif.wready);
w_trans.wdata[i] = new [D_WIDTH/8];
for (int j=0; j<D_WIDTH/8; j++) begin
w_trans.wdata[i][j] = mon_avif.wdata[8*j+:8];
end
end
ap.write(w_trans);
`uvm_info("MMON", $sformatf("WTRANS %s", w_trans.convert2string()), UVM_HIGH)
end
endtask: write_monitor
task read_monitor();
if( mon_avif.arvalid && mon_avif.arready) begin
r_trans = axi_txn#(D_WIDTH, A_WIDTH)::type_id::create("r_trans");
r_trans.araddr = mon_avif.araddr;
r_trans.arid = mon_avif.arid;
r_trans.arsize = mon_avif.arsize;
r_trans.awlen = mon_avif.awlen;
r_trans.arburst = mon_avif.arburst;
ap.write(r_trans);
`uvm_info("MMON", $sformatf("RTRANS %s", r_trans.convert2string()), UVM_HIGH)
end
endtask: read_monitor
endclass
module top_v axi_mon1 dut;
initial
begin
repeat(5)
dut=new();
assert(dut.randomize);
$display("done");
end
endmodule

+ 8
- 0
axi_sqr.sv Прегледај датотеку

@@ -0,0 +1,8 @@
`include "uvm_macros.svh"
import uvm_pkg::*;
class AXI_SLAVE_SEQR extends uvm_sequencer #(axi_txn));
`uvm_component_utils( AXI_SLAVE_SEQR)
function new(string name=" AXI_SLAVE_SEQR",uvm_component parent);
super.new(name,parent;
endfunction
endclass : AXI_SLAVE_SEQR

Loading…
Откажи
Сачувај