Attachment 1
Attachment 1
(
input pclk,
input presetn,
input [31 : 0] paddr,
input [31 : 0] pwdata,
input psel,
input pwrite,
input penable,
output [31 : 0] prdata
);
end
end
endmodule
/////////////////////interface
endinterface
/////////////////////////////////////////////////////////////////////////////////////////////////
`include "uvm_macros.svh"
import uvm_pkg::*;
///////////////////transaction class
constraint c_paddr {
paddr inside {0, 4, 8, 12, 16};
}
endclass
//////////////////////////////////////////
endtask
/////////////////////////////////////////
endclass
//////////////////////////////////////////////////////
endclass
///////////////////////////////////////////////////////////////////////////////
uvm_analysis_imp#(transaction,sco) recv;
bit [31:0] arr [17];
bit [31:0] temp;
if(tr.pwrite == 1'b1)
begin
arr[tr.paddr] = tr.pwdata;
`uvm_info("SCO", $sformatf("DATA Stored Addr : %0d Data :%0d", tr.paddr, tr.pwdata), UVM_NONE)
end
else
begin
temp = arr[tr.paddr];
end
$display("----------------------------------------------------------------");
endfunction
endclass
/////////////////////////////////////////////////////////////////////////////////////////////////
driver d;
uvm_sequencer#(transaction) seqr;
monitor m;
endclass
/////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
/////////////////////implementing RAL model
endclass
///////////////////////////////////
endclass
///////////////////////////////////
endclass
//////////////////////////////////////////////
class reg3_reg extends uvm_reg;
`uvm_object_utils(reg3_reg)
endclass
//////////////////////////////////////////////
class reg4_reg extends uvm_reg;
`uvm_object_utils(reg4_reg)
endclass
//////////////////////////////////////////////
cntrl_reg cntrl_inst;
reg1_reg reg1_inst;
reg2_reg reg2_inst;
reg3_reg reg3_inst;
reg4_reg reg4_inst;
cntrl_inst = cntrl_reg::type_id::create("cntrl_inst");
cntrl_inst.build();
cntrl_inst.configure(this,null);
reg1_inst = reg1_reg::type_id::create("reg1_inst");
reg1_inst.build();
reg1_inst.configure(this,null);
reg2_inst = reg2_reg::type_id::create("reg2_inst");
reg2_inst.build();
reg2_inst.configure(this,null);
reg3_inst = reg3_reg::type_id::create("reg3_inst");
reg3_inst.build();
reg3_inst.configure(this,null);
reg4_inst = reg4_reg::type_id::create("reg4_inst");
reg4_inst.build();
reg4_inst.configure(this,null);
endfunction
endclass
///////////////////////////////////adapter
return tr;
endfunction
assert($cast(tr, bus_item));
////////////////////////////////////////////////////////////////////////////////////////////////////
agent agent_inst;
reg_block regmodel;
top_adapter adapter_inst;
uvm_reg_predictor #(transaction) predictor_inst;
sco s;
endfunction
predictor_inst.map = regmodel.default_map;
predictor_inst.adapter = adapter_inst;
endfunction
endclass
/////////////////////////////////////////////////
//////////////////write data to control reg
`uvm_object_utils(ctrl_wr)
reg_block regmodel;
task body;
uvm_status_e status;
bit [3:0] wdata;
endtask
endclass
/////////////////////////////////////////////////////////////////////////
//////////////////read data from control reg
`uvm_object_utils(ctrl_rd)
reg_block regmodel;
task body;
uvm_status_e status;
bit [3:0] rdata;
endtask
endclass
/////////////////////////////////////////////////
//////////////////write data to reg1 reg
`uvm_object_utils(reg1_wr)
reg_block regmodel;
task body;
uvm_status_e status;
bit [31:0] wdata;
endtask
endclass
/////////////////////////////////////////////////////////////////////////
//////////////////read data from control reg
`uvm_object_utils(reg1_rd)
reg_block regmodel;
task body;
uvm_status_e status;
bit [31:0] rdata;
endtask
endclass
///////////////////////////////////////////////////////////////
/////////////////////////////////////////////////
//////////////////write data to reg2 reg
`uvm_object_utils(reg2_wr)
reg_block regmodel;
task body;
uvm_status_e status;
bit [31:0] wdata;
endtask
endclass
/////////////////////////////////////////////////////////////////////////
//////////////////read data from control reg
`uvm_object_utils(reg2_rd)
reg_block regmodel;
task body;
uvm_status_e status;
bit [31:0] rdata;
endtask
endclass
//////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////
//////////////////write data to reg3 reg
`uvm_object_utils(reg3_wr)
reg_block regmodel;
task body;
uvm_status_e status;
bit [31:0] wdata;
endtask
endclass
/////////////////////////////////////////////////////////////////////////
//////////////////read data from control reg
`uvm_object_utils(reg3_rd)
reg_block regmodel;
task body;
uvm_status_e status;
bit [31:0] rdata;
endtask
endclass
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
env e;
ctrl_wr cwr;
ctrl_rd crd;
reg1_wr r1wr;
reg1_rd r1rd;
reg2_wr r2wr;
reg2_rd r2rd;
reg3_wr r3wr;
reg3_rd r3rd;
cwr = ctrl_wr::type_id::create("cwr");
crd = ctrl_rd::type_id::create("crd");
r1wr = reg1_wr::type_id::create("r1wr");
r1rd = reg1_rd::type_id::create("r1rd");
r2wr = reg2_wr::type_id::create("r2wr");
r2rd = reg2_rd::type_id::create("r2rd");
r3wr = reg3_wr::type_id::create("r3wr");
r3rd = reg3_rd::type_id::create("r3rd");
endfunction
cwr.regmodel = e.regmodel;
cwr.start(e.agent_inst.seqr);
crd.regmodel = e.regmodel;
crd.start(e.agent_inst.seqr);
/*
assert(r1wr.randomize());
r1wr.regmodel = e.regmodel;
r1wr.start(e.agent_inst.seqr);
/*
assert(r2wr.randomize());
r2wr.regmodel = e.regmodel;
r2wr.start(e.agent_inst.seqr);
/*
assert(r3wr.randomize());
r3wr.regmodel = e.regmodel;
r3wr.start(e.agent_inst.seqr);
phase.drop_objection(this);
phase.phase_done.set_drain_time(this, 200);
endtask
endclass
/////////////////////////////////////////////////////////
module tb;
top_if vif();
top dut (vif.pclk, vif.presetn, vif.paddr, vif.pwdata, vif.psel, vif.pwrite, vif.penable, vif.prdata);
initial begin
vif.pclk <= 0;
end
initial begin
uvm_config_db#(virtual top_if)::set(null, "*", "vif", vif);
run_test("test");
end
initial begin
$dumpfile("dump.vcd");
$dumpvars;
end
endmodule