UVM Tutorial DVCon 2013
UVM Tutorial DVCon 2013
Agenda
Anecdotes From Hundreds of
UVM Adopters
- John Aynsley, Doulos
IBM Recommendations
for OVM UVM Migration
- Wes Queen, IBM
A Reusable Verification
FPGA chip verification using
Testbench Architecture
Supporting C/UVM Mixed Tests UVM
- Richard Tseng, Qualcomm
Page 3
General Comments
Especially managers and self-teachers
Page 4
OVM to UVM
There exists plenty of guidance on migrating from OVM to UVM
www.uvmworld.org
ovm2uvm_migration.pdf
verificationacademy.com/verification-methodology
http://www.doulos.com/knowhow/sysverilog/uvm/ovm-to-uvm
Page 5
Page 6
Page 7
endfunction: new
`uvm_object_utils_begin(basic_transaction)
`uvm_field_int(addr, UVM_DEFAULT)
`uvm_object_utils_end
endclass : basic_transaction
Page 8
UVM_DEFAULT
all on
UVM_COPY
UVM_COMPARE
UVM_PRINT
UVM_RECORD
UVM_PACK
default
UVM_NOCOPY
UVM_NOCOMPARE
UVM_NOPRINT
UVM_NORECORD
UVM_NOPACK
UVM_READONLY
not configured
Page 9
Overriding do_compare
class bus_xact extends uvm_sequence_item;
tx1.compare(tx2)
...
function bit do_compare(uvm_object rhs, uvm_comparer comparer);
bus_xact t;
bit result = 1;
$cast(t, rhs);
result &=
comparer.compare_field("op",
op, t.op, $bits(op));
if (op != NOP)
result &= comparer.compare_field("addr", addr, t.addr,
$bits(addr));
...
Collects mismatches
return result;
endfunction
`uvm_object_utils_begin(bus_xact)
`uvm_field_int(op,
UVM_NOCOMPARE)
`uvm_field_int(addr, UVM_NOCOMPARE)
...
`uvm_object_utils_end
endclass
comparer.policy
= UVM_SHALLOW;
uvm_comparer
comparer
= new;
comparer.show_max = 999;
tx1.compare(tx2, comparer);
tx1.compare(tx2);
Pseudo-code
begin
bit result = 1;
UVM_COMPARE
UVM_NOCOMPARE
UVM_REFERENCE
return result;
end
Page 11
int count;
`uvm_component_utils_begin(my_component)
`uvm_field_int(count, UVM_DEFAULT)
`uvm_component_utils_end
endfunction
Calls apply_config_settings
Page 13
req = tx_type::type_id::create("req");
`uvm_do(req)
start_item(req);
if( !req.randomize() ) `uvm_error(...)
finish_item(req);
Equivalent?
Page 14
uvm_sequence_base __seq;
begin
uvm_object_wrapper w_;
w_ = SEQ_OR_ITEM.get_type();
with {} ) begin
end
Page 15
`ovm_update_sequence_lib_and_item(basic_transaction)
endfunction : new
Deprecated in UVM
Page 16
endfunction: new
task body;
...
endtask
`ovm_sequence_utils(my_sequence, my_sequencer)
endclass: my_sequence
Deprecated in UVM
Page 17
Page 18
Page 19
`uvm_sequence_library_utils(my_seq_lib)
function new(string name = "");
super.new(name);
init_sequence_library();
endfunction
endclass
lib.add_sequence( seq1::get_type() );
lib.add_sequence( seq2::get_type() );
lib.selection_mode = UVM_SEQ_LIB_RAND;
if ( !lib.randomize() ) ...
lib.start(m_env.m_seqr);
Page 20
Page 22
Page 23
Agenda
We present a OVM compatibility layer on top of UVM
that allows the use of OVM based IPs on UVM source
code
We look at the results of using the compatibility layer
by migrating a SoC consisting of 25+ OVM VIPs
Page 24
Introduction
We present a case study of migrating a SoC environment fully developed
on OVM to UVM
UVM recommends running a converter script on the source code to replace the ovm_*
symbols with uvm_* symbols
This mandates either abandoning the OVM code base of the VIPs or maintaining two
repositories
With heavy OVM in use, this is NOT practical as VIPs needs to go into SoCs with OVM
base and UVM base running in parallel.
endpackage
Page 26
`define ovm_do_callbacks(CB,T,METHOD_CALL)
`uvm_do_callbacks(T,CB,METHOD_CALL)
`define ovm_do_callbacks_exit_on(CB,T,METHOD_CALL,VAL)
`uvm_do_callbacks_exit_on(T,CB,METHOD_CALL,VAL)
`define ovm_do_task_callbacks(CB,T,METHOD_CALL)
`uvm_do_task_callbacks(T,CB,METHOD_CALL)
`define ovm_do_obj_callbacks(CB,T,OBJ,METHOD_CALL)
`uvm_do_obj_callbacks(T,CB,OBJ,METHOD_CALL)
`define ovm_do_obj_callbacks_exit_on(CB,T,OBJ,METHOD_CALL,VAL)
`uvm_do_callbacks(T,CB,METHOD_CALL)
`define ovm_do_obj_task_callbacks(CB,T,OBJ,METHOD_CALL)
`uvm_do_obj_task_callbacks(T,CB,OBJ,METHOD_CALL)
`define ovm_do_ext_callbacks(CB,T,OBJ,METHOD_CALL)
`uvm_do_ext_callbacks(T,CB,OBJ,METHOD_CALL)
`define ovm_do_ext_callbacks_exit_on(CB,T,OBJ,METHOD_CALL,VAL)
`uvm_do_ext_callbacks_exit_on(T,CB,OBJ,METHOD_CALL,VAL)
`define ovm_do_ext_task_callbacks(CB,T,OBJ,METHOD_CALL)
`uvm_do_ext_task_callbacks(T,CB,OBJ,METHOD_CALL)
`define ovm_cb_trace(OBJ,CB,OPER)
`uvm_cb_trace(OBJ,CB,OPER)
Page 27
// OVM types.
//-----------------------------------------------------------------------------typedef uvm_void
ovm_void;
typedef uvm_factory
ovm_factory;
typedef uvm_root
typedef uvm_object
typedef uvm_transaction
typedef uvm_component
ovm_root;
ovm_object;
ovm_transaction;
ovm_component;
// OVM types, have to extend from uvm equivalents and pass the right parameters
class ovm_analysis_port #(type T=int) extends uvm_analysis_port#(T);
function new(string name, uvm_component parent=null);
super.new(name, parent);
endfunction
endclass
Page 28
= UVM_ACTIVE;
= UVM_NONE;
= UVM_LOW;
= UVM_HIGH;
= UVM_FULL;
= UVM_DEBUG;
= UVM_INFO;
uvm_severity OVM_ERROR
= UVM_ERROR;
uvm_severity OVM_FATAL
.
= UVM_FATAL;
Page 29
Page 30
uvm_component
Have to add pre_run() and call it from start_of_simulation phase
`endif
Page 31
uvm_factory
Have to add create_object() function into uvm_factory
`ifdef OVM
string parent_inst_path="",
string name="");
endfunction
`endif
string original_type_name,
string override_type_name);
endfunction
`endif
Page 32
`ifdef OVM
`endif
`ifdef OVM
ovm_test_top = uvm_test_top;
`endif
Page 33
Results
Successfully migrated a OVM based SoC to UVM using the OVM
compatibility layer
- There were 25+ VIPs with complex bus interfaces like OCP/AHB/AXI and several I/Os
like PCIE/USB/SDIO etc.
- Have to add more code in the compatibility layer as few of the legacy IPs are even
dependent on AVM compatibility layer in OVM
- Ideally would be better to clean the IP source code to remove that legacy, but
preferred to add support in compatibility layer as proof-of-concept
- Managed to get all level-0 regressions containing 100+ tests passing
- Took ~3 person weeks to enhance the compatibility layer
- Took ~2 person weeks to run regressions and achieve same results as the reference
- Filed several Mantis items on UVM source code based on the issues/bugs observed
- e.g. print_topology() was crawling in UVM compared to OVM, simulator
enhancements were needed to match OVM performance
Page 34
Summary
Ideally, it would be nice to start from a clean code and not create a compatibility layer
In our case this is not possible because of:
The amount of OVM code that we have which needs to be converted and tested
The IPs that we get from all over the place internally and externally.
It will takes us years to use the clean code approach. Huge impact on
Our resources
Execution schedule
Having the compatibility layer enables a SoC project to move to UVM when they
decide and therefore without any effort or impact on execution schedule.
This way a SoC can start developing new code in UVM and take opportunistic
approach in converting old code as intercepts permit.
Page 35
Page 36
Agenda
Introduction
Testbench Features
Testbench Architecture Overview
Challenges & Solutions
Summary
Q&A
Page 37
Introduction
Page 38
Introduction
UVM would be the ultimate methodology for design verification
- Its the latest and greatest technology
- Strong EDA vendor supports
- VIPs and test sequences can be reusable
Page 39
Testbench Features
Page 40
Testbench Features
The UVM testbench architecture allows
us:
- To reuse C and UVM tests in various platforms
- To run C/UVM tests simultaneously
- To reuse UVM verification components
- To easily integrate UVM register layer
Page 41
Testbench Architecture
Overview
Page 42
Page 43
Page 44
Page 45
Page 46
Page 48
Send to sequencer
endtask: axi_mst_write
Page 49
Page 50
}
Page 53
// define C macros
#define uvm_info(id, message, verbosity) \
uvm_rpt_info(id, message, verbosity);
Page 55
Reusable!
Page 57
Test Sequences
reg2bus()
bus2reg()
reg2gpb_predictor
reg2gpb_adapter
Project Virtual
Sequencer
Generic
Transaction
Translation
Layer
UVM
Agent
Layer
DUT
gpb2axi_mst_xl_vseq
gpb2axi_mst
Sequencer
Monitor
Driver
AXI Master
Agent
DUT
Page 59
Summary
Page 60
Summary
In our applications, test sequences and the VIPs
were reused in multiple testbenches
- Modem corelevel testbench
- GPB => QSB AXI master
- GST => QSB AXI salve
- Modem block-level testbenches
- GPB, GST => proprietary bus interfaces
- Modem emulation platform testbench
- GPB => AHB Master
- GST => Off-chip ZBT memory
- Regressions have been run with multiple simulators
Q&A
Page 62
Company Logo
Page 63
Agenda
1
Conclusions
Q/A
Page 64
Lack of provisioning
for verification IP (VIP)
support
Specman e
VMM
Language Specific
Needing Expertise
OVM
Issues in writing more tasks to process channel data , repetitive and nonreusable, lack of phasing options, and extensive coding of register models
Page 67
`uvm_object_utils_begin(ahb_transfer)
`uvm_field_int(NumBytes , UVM_ALL)
`uvm_field_int(NumBeats , UVM_ALL)
//Similarly for other fields
.
.
`uvm_object_utils_end
.
endclass
End-of-Test Issues
From Issue
to Solution
We have always struggled with the issue on how to achieve end of test.
Logically when all activity completes should be the end of test, however,
checkers could still be checking or testbench components can be busy - how
do we reach true end-of-test?
UVM: uvm_test_done
Using several techniques in UVM we were
able to achieve uniform and highly
reusable end of test solution:
RTL
GATE
AMS
uvm_test_done.raise_objection
(this);
uvm_test_done.drop_objection
(this);
Inside particular phase
phase.raise_objection(this);
phase.drop_objection(this);
Inside run_phase
global_stop_request()
For debug and status of objections:
phase.phase_done.display_obj
ections();
Page 69
initial begin
// I dont know but I am configuring wrong
dut_register_base = 12hBAD;
// I am sending good packets to wrong place
send_link_pkt();
while (state!==0) begin // Wait For Complete
read32(dut_register_base), tmp_data[31:0]);
state = tmp_data[11:8];
end
$display(Device has reached U0 successfully\n");
$display("Test Passed \n");
end
endprogram
Page 70
Verification Challenge
Callbacks
Callback #1
Callback #2
Callback #3
Callback #4
Callback #5
Callback #6
Page 71
Configure DUT
through Interface A,
report done?
Based on configuration,
issue writes from C or D
to make the DUT full.
o Configure DUT using interface A so interface C and D can both Read & Write
o Configure Interface B to be Write only
o Using interface B, C and D make two iterations of DUT Full to Empty
Interface A
Scenario
Generator and
Driver
Configuration
Interface
A
Interface B
Scenario
Generator and
Driver
Write
Interface
B
Config: Wr Only
Interface C
Scenario
Generator and
Driver
Read/Write
Interface
C
Config: Wr/Rd
Read/Write
Interface
D
Config: Wr/Rd
Interface D
Scenario
Generator and
Driver
Page 72
Configuration
Configure DUT
through Interface A,
report done?
Based on configuration,
issue writes from C to
make DUT full.
Per reconfiguration,
issue writes from D
to make DUT full.
Wait for DUT full?
Read from B to
make DUT empty
Configuration
Interface
A
Interface B
Scenario
Generator and
Driver
Write, Read
Interface
B
Config: Wr, Rd
Interface C
Scenario
Generator and
Driver
Write
Interface
C
Config: Wr
Read, Write
Interface
D
Config: Rd, Wr
Interface D
Scenario
Generator and
Driver
Page 73
Configuration
//end of testcase
iterations
== 1;
tr1_final_order == C_EMPTY;
tr2_final_order == D_FULL;
tr3_final_order == B_EMPTY;
cfg_final_intf_B == RD_ONLY;
cfg_final_intf_C == RD_ONLY;
cfg_final_intf_D == WR_ONLY; }
Page 74
SEQUENCER
BFM
(Customized For
Each Project)
CFG
TESTS
(Monitor Code
Scattered in Tests)
SLAVE_AGENT
Plug-n-Play
TB for
Every
Project
MONITOR
CFG
Page 75
ENV
CONFIG
`vmm_fatal(this.log,"Data Mismatch");
`WARNING(Issue a Warning");
`ERROR(Issue an Error");
`DEBUG(Debug Debug Debug");
Page 76
Using UVM messaging support we were able to print the TB hierarchy and
also customize the report server per our requirements.
uvm_report_server my_rpt;
virtual function void report_phase(uvm_phase phase);
int error_cnt, fatal_cnt, warning_cnt;
my_rpt = _global_reporter.get_report_server();
error_cnt = my_rpt.get_severity_count(UVM_ERROR);
fatal_cnt = my_rpt.get_severity_count(UVM_FATAL);
warning_cnt = my_rpt.get_severity_count(UVM_WARNING);
if(error_cnt != 0 || fatal_cnt != 0) begin
`uvm_info(get_type_name(), "\n SIM FAILED \n", UVM_NONE);
end else begin
`uvm_info(get_type_name(), "\n SIM PASSED \n",UVM_NONE);
end
endfunction: report_phase
Customizing report_server
Global Control on TB
Hierarchy printing
Page 77
AFTER
SOURCE
SOURCE
CHANNEL
SINK
Comp
Comp
SINK
Port
BEFORE
Events were used to synch and control
Reset
VIP1
DUT
VIP2
VIP3
Reset
Reset
Leaf
Export
Configure
Configure
Configure
AFTER
Phasing support in UVM supported synchronization
Reset
Reset
Reset
Page 78
Configure
Configure
Configure
Page 79
TEST1.vams
TEST2.vams
TESTn.vams
Directed Test
Overload!
MODEL
SCHEMATIC
SCHEMATIC
OUTPUT.log
MODEL
Page 80
After
DRIVER
GLUE LOGIC
Logic to Electrical
MODEL
CFG
ENV CONFIG
SLAVE_AGENT
MONITOR
DIG &
ANALOG
CFG
D
ASSERTIONS
ANALOG NODES
Electrical to Logic
SCHEMATIC
SCHEMATIC
MODEL
SCOREBOARDS
TESTS
PARAMETER
GENERATOR
Page 81
Technical Contributors
Paul Howard
Ravi Makam
Jim Skidmore
Chuck Branch
Shyam Narayan
Arun Mohan
Pradeep Hanumansetty
Ronnie Koh
Page 82
Conclusions
UVM cleanly addressed our critical issues that were causing
significant slowdown and down time due to code re-write
UVM development goals align with our verification strategy/roadmap
We did see some conversion effort in going from UVMEA1.0 to
UVM1.1 but this effort was minimal
We found UVM helpful in following ways:
- Getting started with UVM was easy lots of trainings and guidance
- We were able to develop complex test environments quickly
- We found that available VIPs following UVM make integration and usability
easier
We are today using UVM actively in our Digital and Mixed signal
verification, and plan to use in Analog verification also
Page 83
Q/A
Page 84
Mark Litterick
Verification Consultant
Verilab GmbH, Munich, Germany
Page 85
VIP
uvm_reg
Born UVC
UVM
Born OVC
Projects
U-to-O
OVM
O-to-U
-2
-1
Now
+1
~Years
Page 86
Page 87
UVM
OVM
Audit
replace non-recommended OVM
O-to-U
update regression & test scripts
Convert
convert objection raise/drop to UVM
Page 88
Page 89
OVM
container
CIF
container::get
BASE-TEST
config db
UVM
container::set
TESTBENCH MODULE
ENV
CIF
config_db::get
BASE-TEST
config_db::set
TESTBENCH MODULE
ENV
OVC
AGENT
Page 90
INTERFACE
VIF
DUT
VIF
AGENT
INTERFACE
VIF
VIF
UVC
DUT
OVM
container
CIF
container::get
BASE-TEST
config db
UVM
TESTBENCH MODULE
ENV
OVC
CIF
config_db::get
container::set
easy
translation
BASE-TEST
config_db::set
TESTBENCH MODULE
ENV
UVC
INTERFACE
VIF
INTERFACE
VIF
VIF
S
D
// example set in UVM testbench module
DUT
uvm_config_db#(virtual
my_if)::set(null,
"*",
"cif", mif);
M
AGENT
VIF
S
D
// example set in OVM testbench module
DUT
my_container#(virtual
my_if)::set("*",
"cif", mif);
M
AGENT
do once in OVM
Audit
O-to-U
UVM
Convert
New
Automatic?
Find Fix
done
once
Page 94
done for
each VC
release
OVM
Audit
UVM
O-to-U
Convert
New
Automatic?
Find Fix
Page 95
OK if no run-time phases
normally OK
- config_db changes
- command line processor
Conclusion
Goal is move to UVM
- transition period could endure for some time
- considerable OVM legacy and many ongoing projects
- new UVM projects need OVC libraries
- ongoing OVM projects may need new UVCs
Page 97
IBM Recommendations
for OVM UVM Migration
Wes Queen
Verification Manager, IBM
Page 98
Page 99
Page 100
State
Monitor
Monitor
Interface
Register Seq
Seq Lib
Driver
DUT
Link Monitor
Link Monitor
Link Monitor
Link Monitor
Monitor
Interface
Seq Lib
Driver
VSEQ_LIB
Config
Sub Config
Sub Config
Page 101
Page 102
Move any directories out of code tree that should not be converted
- OVM_RGM directory and/or legacy code
Page 104
On-going clean-up
- Remove other deprecated OVM calls (mostly super.build or straight build calls)
Page 105
Results
Conversion process has been used successfully in multiple groups
- Current 4 projects have converted over the last year.
Page 106
Charles Zhang
Principal Verification
Engineer
Verification Architect
Altera Corp
Paradigm Works
Page 107
Outline
Overview
- Verilog based verification environment
- Why UVM?
- New UVM based verification environment
- FPGA chip verification flow
Some of the challenges and solutions
- Generic programmable logic
- Legacy code integration.
- Programmable core & IO connection
- VIP integration(external and internal)
Page 108
Page 109
Why UVM?
Supported and released by Accellera
Supported by all major EDA vendors
Object orient programming
Reusability (vertical and horizontal)
Well defined base class library
Industry standard makes integration of third party or
home grown VIP easier
Good online documentation + UVM forums etc
Little bit harder for designer to understand
Page 110
Avalon UVC
BFM2
BFM3
Core logic VC
vi
vi
interface
interface
interface
interface
interface
SCOREBOARD1
vi
IO
Avalon
slave
VIP1
IP
UVM VIP
Configurator
CONFIG
DATABASE
P
M
A
VIP2
P
C
S
VIP2
P
C
S
CORE
interface
VIP3
vi
VIP1
IP
P
M
A
UVM VIP
Configurator
VIP3
interface
VIP4
vi
Control
Block
AS Config UVC vi
interface
IO
Flash
memory
model
Memory Controller
Config
Data
Image
interface
SCOREBOARD2
Vermeer
model/
other
models
interface
interface
vi
Jtag UVC
vi
Clock UVC
Memory VIPs
Page 111
Page 113
Page 114
VIP integration
Lots of VIPs to address hard IP in FPGA(1G/10G, PCIe plus other
serial protocols, Altera Avalon VIP, different memory VIP for different
memory protocols)
Flexibility to configure and select VIPs in UVM test
Use constraints to select the connections and VIPs
Use on the fly point-to-point connections to connect VIP to the fabric
- Turn off unused VIPs
Same environment for integrating different vendor VIPs
Environment setup for proliferation products for same FPGA family
VIP interface easily portable to future FPGA families
Page 117
To
External
DUT
To
External
DUT
Avalon BFM
Summary
Alteras first verification project adopting UVM
Addressed critical challenges
Programmable user logic and io
Explosive configuration spaces, etc.
Adopted pragmatic view of the methodology
Re-architected the whole environment using UVM
Reused and integrated both internal and external VIPs
UVM provides ideal way to create configurable, reusable verification
components and environment
Page 119
Q&A
Thank You!
Contributor: Manish Mahajan
Page 120