Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonadeepika authored May 13, 2024
1 parent 90901ba commit fb44716
Show file tree
Hide file tree
Showing 16 changed files with 951 additions and 0 deletions.
55 changes: 55 additions & 0 deletions dst_agent.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
class router_rd_agent extends uvm_agent;

// Factory Registration
`uvm_component_utils(router_rd_agent)

// Declare handle for configuration object
router_rd_agt_config m_cfg;

// Declare handles of router_wr_monitor,router_wr_sequencer and router_wr_driver with Handle names as monh, seqrh, drvh respectively
router_rd_monitor monh;
router_rd_sequencer seqrh;
router_rd_driver drvh;

extern function new(string name = "router_rd_agent", uvm_component parent = null);
extern function void build_phase(uvm_phase phase);
extern function void connect_phase(uvm_phase phase);

endclass



//----------------- constructor new method -------------------//
function router_rd_agent::new(string name = "router_rd_agent",uvm_component parent = null);
super.new(name,parent);
endfunction



//----------------- build method ------------------//

function void router_rd_agent::build_phase(uvm_phase phase);

super.build_phase(phase);
// get the config object using uvm_config_db
if(!uvm_config_db #(router_rd_agt_config)::get(this,"","router_rd_agt_config",m_cfg))
`uvm_fatal("CONFIG","cannot get() m_cfg from uvm_config_db. Have you set() it?")
monh=router_rd_monitor::type_id::create("monh",this);
if(m_cfg.is_active==UVM_ACTIVE)
begin
drvh=router_rd_driver::type_id::create("drvh",this);
seqrh=router_rd_sequencer::type_id::create("seqrh",this);
end
endfunction



//----------------- connect method -------------------//

function void router_rd_agent::connect_phase(uvm_phase phase);
if(m_cfg.is_active==UVM_ACTIVE)
begin
drvh.seq_item_port.connect(seqrh.seq_item_export);
end
endfunction

24 changes: 24 additions & 0 deletions dst_agt_config.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class router_rd_agt_config extends uvm_object;

`uvm_object_utils(router_rd_agt_config)

virtual router_if vif;

static int drv_data_count = 0;
static int mon_data_count = 0;

uvm_active_passive_enum is_active = UVM_ACTIVE;

extern function new(string name = "router_rd_agt_config");

endclass



//----------------- constructor new method -------------------//

function router_rd_agt_config::new(string name = "router_rd_agt_config");
super.new(name);
endfunction


43 changes: 43 additions & 0 deletions dst_agt_top.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
class router_rd_agt_top extends uvm_env;

`uvm_component_utils(router_rd_agt_top)

router_rd_agent agnth[];

router_env_config m_cfg;

extern function new (string name="router_rd_agt_top",uvm_component parent);
extern function void build_phase(uvm_phase phase);

endclass



//----------------- constructor new method -------------------//

function router_rd_agt_top ::new(string name="router_rd_agt_top",uvm_component parent);
super.new(name,parent);
endfunction



//----------------- build method -------------------//

