SlideShare a Scribd company logo
John Aynsley, Doulos
The Finer Points of UVM:
Tasting Tips
for the Connoisseur
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
The Big Picture
3
uvm_envuvm_env
uvm_agentuvm_agent
Sequences and Sequencers
4
TLM exportTLM export
TLM portTLM port
start_item(req);
finish_item(req);
seq_item_port.get(req);
A Simple Sequence
5
class my_seq extends uvm_sequence #(my_tx);
`uvm_object_utils(my_seq)
function new(string name = "");
super.new(name);
endfunction: new
task body;
repeat(4)
begin
req = my_tx::type_id::create("req");
start_item(req);
if (!req.randomize())
`uvm_error("", "failed to randomize")
finish_item(req);
end
endtask
endclass
Nested Sequences
6
class top_seq extends uvm_sequence #(my_tx);
...
`uvm_declare_p_sequencer(my_seqr)
...
task body;
repeat(3)
begin
my_seq seq;
seq = my_seq::type_id::create("seq");
if (!seq.randomize())
`uvm_error("", "failed to randomize")
seq.start(p_sequencer, this);
end
endtask
... Parent sequenceParent sequenceSequencerSequencer
Variable that points to sequencerVariable that points to sequencer
Concurrent Sequences
7
task body;
fork
begin
seq1 = my_seq::type_id::create("seq1");
if (!seq1.randomize())
`uvm_error("", "failed to randomize")
seq1.start(p_sequencer, this);
end
begin
seq2 = my_seq::type_id::create("seq2");
if (!seq2.randomize())
...
seq2.start(p_sequencer, this);
end
begin
...
seq3.start(p_sequencer, this);
end
join
endtask
Transactions will be strictly interleavedTransactions will be strictly interleaved
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
The Arbitration Queue
9
priority
sequence
priority
sequence
priority
sequence
priority
sequence
priority
sequence
priority
sequence
Arbitration queueArbitration queue
First inFirst in
start
body
start_item
seq_item_port.get(req);
Arbitration
start
body
start_item
fork
start
body
start_item
seq_item_port.get(req);
seq_item_port.get(req);
begin
finish_item
finish_item
finish_item
FIFOFIFO
join
end
Setting the Arbritration Algorithm
10
task body;
p_sequencer.set_arbitration(
SEQ_ARB_STRICT_RANDOM);
fork
begin
seq1 = my_seq::type_id::create("seq1");
if (!seq1.randomize())
`uvm_error("", "failed to randomize")
seq1.start(p_sequencer, this, 1);
end
begin
...
seq2.start(p_sequencer, this, 2);
end
begin
...
seq3.start(p_sequencer, this, 3);
end
join
endtask Priority (default 100)Priority (default 100)
Arbitration Algorithms
11
Arbitration mode Order in which requests granted
SEQ_ARB_FIFO FIFO order (default)
SEQ_ARB_RANDOM Random order
SEQ_ARB_STRICT_FIFO Highest priority first, then FIFO order
SEQ_ARB_STRICT_RANDOM Highest priority first, then random order
SEQ_ARB_WEIGHTED Weighted by priority
SEQ_ARB_USER User-defined
User-Defined Arbitration Algorithm
12
class my_sequencer extends uvm_sequencer #(my_tx);
...
function integer user_priority_arbitration(
integer avail_sequences[$]);
foreach (avail_sequences[i])
begin
integer index = avail_sequences[i];
uvm_sequence_request req = arb_sequence_q[index];
int pri = req.item_priority;
uvm_sequence_base seq = req.sequence_ptr;
if (pri > max_pri)
...
end
return max_index;
endfunction
endclass
Could access properties of the sequence objectCould access properties of the sequence object
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
Virtual Sequences
14
priority
seq1
priority
seq1
vseq.start(seqr0, null, priority)
body
fork
seq1.start(seqr1, this)
body
start_item
...
seq2.start(seqr2, this, 50)
body
start_item
...
seqr1
seqr2
seqr3
Blocks
Inherits priority
Blocks
Inherits priority
seqr0 Can be nullCan be null
No transactions
Sequencer Lock
15
seqr1
seqr0
No transactions
vseq.start(seqr0, null)
body
begin
this.lock(seqr1);
seq1.start(seqr1, this);
body
start_item
finish_item
this.unlock(seqr1);
...
priority
seqx
priority
seqx
priority
seqy
priority
seqy
priority
seq1
priority
seq1
Important!Important!
Lock versus Grab
16
priority
seqx
priority
seqx
priority
seqy
priority
seqy
vseq1.start
body
begin
lock
seq1.start
unlock
vseq2.start
body
begin
lock
seq2.start
unlock
vseq3.start
body
begin
grab
seq3.start
ungrab
lock req
vseq2
lock req
vseq2
grab req
vseq3
grab req
vseq3
priority
seq3
priority
seq3
Locks
inserted
here
Locks
inserted
here
Grabs
inserted
here
Grabs
inserted
here
Head Tail
priority
seq1
priority
seq1
priority
seq2
priority
seq2
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
Request and Response
18
TLM exportTLM export
TLM portTLM port
start_item(req);
finish_item(req);
get_response(rsp);
seq_item_port.get(req);
seq_item_port.put(rsp);
req rsp
The paper describes in detail
how to code pipelined req/rsp
and out-of-order responses
The paper describes in detail
how to code pipelined req/rsp
and out-of-order responses
Layered Sequencers
19
seq_item_port.get(req);
seq_item_port.put(rsp);
seqr_upper.get(req_up);
start_item(req_lo);
finish_item(req_lo);
get_response(rsp_lo);
seqr_upper.put(rsp_up);
start_item(req);
finish_item(req);
get_response(rsp);
req rsp
req rsp
Ptr to upper
sequencer
Ptr to upper
sequencer
Could be
one:one or
one:many or
many:one or
many:many
Could be
one:one or
one:many or
many:one or
many:many
The paper shows more detailThe paper shows more detail
req:rsp = 1:1req:rsp = 1:1
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
Multiple Agents / Sequencer Stacks
21
Communicate or
synchronize?
Communicate or
synchronize?
get(req)
Must not
block!
Must not
block!Driven by the DUT interface timingDriven by the DUT interface timing
Analysis ports
Callbacks
Events
Barriers
Analysis ports
Callbacks
Events
Barriers
Driver calls try_next_item
22
seq_item_port.try_next_item(req);
if (req == null)
begin
dut_vi.idle <= 1;
...
@(posedge dut_vi.clock);
end
else
begin
seq_item_port.item_done();
dut_vi.idle <= 0;
...
@(posedge dut_vi.clock);
...
seq_item_port.put(rsp);
Wiggle pins for idle cycleWiggle pins for idle cycle
Must be called in same time stepMust be called in same time step
Response can be pipelinedResponse can be pipelined
The Finer Points of UVM
• The UVM sequence library
• Pipelined requests and responses
• The response handler
• UVM events and event pools
• The configuration database
Also in the paperAlso in the paper

