Uvm
Uvm
Uvm
• An Accellera standard!
• Best practice
• Consistency, uniformity, don't reinvent the wheel, avoid pitfalls
• Reuse
• Verification IP, verification environments, tests, people, knowhow
• Doulos training
4 days 4 days
What next?
Tools?
Coaching?
Guidelines?
Does it work?
Constrained random
stimulus
Are we done?
Increase coverage
Config Config
Class-based
Test
harness
Module-based
Coverage
Configuration
Transaction-Level
Connections Config Config
Stimulus
Test Config
Env
Factory overrides
Configuration
Coverage
Config Config Stimulus
Objections Test
Assertions
harness
Message reporting
Pattern 1
class my_comp extends uvm_component;
`uvm_component_utils(my_comp)
Test
Common template file harness
dut_source_path = mydut
inc_path = include
dut_top = mydut
dut_pfile = pinlist
endclass : data_tx
`endif // CLKNDATA_SEQ_ITEM_SV
endclass : clkndata_agent
Env
Class-based
Virtual
interfaces
Test
harness
Module-based
endclass : clkndata_driver
do_drive();
$cast(rsp, req.clone());
seq_item_port.item_done();
end
endtask : run_phase
`include "clkndata_do_drive.sv"
task clkndata_driver::do_drive();
vif.data <= req.data;
@(posedge vif.clk); Pin wiggles
endtask
timeunit 1ns;
timeprecision 1ps;
import uvm_pkg::*;
`include "uvm_macros.svh"
import top_test_pkg::*;
top_th th();
initial
begin
uvm_config_db #(virtual clkndata_if)::set(
null, "uvm_test_top", "clkndata_if", th.clkndata_if0); config_db
run_test();
end
endmodule
Test Config
Env
Test
harness
clkndata_config cfg;
data_tx item;
endclass : clkndata_base_seq
task clkndata_base_seq::body();
`uvm_info(get_type_name(), "clkndata_base_seq", UVM_MEDIUM)
endtask : body
Placeholder, going to be overridden
endclass : clkndata_default_seq
task clkndata_default_seq::body();
`uvm_info(get_type_name(), "default sequence starting", UVM_MEDIUM)
super.body();
item = data_tx::type_id::create("item");
start_item(item);
if ( !item.randomize() )
`uvm_warning(get_type_name(), "randomization failed!")
finish_item(item);
`uvm_info(get_type_name(), "default sequence completed", UVM_MEDIUM)
endtask : body
endclass : clkndata_config
task top_default_seq::body();
super.body();
repeat(m_seq_count)
begin
fork
if (m_clkndata_agent.m_cfg.is_active == UVM_ACTIVE)
begin
clkndata_base_seq seq;
seq = clkndata_base_seq::type_id::create("seq");
seq.randomize();
seq.start(m_clkndata_agent.m_sequencer, this);
end
... // Other agents
join
`uvm_info(get_type_name(), "default sequence completed", UVM_MEDIUM)
end
endtask : body
covergroup clkndata_cov;
option.per_instance = 1;
`include "clkndata_cover_inc.sv"
endgroup
Env
• Factory-made sequences
• Factory-made transactions
• Constraints
top_config m_cfg;
top_env m_env;
top_base_seq::type_id::set_type_override(top_default_seq::get_type());
clkndata_base_seq::type_id::set_type_override(
clkndata_default_seq::get_type());
super.build_phase(phase);
endfunction : build_phase Factory overrides
vseq.start(null);
Configuration
Factory overrides
Test
harness
task my_clkndata_seq::body();
`uvm_info(...
super.body();
for (int i = 0; i < 16; i++)
begin
item = data_tx::type_id::create("item");
start_item(item);
if ( !item.randomize() with { data == i; })
`uvm_warning(get_type_name(),"randomization failed!")
finish_item(item);
`uvm_info(...
end User-defined
endtask : body
driver_inc = clkndata_do_drive.sv
monitor_inc = clkndata_do_mon.sv
agent_cover_inc = clkndata_cover_inc.sv
agent_seq_inc = my_clkndata_seq.sv
...
# uvm_test_top top_test - @471
# m_env top_env - @484
# m_clkndata_agent clkndata_agent - @497
# ap uvm_analysis_port - @527
# m_driver clkndata_driver - @535
# m_monitor clkndata_monitor - @520
# ap uvm_analysis_port - @667
# m_sequencer uvm_sequencer - @558
# m_clkndata_coverage clkndata_coverage - @504
# analysis_imp uvm_analysis_imp - @511
...
# mydut data = 00
# mydut data = 01
# mydut data = 02
# mydut data = 03
# mydut data = 04 Edited highlights
...
http://www.doulos.com/knowhow/sysverilog/uvm