2016-DVClub-PDX Adopting Uvm Seminar
2016-DVClub-PDX Adopting Uvm Seminar
2016-DVClub-PDX Adopting Uvm Seminar
www.sutherland-hdl.com
contains proprietary, confidential and copyrighted material of Sutherland HDL, Inc.
phone: +1-503-692-0898
e-mail: [email protected]
web: www.sutherland-hdl.com
Seminar Objectives...
UVM
an Ugly Vicious Monster!
UVM Origins
10
Testbench branch
(permanent objects)
uvm_object
uvm_transaction
uvm_sequence_item
uvm_report_handler
uvm_report_object
uvm_sequence
uvm_subscriber
uvm_test
uvm_component
uvm_agent
uvm_env
TLM Ports
uvm_driver
uvm_sequencer
uvm_scoreboard
uvm_monitor
11
Stimulus
transaction
generator
(sequence)
(test behavior)
scoreboard
coverage collector
agent(s)
monitor
coverage collector
sequencer
transactions
DUT
interface
signals
interface
signals
driver
interface
virtual sequencer
transactions
predictor evaluator
configuration
(test structure)
environment
configuration
Testbench
transaction
generator
(sequence)
transactions
12
TLM Communication
TLM ports pass handles of
sequence_item objects
UVM also
implements the
TLM 2.0 standard
consumer
export
consumer
export
port
consumer
imp export
13
usb2_test
USB 1 agent
here is a
USB 3 agent
14
UVM Phases
start of simulation
run
run
phase
extract
check
report
cleanup
phases
15
endclass: my_agent
task run_phase(...);
... // evaluate dut outputs
endtask
Each phase does not end until all activity for that phase type has completed in every
component (e.g.: all build phases must complete before any connect phase can start)
16
The Wizard of OZ
movie (1939) applies to UVM!
A virtual wizard behind the scenes
takes care of running the UVM
testbench all you need to do is tell
the wizard which test to run
17
The objection flag can be abused if not careful two GOTCHAS to watch out for:
Simulation will end at time 0 if no run_phase() tasks raise their objection flag
Simulation will never end if a run_phase() task raises its objection flag and then
locks up waiting for something to happen (or gets stuck in an infinite loop)
18
pre-reset
reset
post-reset
pre-config
config
post-config
run
CAUTION:
The UVM 1.0/1.1 standards have
problems with the implementation of
run phase subdivisions
UVM 1.2 deprecates the UVM 1.0/1.1
subdivided run phases and replaces it
with a different mechanism
pre-main
extract
check
report
final
main
post-main
pre-shutdown
shutdown
RECOMMENDATION:
Avoid using the additional run-time
phases, unless absolutely needed
post-shutdown
19
20
Sequence Items
(aka Transactions)
// input to DUT
// output from DUT
10
21
Sequences
The Transaction Generator
specializes the
sequence to a specific
sequence_item type
`uvm_object_utils(tx_sequence)
function new(string name="hello_sequence"); Register class name; call super.new
super.new(name);
endfunction
Generating a transaction involves 4 steps:
task body();
tx = hello_tx::type_id::create("tx"); First transaction:
start_item(tx);
1) Create a transaction using the factory
tx.go = 1'b1;
2) Wait for driver to ask for a transaction
finish_item(tx);
3) Set the transaction values
tx = hello_tx::type_id::create("tx"); 4) Pass the transaction to the driver
start_item(tx);
tx.go = 1'b0;
The next transaction repeats the 4 steps
finish_item(tx);
endtask: body
endclass: hello_sequence
22
All sequencer
class hello_sequencer extends uvm_sequencer #(hello_tx);
functionality is
... // register this class name in the factory
inherited from its base
endclass: hello_sequencer
The driver sends the stimulus to the Device Under Test (DUT)
Specialized to work with a
class hello_driver extends uvm_driver #(hello_tx);
specific sequence_item type
... // register this class name in the factory
function void build_phase(uvm_phase phase);
if (!uvm_config_db #(virtual hello_if)::get(this, "", "vif", vif))
`uvm_fatal("NOVIF","No virtual interface") The virtual interface is retrieved
endfunction: build_phase
from a database
task run_phase(uvm_phase phase);
The driver is a forever infinite loop it runs
hello_tx tx;
until the test drops its objection flag
forever begin
@(negedge vif.cb) ;
// sync up with inactive edge of DUT clock
seq_item_port.get(tx); // request a transaction from the sequencer
vif.cb.go <= tx.go;
// drive the DUT with the stimulus
end
UVM drivers use an interface clocking block to avoid race
endtask: run_phase
conditions enables reuse of UVM testbenches
endclass: hello_driver
11
23
Monitors
A UVM monitor:
Observes the values going in to the DUT
1-24
An Example Monitor
12
25
UVM Agents
class hello_agent
... // register
hello_sequencer
hello_driver
hello_monitor
extends uvm_agent;
this class name in the factory
sqr;
drv;
mon;
26
Scoreboards
13
27
An Example Scoreboard
predictor;
evaluator;
Connect up the
predictor and
evaluator
endclass: hello_scoreboard
The code for the predictor and evaluator components are not shown for this example
28
14
29
30
Hooking Everything Up
and Starting UVM
Structural
Construction
Object
Construction
15
1-31
32
16
33
Additional Resources
34
Summary:
UVM Pros and Cons
UVM 1.1 is good, but UVM 1.2 is not backward compatible and will
likely be changed as the IEEE make it a standard
UVM will let engineers do things wrong limits VIP and reuse
17
35
Tools that organize the many files that make up a UVM testbench
Tools that generate skeleton UVM components
2) Top-notch consultants
36
18