More Related Content

PPTX
System verilog assertions
ODP
Pc ie tl_layer (3)
PDF
Verification Strategy for PCI-Express
PPT
PDF
UVM: Basic Sequences
PDF
UVM Methodology Tutorial
PDF
Session 8,9 PCI Express
PPTX
AXI Protocol.pptx
System verilog assertions
Pc ie tl_layer (3)
Verification Strategy for PCI-Express
UVM: Basic Sequences
UVM Methodology Tutorial
Session 8,9 PCI Express
AXI Protocol.pptx

What's hot (20)

PDF
UVM TUTORIAL;
ODP
axi protocol
PDF
Uvm presentation dac2011_final
PPT
Axi protocol
PDF
Session 8 assertion_based_verification_and_interfaces
PDF
System verilog important
PDF
How to create SystemVerilog verification environment?
PDF
Session 9 advance_verification_features
PDF
UVM Update: Register Package
PDF
Efficient Methodology of Sampling UVM RAL During Simulation for SoC Functiona...
PPTX
Embedded System Programming on ARM Cortex M3 and M4 Course
PPT
PCIe and PCIe driver in WEC7 (Windows Embedded compact 7)
PDF
System verilog verification building blocks
PPT
Spi master core verification
PDF
Challenges in Using UVM at SoC Level
PDF
Tutorial getting started with RISC-V verification
PPTX
AMBA AHB 5
ODP
PCIe DL_layer_3.0.1 (1)
PDF
PCI Express Verification using Reference Modeling
PPTX
SOC Verification using SystemVerilog
UVM TUTORIAL;
axi protocol
Uvm presentation dac2011_final
Axi protocol
Session 8 assertion_based_verification_and_interfaces
System verilog important
How to create SystemVerilog verification environment?
Session 9 advance_verification_features
UVM Update: Register Package
Efficient Methodology of Sampling UVM RAL During Simulation for SoC Functiona...
Embedded System Programming on ARM Cortex M3 and M4 Course
PCIe and PCIe driver in WEC7 (Windows Embedded compact 7)
System verilog verification building blocks
Spi master core verification
Challenges in Using UVM at SoC Level
Tutorial getting started with RISC-V verification
AMBA AHB 5
PCIe DL_layer_3.0.1 (1)
PCI Express Verification using Reference Modeling
SOC Verification using SystemVerilog
Ad

