0% found this document useful (0 votes)
9 views16 pages

33UVM Coverage Monitor

Uploaded by

sampath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views16 pages

33UVM Coverage Monitor

Uploaded by

sampath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Slide1 : UVM Class Hierarchy

uvm_object

uvm_transaction

uvm_sequence_item
uvm_component
uvm_sequence

uvm_test uvm_env uvm_agent uvm_driver uvm_monitor uvm_sequencer uvm_scoreboard


Slide2 : A sample UVM Testbench
test
env
scoreboard

agent
sequence sequence_item
sequencer

monitor driver

Virtual Interface
Testbench
DUT
Slide 3 : UVM Flow
module top;
-----
initial
begin
-------------
run_test( );
end
endmodule
Slide 4 : UVM Flow

Build

Connect

Run

Clean-up
Slide 5 : Coverage Monitor Connections
V
Env analysis exports I
Agent R
T
U
Coverage Monitor A
L
Monitor
Score- DUV
I
board N
T
Driver E
R
F
A
analysis ports C
E
Slide 6 : Driver
class my_driver extends uvm_driver #(my_data) ;
`uvm_component_utils (my_driver)
virtual dut_if vif;
uvm_analysis_port #(my_data) drv_port; // my_data is
// sequence_item class
function new (string name, uvm_component parent);
super.new (name, parent);
endfunction
Slide 7 : Driver
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
drv_port = new(“drv_port”,this);
// code to connect vif to the interface to which the DUT is connected
endfunction
Slide 8 : Driver( contd.)
virtual task run_phase (uvm_phase phase);
forever
begin
seq_item_port.get_next_item (req);
drv_port.write(req); // write to scoreboard & coverage
drive_item (req) //by default req is sequence item
object
seq_item_port.item_done ();
end
endtask
task drive_item(my_data pkt);
repeat(pkt.delay) @(negedge vif.clk);
vif.addr = pkt.addr;
vif.data = pkt.data;
endtask
endclass
Slide 9 : Monitor
class my_monitor extends uvm_monitor;
`uvm_component_utils (my_monitor)
virtual dut_if vif;
uvm_analysis_port #(my_data) mon_analysis_port;
function new (string name, uvm_component parent= null);
super.new (name, parent);
endfunction
virtual function void build_phase (uvm_phase phase);
super.build_phase (phase);
mon_analysis_port = new ("mon_analysis_port", this); // Create an
//instance of analysis port
//code to connect vif to the interface to which the DUT is connected
endfunction
Slide 10 : Monitor
virtual task run_phase (uvm_phase phase);
forever
begin
my_data data_obj = my_data::type_id::create ("data_obj");
wait( vif.data_ready) ;
@(negedge vif.clk);
data_obj.data = vif.data;
data_obj.addr = vif.addr;
mon_analysis_port.write (data_obj); // Send data object
//through the analysis port
end // to scoreboard & coverage
endtask
endclass
Slide 11 : Env
class my_env extends uvm_env;
`uvm_component_utils(my_env)
apb_agent m_apb_agent;
my_scoreboard m_scbd0;
my_coverage mycov1;
extern function new(string name = “ ", uvm_component parent =
null);
extern virtual function void build_phase( uvm_phase phase );
extern virtual function void connect_phase( uvm_phase phase );
endclass
Slide 12 : Env
function new
…….
function void my_env::build_phase( uvm_phase phase);
super.build_phase(phase);
m_scbd0 = my_scoreboard::type_id::create(“m_scbd0”,this);
mycov1 = my_coverage::type_id::create(“mycov1”,this);
m_apb_agent = apb_agent::type_id::create("m_apb_agent", this);
endfunction
function void my_env:: connect_phase (uvm_phase phase);
m_apb_agent.m_mon0. mon_analysis_port.connect (m_scbd0.data_export1);
m_apb_agent.drv0.drv_port.connect(m_scbd0.data_export2);
m_apb_agent.m_mon0. mon_analysis_port.connect (mycov1.cov_export1);
m_apb_agent.drv0.drv_port.connect(mycov1.cov_export2);
endfunction
endclass
Slide13 : Coverage Monitor
`uvm_analysis_imp_decl(_monpkt)
`uvm_analysis_imp_decl(_drvpkt)
class my_coverage extends uvm_component;
`uvm_component_utils (my_coverage)
my_data m1,m2 ;
uvm_analysis_imp_monpkt #(my_data,my_coverage) cov_export1;
uvm_analysis_imp_drvpkt #(my_data,my_coverage) cov_export2;
function new (string name = “ ", uvm_component parent = null);
super.new (name, parent);
cov1 = new ;
cov2 = new ;
endfunction
Slide14 : Coverage Monitor
covergroup cov1 ;
cc1: coverpoint m1.data_in {
bins bb1[ ] = {[$:$]};
}
endgroup
covergroup cov2 ;
cc1: coverpoint m2.data_in{
bins bb1[ ] = {[$:$]};
}
endgroup
Slide15 : Coverage Monitor
function void build_phase (uvm_phase phase);
bit b1 ;
super.build_phase(phase);
cov_export1 = new("cov_export1",this);
cov_export2 = new("cov_export2",this);
endfunction
virtual function void write_drvpkt(my_data pkt);
m1 = pkt ;
cov1.sample ;
endfunction
virtual function void write_monpkt(my_data pkt);
m2 = pkt ;
cov2.sample;
endfunction
Slide 16 : Coverage Monitor
virtual function void check_phase (uvm_phase phase);
$display("Stimulus Coverage = %d", cov1.get_coverage);
$display("Response Coverage = %d", cov2.get_coverage);
endfunction

endclass

You might also like