function void router_rd_agt_top::build_phase(uvm_phase phase);
super.build_phase(phase);
if(!uvm_config_db #(router_env_config)::get(this,"","router_env_config",m_cfg))
`uvm_fatal("CONFIG","cannot get() m_cfg from uvm_config_db. Have you set() it?")

agnth = new[m_cfg.no_of_read_agent];

foreach(agnth[i])
begin
// set router_wr_agent_config into the database using the
// router_env_config's router_wr_agent_config object
agnth[i]=router_rd_agent::type_id::create($sformatf("agnth[%0d]",i) ,this);

uvm_config_db #(router_rd_agt_config)::set(this,$sformatf("agnth[%0d]*",i), "router_rd_agt_config", m_cfg.rd_agt_cfg[i]);

end
endfunction

98 changes: 98 additions & 0 deletions dst_driver.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
class router_rd_driver extends uvm_driver #(read_xtn);

`uvm_component_utils(router_rd_driver)

virtual router_if.RDR_MP vif;
router_rd_agt_config m_cfg;

extern function new(string name ="router_rd_driver",uvm_component parent);
extern function void build_phase(uvm_phase phase);
extern function void connect_phase(uvm_phase phase);
extern task run_phase(uvm_phase phase);
extern task send_to_dut(read_xtn xtn);
extern function void report_phase(uvm_phase phase);

endclass



//----------------- constructor new method -------------------//
function router_rd_driver::new(string name ="router_rd_driver",uvm_component parent);
super.new(name,parent);
endfunction



//----------------- build() phase method -------------------//
function void router_rd_driver::build_phase(uvm_phase phase);

super.build_phase(phase);
// get the config object using uvm_config_db
if(!uvm_config_db #(router_rd_agt_config)::get(this,"","router_rd_agt_config",m_cfg))
`uvm_fatal("CONFIG","cannot get() m_cfg from uvm_config_db. Have you set() it?")

endfunction



//----------------- connect() phase method -------------------//
// in connect phase assign the configuration object's virtual interface
// to the driver's virtual interface instance(handle --> "vif")
function void router_rd_driver::connect_phase(uvm_phase phase);
vif = m_cfg.vif;
endfunction



//----------------- run() phase method -------------------//
// In forever loop
// Get the sequence item using seq_item_port
// Call send_to_dut task
// Get the next sequence item using seq_item_port

task router_rd_driver::run_phase(uvm_phase phase);

forever
begin
seq_item_port.get_next_item(req);
send_to_dut(req);
seq_item_port.item_done;
end
endtask



//----------------- task send_to_dut() method -------------------//
task router_rd_driver::send_to_dut(read_xtn xtn);

begin
`uvm_info("ROUTER_RD_DRIVER",$sformatf("printing from driver \n %s",xtn.sprint()),UVM_LOW)
@(vif.rdr_cb);
// wait(vif.rdr_cb.v_out)
while(!vif.rdr_cb.v_out)
@(vif.rdr_cb);
repeat(xtn.no_of_cycles)
@(vif.rdr_cb);
vif.rdr_cb.read_enb <= 1;
// wait(!vif.rdr_cb.v_out)
while(vif.rdr_cb.v_out)
@(vif.rdr_cb);
vif.rdr_cb.read_enb <= 0;
//@(vif.rdr_cb);
m_cfg.drv_data_count++;
//repeat(2)
@(vif.rdr_cb);
end

endtask




//------------------------------- UVM report_phase-----------------//

function void router_rd_driver::report_phase(uvm_phase phase);
`uvm_info(get_type_name(), $sformatf("Report: ROUTER read driver sent %0d transactions", m_cfg.drv_data_count), UVM_LOW)
endfunction


98 changes: 98 additions & 0 deletions dst_monitor.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
class router_rd_monitor extends uvm_monitor;

`uvm_component_utils(router_rd_monitor)

virtual router_if.RMON_MP vif;
router_rd_agt_config m_cfg;

uvm_analysis_port#(read_xtn) monitor_port;

extern function new(string name ="router_rd_monitor",uvm_component parent);
extern function void build_phase(uvm_phase phase);
extern function void connect_phase(uvm_phase phase);
extern task run_phase(uvm_phase phase);
extern task collect_data();
extern function void report_phase(uvm_phase phase);

endclass



//----------------- constructor new method -------------------//
function router_rd_monitor::new(string name ="router_rd_monitor",uvm_component parent);
super.new(name,parent);
monitor_port = new("monitor_port",this);
endfunction



//----------------- build() phase method -------------------//
function void router_rd_monitor::build_phase(uvm_phase phase);

super.build_phase(phase);
// get the config object using uvm_config_db
if(!uvm_config_db #(router_rd_agt_config)::get(this,"","router_rd_agt_config",m_cfg))
`uvm_fatal("CONFIG","cannot get() m_cfg from uvm_config_db. Have you set() it?")

endfunction



//----------------- connect() phase method -------------------//
// to the driver's virtual interface instance(handle --> "vif"
function void router_rd_monitor::connect_phase(uvm_phase phase);
super.connect_phase(phase);
vif = m_cfg.vif;
endfunction



//----------------- run_phase()method -------------------//
// In forever loop
// Call task collect_data
task router_rd_monitor::run_phase(uvm_phase phase);
forever
// Call collect data task
collect_data();
endtask



//--------------Collect Reference Data from DUV IF-----------------//
task router_rd_monitor::collect_data();

read_xtn mon_data;
mon_data=read_xtn::type_id::create("mon_data");
@(vif.rmon_cb);

while(!vif.rmon_cb.read_enb)
@(vif.rmon_cb);
@(vif.rmon_cb);

mon_data.header = vif.rmon_cb.data_out;
mon_data.payload_data=new[mon_data.header[7:2]];
@(vif.rmon_cb);
foreach(mon_data.payload_data[i])
begin
//while(!vif.rmon_cb.read_enb)
mon_data.payload_data[i]=vif.rmon_cb.data_out;
@(vif.rmon_cb);
end
mon_data.parity=vif.rmon_cb.data_out;
@(vif.rmon_cb);
m_cfg.mon_data_count++;

`uvm_info("ROUTER_RD_MONITOR",$sformatf("printing from monitor \n %s",mon_data.sprint()),UVM_LOW)

monitor_port.write(mon_data);
endtask



//-------------------- UVM report_phase----------------------------------
function void router_rd_monitor::report_phase(uvm_phase phase);
`uvm_info(get_type_name(), $sformatf("Report: ROUTER Read Monitor Collected %0d Transactions", m_cfg.mon_data_count), UVM_LOW)
endfunction



48 changes: 48 additions & 0 deletions dst_seqs.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
class router_rd_seq extends uvm_sequence #(read_xtn);

// Factory registration using `uvm_object_utils
`uvm_object_utils(router_rd_seq)

// Standard UVM Methods:
extern function new(string name ="router_rd_seq");
endclass



//----------------- constructor new method -------------------//
function router_rd_seq::new(string name ="router_rd_seq");
super.new(name);
endfunction



//--------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class router_rxtns1 extends router_rd_seq;

// Factory registration using `uvm_object_utils
`uvm_object_utils(router_rxtns1)

extern function new(string name ="router_rxtns1");
extern task body();

endclass



//----------------- constructor new method -------------------//
function router_rxtns1::new(string name ="router_rxtns1");
super.new(name);
endfunction


//-----------------------------------task body----------------------------------------
task router_rxtns1::body();

req=read_xtn::type_id::create("req");
start_item(req);
assert(req.randomize() with {no_of_cycles inside {[1:28]};} );
`uvm_info("ROUTER_RD_SEQUENCE",$sformatf("printing from sequence \n %s", req.sprint()),UVM_HIGH)
finish_item(req);
endtask

14 changes: 14 additions & 0 deletions dst_sequencer.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class router_rd_sequencer extends uvm_sequencer #(read_xtn);

// Factory registration using `uvm_component_utils
`uvm_component_utils(router_rd_sequencer)

// Standard UVM Methods:
extern function new(string name = "router_rd_sequencer",uvm_component parent);
endclass


//----------------- constructor new method -------------------//
function router_rd_sequencer::new(string name="router_rd_sequencer",uvm_component parent);
super.new(name,parent);
endfunction
Loading

0 comments on commit fb44716

Please sign in to comment.