Viewers also liked (8)

PPTX
Demo
PDF
Uvm cookbook-systemverilog-guidelines-verification-academy
PDF
Trading with opensource tools, two years later
PDF
Example my hdl
PPTX
UVM Ral model usage
PDF
Coverage and Introduction to UVM
PPTX
Verilog HDL
PDF
Semiconductor industry for IoT Entrepreneurs
Demo
Uvm cookbook-systemverilog-guidelines-verification-academy
Trading with opensource tools, two years later
Example my hdl
UVM Ral model usage
Coverage and Introduction to UVM
Verilog HDL
Semiconductor industry for IoT Entrepreneurs
Ad

Similar to Uvm dcon2013 (20)

PPT
Sequential_Modelling Design Explainations
PPTX
UVM Driver sequencer handshaking
PDF
MultiThreading-in-system-and-android-logcat-42-.pdf
PPTX
Computer Operating Systems Concurrency Slide
PDF
Much Ado About Blocking: Wait/Wakke in the Linux Kernel
KEY
Lock? We don't need no stinkin' locks!
KEY
Locks? We Don't Need No Stinkin' Locks - Michael Barker
PDF
Wait for your fortune without Blocking!
PPT
bluespec talk
PPTX
Async and parallel patterns and application design - TechDays2013 NL
PDF
The Ring programming language version 1.9 book - Part 101 of 210
PDF
10 Techniques to writing easy yet stupidly thorough unit tests.pdf
PDF
Process Doppelgänging
PDF
Lie to Me: Bypassing Modern Web Application Firewalls
KEY
JavaOne 2012 - JVM JIT for Dummies
PDF
Building Hermetic Systems (without Docker)
PDF
Ruxmon cve 2012-2661
PDF
Everything you wanted to know about Stack Traces and Heap Dumps
PPTX
Sangam 18 - Database Development: Return of the SQL Jedi
PPTX
Random stability in systemVerilog and UVM based testbench
Sequential_Modelling Design Explainations
UVM Driver sequencer handshaking
MultiThreading-in-system-and-android-logcat-42-.pdf
Computer Operating Systems Concurrency Slide
Much Ado About Blocking: Wait/Wakke in the Linux Kernel
Lock? We don't need no stinkin' locks!
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Wait for your fortune without Blocking!
bluespec talk
Async and parallel patterns and application design - TechDays2013 NL
The Ring programming language version 1.9 book - Part 101 of 210
10 Techniques to writing easy yet stupidly thorough unit tests.pdf
Process Doppelgänging
Lie to Me: Bypassing Modern Web Application Firewalls
JavaOne 2012 - JVM JIT for Dummies
Building Hermetic Systems (without Docker)
Ruxmon cve 2012-2661
Everything you wanted to know about Stack Traces and Heap Dumps
Sangam 18 - Database Development: Return of the SQL Jedi
Random stability in systemVerilog and UVM based testbench

More from sean chen (20)

PPT
0021.system partitioning
PPT
0015.register allocation-graph-coloring
PPT
0006.scheduling not-ilp-not-force
PDF
Lecture07
PDF
Lecture04
PDF
Lecture03
ODP
Dominator tree
PDF
Work items
PDF
Work items
ODP
ocelot
PDF
Lect.10.arm soc.4 neon
ODP
Image scalar hw_algorithm
PPT
Virtual platform
PPT
PPT
Serializer
PPT
Defense
PPT
Defense
PPT
I2 c
PPT
Uart
PPT
Linux mouse
0021.system partitioning
0015.register allocation-graph-coloring
0006.scheduling not-ilp-not-force
Lecture07
Lecture04
Lecture03
Dominator tree
Work items
Work items
ocelot
Lect.10.arm soc.4 neon
Image scalar hw_algorithm
Virtual platform
Serializer
Defense
Defense
I2 c
Uart
Linux mouse

Uvm dcon2013

  • 1. John Aynsley, Doulos The Finer Points of UVM: Tasting Tips for the Connoisseur
  • 2. The Finer Points of UVM • Sequences and sequencers • The arbitration queue • Virtual sequences • Request and response • Multiple sequencer stacks
  • 4. Sequences and Sequencers 4 TLM exportTLM export TLM portTLM port start_item(req); finish_item(req); seq_item_port.get(req);
  • 5. A Simple Sequence 5 class my_seq extends uvm_sequence #(my_tx); `uvm_object_utils(my_seq) function new(string name = ""); super.new(name); endfunction: new task body; repeat(4) begin req = my_tx::type_id::create("req"); start_item(req); if (!req.randomize()) `uvm_error("", "failed to randomize") finish_item(req); end endtask endclass
  • 6. Nested Sequences 6 class top_seq extends uvm_sequence #(my_tx); ... `uvm_declare_p_sequencer(my_seqr) ... task body; repeat(3) begin my_seq seq; seq = my_seq::type_id::create("seq"); if (!seq.randomize()) `uvm_error("", "failed to randomize") seq.start(p_sequencer, this); end endtask ... Parent sequenceParent sequenceSequencerSequencer Variable that points to sequencerVariable that points to sequencer
  • 7. Concurrent Sequences 7 task body; fork begin seq1 = my_seq::type_id::create("seq1"); if (!seq1.randomize()) `uvm_error("", "failed to randomize") seq1.start(p_sequencer, this); end begin seq2 = my_seq::type_id::create("seq2"); if (!seq2.randomize()) ... seq2.start(p_sequencer, this); end begin ... seq3.start(p_sequencer, this); end join endtask Transactions will be strictly interleavedTransactions will be strictly interleaved
  • 8. The Finer Points of UVM • Sequences and sequencers • The arbitration queue • Virtual sequences • Request and response • Multiple sequencer stacks
  • 9. The Arbitration Queue 9 priority sequence priority sequence priority sequence priority sequence priority sequence priority sequence Arbitration queueArbitration queue First inFirst in start body start_item seq_item_port.get(req); Arbitration start body start_item fork start body start_item seq_item_port.get(req); seq_item_port.get(req); begin finish_item finish_item finish_item FIFOFIFO join end
  • 10. Setting the Arbritration Algorithm 10 task body; p_sequencer.set_arbitration( SEQ_ARB_STRICT_RANDOM); fork begin seq1 = my_seq::type_id::create("seq1"); if (!seq1.randomize()) `uvm_error("", "failed to randomize") seq1.start(p_sequencer, this, 1); end begin ... seq2.start(p_sequencer, this, 2); end begin ... seq3.start(p_sequencer, this, 3); end join endtask Priority (default 100)Priority (default 100)
  • 11. Arbitration Algorithms 11 Arbitration mode Order in which requests granted SEQ_ARB_FIFO FIFO order (default) SEQ_ARB_RANDOM Random order SEQ_ARB_STRICT_FIFO Highest priority first, then FIFO order SEQ_ARB_STRICT_RANDOM Highest priority first, then random order SEQ_ARB_WEIGHTED Weighted by priority SEQ_ARB_USER User-defined
  • 12. User-Defined Arbitration Algorithm 12 class my_sequencer extends uvm_sequencer #(my_tx); ... function integer user_priority_arbitration( integer avail_sequences[$]); foreach (avail_sequences[i]) begin integer index = avail_sequences[i]; uvm_sequence_request req = arb_sequence_q[index]; int pri = req.item_priority; uvm_sequence_base seq = req.sequence_ptr; if (pri > max_pri) ... end return max_index; endfunction endclass Could access properties of the sequence objectCould access properties of the sequence object
  • 13. The Finer Points of UVM • Sequences and sequencers • The arbitration queue • Virtual sequences • Request and response • Multiple sequencer stacks
  • 14. Virtual Sequences 14 priority seq1 priority seq1 vseq.start(seqr0, null, priority) body fork seq1.start(seqr1, this) body start_item ... seq2.start(seqr2, this, 50) body start_item ... seqr1 seqr2 seqr3 Blocks Inherits priority Blocks Inherits priority seqr0 Can be nullCan be null No transactions
  • 15. Sequencer Lock 15 seqr1 seqr0 No transactions vseq.start(seqr0, null) body begin this.lock(seqr1); seq1.start(seqr1, this); body start_item finish_item this.unlock(seqr1); ... priority seqx priority seqx priority seqy priority seqy priority seq1 priority seq1 Important!Important!
  • 16. Lock versus Grab 16 priority seqx priority seqx priority seqy priority seqy vseq1.start body begin lock seq1.start unlock vseq2.start body begin lock seq2.start unlock vseq3.start body begin grab seq3.start ungrab lock req vseq2 lock req vseq2 grab req vseq3 grab req vseq3 priority seq3 priority seq3 Locks inserted here Locks inserted here Grabs inserted here Grabs inserted here Head Tail priority seq1 priority seq1 priority seq2 priority seq2
  • 17. The Finer Points of UVM • Sequences and sequencers • The arbitration queue • Virtual sequences • Request and response • Multiple sequencer stacks
  • 18. Request and Response 18 TLM exportTLM export TLM portTLM port start_item(req); finish_item(req); get_response(rsp); seq_item_port.get(req); seq_item_port.put(rsp); req rsp The paper describes in detail how to code pipelined req/rsp and out-of-order responses The paper describes in detail how to code pipelined req/rsp and out-of-order responses
  • 19. Layered Sequencers 19 seq_item_port.get(req); seq_item_port.put(rsp); seqr_upper.get(req_up); start_item(req_lo); finish_item(req_lo); get_response(rsp_lo); seqr_upper.put(rsp_up); start_item(req); finish_item(req); get_response(rsp); req rsp req rsp Ptr to upper sequencer Ptr to upper sequencer Could be one:one or one:many or many:one or many:many Could be one:one or one:many or many:one or many:many The paper shows more detailThe paper shows more detail req:rsp = 1:1req:rsp = 1:1
  • 20. The Finer Points of UVM • Sequences and sequencers • The arbitration queue • Virtual sequences • Request and response • Multiple sequencer stacks
  • 21. Multiple Agents / Sequencer Stacks 21 Communicate or synchronize? Communicate or synchronize? get(req) Must not block! Must not block!Driven by the DUT interface timingDriven by the DUT interface timing Analysis ports Callbacks Events Barriers Analysis ports Callbacks Events Barriers
  • 22. Driver calls try_next_item 22 seq_item_port.try_next_item(req); if (req == null) begin dut_vi.idle <= 1; ... @(posedge dut_vi.clock); end else begin seq_item_port.item_done(); dut_vi.idle <= 0; ... @(posedge dut_vi.clock); ... seq_item_port.put(rsp); Wiggle pins for idle cycleWiggle pins for idle cycle Must be called in same time stepMust be called in same time step Response can be pipelinedResponse can be pipelined
  • 23. The Finer Points of UVM • The UVM sequence library • Pipelined requests and responses • The response handler • UVM events and event pools • The configuration database Also in the paperAlso in the paper