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

What's hot

SystemVerilog based OVM and UVM Verification Methodologies
SystemVerilog based OVM and UVM Verification MethodologiesSystemVerilog based OVM and UVM Verification Methodologies
SystemVerilog based OVM and UVM Verification Methodologies
Ramdas Mozhikunnath
 
SOC Verification using SystemVerilog
SOC Verification using SystemVerilog SOC Verification using SystemVerilog
SOC Verification using SystemVerilog
Ramdas Mozhikunnath
 
Spi master core verification
Spi master core verificationSpi master core verification
Spi master core verificationMaulik Suthar
 
PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)
Rakeshkumar Sachdev
 
System verilog important
System verilog importantSystem verilog important
System verilog important
elumalai7
 
System verilog coverage
System verilog coverageSystem verilog coverage
System verilog coverage
Pushpa Yakkala
 
UVM Update: Register Package
UVM Update: Register PackageUVM Update: Register Package
UVM Update: Register PackageDVClub
 
Uvm dac2011 final_color
Uvm dac2011 final_colorUvm dac2011 final_color
Uvm dac2011 final_color
Jamal EL HAITOUT
 
System verilog assertions (sva) ( pdf drive )
System verilog assertions (sva) ( pdf drive )System verilog assertions (sva) ( pdf drive )
System verilog assertions (sva) ( pdf drive )
sivasubramanian manickam
 
axi protocol
axi protocolaxi protocol
axi protocol
Azad Mishra
 
UVM ARCHITECTURE FOR VERIFICATION
UVM ARCHITECTURE FOR VERIFICATIONUVM ARCHITECTURE FOR VERIFICATION
UVM ARCHITECTURE FOR VERIFICATION
IAEME Publication
 
How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?
Sameh El-Ashry
 
Session 8,9 PCI Express
Session 8,9 PCI ExpressSession 8,9 PCI Express
Session 8,9 PCI ExpressSubhash Iyer
 
Challenges in Using UVM at SoC Level
Challenges in Using UVM at SoC LevelChallenges in Using UVM at SoC Level
Challenges in Using UVM at SoC LevelDVClub
 
UVM Driver sequencer handshaking
UVM Driver sequencer handshakingUVM Driver sequencer handshaking
UVM Driver sequencer handshaking
HARINATH REDDY
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
Rohit Kumar Pathak
 
CPU Verification
CPU VerificationCPU Verification
CPU Verification
Ramdas Mozhikunnath
 
Verilog TASKS & FUNCTIONS
Verilog TASKS & FUNCTIONSVerilog TASKS & FUNCTIONS
Verilog TASKS & FUNCTIONS
Dr.YNM
 
systemverilog-interview-questions.docx
systemverilog-interview-questions.docxsystemverilog-interview-questions.docx
systemverilog-interview-questions.docx
ssuser1c8ca21
 
AXI Protocol.pptx
AXI Protocol.pptxAXI Protocol.pptx
AXI Protocol.pptx
Yazan Yousef
 

What's hot (20)

SystemVerilog based OVM and UVM Verification Methodologies
SystemVerilog based OVM and UVM Verification MethodologiesSystemVerilog based OVM and UVM Verification Methodologies
SystemVerilog based OVM and UVM Verification Methodologies
 
SOC Verification using SystemVerilog
SOC Verification using SystemVerilog SOC Verification using SystemVerilog
SOC Verification using SystemVerilog
 
Spi master core verification
Spi master core verificationSpi master core verification
Spi master core verification
 
PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)
 
System verilog important
System verilog importantSystem verilog important
System verilog important
 
System verilog coverage
System verilog coverageSystem verilog coverage
System verilog coverage
 
UVM Update: Register Package
UVM Update: Register PackageUVM Update: Register Package
UVM Update: Register Package
 
Uvm dac2011 final_color
Uvm dac2011 final_colorUvm dac2011 final_color
Uvm dac2011 final_color
 
System verilog assertions (sva) ( pdf drive )
System verilog assertions (sva) ( pdf drive )System verilog assertions (sva) ( pdf drive )
System verilog assertions (sva) ( pdf drive )
 
axi protocol
axi protocolaxi protocol
axi protocol
 
UVM ARCHITECTURE FOR VERIFICATION
UVM ARCHITECTURE FOR VERIFICATIONUVM ARCHITECTURE FOR VERIFICATION
UVM ARCHITECTURE FOR VERIFICATION
 
How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?
 
Session 8,9 PCI Express
Session 8,9 PCI ExpressSession 8,9 PCI Express
Session 8,9 PCI Express
 
Challenges in Using UVM at SoC Level
Challenges in Using UVM at SoC LevelChallenges in Using UVM at SoC Level
Challenges in Using UVM at SoC Level
 
UVM Driver sequencer handshaking
UVM Driver sequencer handshakingUVM Driver sequencer handshaking
UVM Driver sequencer handshaking
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
 
CPU Verification
CPU VerificationCPU Verification
CPU Verification
 
Verilog TASKS & FUNCTIONS
Verilog TASKS & FUNCTIONSVerilog TASKS & FUNCTIONS
Verilog TASKS & FUNCTIONS
 
systemverilog-interview-questions.docx
systemverilog-interview-questions.docxsystemverilog-interview-questions.docx
systemverilog-interview-questions.docx
 
AXI Protocol.pptx
AXI Protocol.pptxAXI Protocol.pptx
AXI Protocol.pptx
 

Viewers also liked

Demo
DemoDemo
Demo
sean chen
 
Uvm cookbook-systemverilog-guidelines-verification-academy
Uvm cookbook-systemverilog-guidelines-verification-academyUvm cookbook-systemverilog-guidelines-verification-academy
Uvm cookbook-systemverilog-guidelines-verification-academy
Raghavendra Kamath
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years laterclkao
 
Example my hdl
Example my hdlExample my hdl
Example my hdl
sean chen
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usage
Parth Pandya
 
Coverage and Introduction to UVM
Coverage and Introduction to UVMCoverage and Introduction to UVM
Coverage and Introduction to UVM
Dr. Shivananda Koteshwar
 
Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
Mantra VLSI
 
Semiconductor industry for IoT Entrepreneurs
Semiconductor industry for IoT EntrepreneursSemiconductor industry for IoT Entrepreneurs
Semiconductor industry for IoT Entrepreneurs
Dr. Shivananda Koteshwar
 

Viewers also liked (8)

Demo
DemoDemo
Demo
 
Uvm cookbook-systemverilog-guidelines-verification-academy
Uvm cookbook-systemverilog-guidelines-verification-academyUvm cookbook-systemverilog-guidelines-verification-academy
Uvm cookbook-systemverilog-guidelines-verification-academy
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years later
 
Example my hdl
Example my hdlExample my hdl
Example my hdl
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usage
 
Coverage and Introduction to UVM
Coverage and Introduction to UVMCoverage and Introduction to UVM
Coverage and Introduction to UVM
 
Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
 
Semiconductor industry for IoT Entrepreneurs
Semiconductor industry for IoT EntrepreneursSemiconductor industry for IoT Entrepreneurs
Semiconductor industry for IoT Entrepreneurs
 

Similar to Uvm dcon2013

Computer Operating Systems Concurrency Slide
Computer Operating Systems Concurrency SlideComputer Operating Systems Concurrency Slide
Computer Operating Systems Concurrency Slide
yasarcereen
 
Much Ado About Blocking: Wait/Wakke in the Linux Kernel
Much Ado About Blocking: Wait/Wakke in the Linux KernelMuch Ado About Blocking: Wait/Wakke in the Linux Kernel
Much Ado About Blocking: Wait/Wakke in the Linux Kernel
Davidlohr Bueso
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Michael Barker
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael Barker
JAX London
 
Wait for your fortune without Blocking!
Wait for your fortune without Blocking!Wait for your fortune without Blocking!
Wait for your fortune without Blocking!
Roman Elizarov
 
bluespec talk
bluespec talkbluespec talk
bluespec talk
Suman Karumuri
 
Async and parallel patterns and application design - TechDays2013 NL
Async and parallel patterns and application design - TechDays2013 NLAsync and parallel patterns and application design - TechDays2013 NL
Async and parallel patterns and application design - TechDays2013 NL
Arie Leeuwesteijn
 
The Ring programming language version 1.9 book - Part 101 of 210
The Ring programming language version 1.9 book - Part 101 of 210The Ring programming language version 1.9 book - Part 101 of 210
The Ring programming language version 1.9 book - Part 101 of 210
Mahmoud Samir Fayed
 
Process Doppelgänging
Process Doppelgänging Process Doppelgänging
Process Doppelgänging
KarlFrank99
 
Lie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application FirewallsLie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application Firewalls
Ivan Novikov
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesCharles Nutter
 
Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)
William Farrell
 
Ruxmon cve 2012-2661
Ruxmon cve 2012-2661Ruxmon cve 2012-2661
Ruxmon cve 2012-2661
snyff
 
Everything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap DumpsEverything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap Dumps
Andrei Pangin
 
Sangam 18 - Database Development: Return of the SQL Jedi
Sangam 18 - Database Development: Return of the SQL JediSangam 18 - Database Development: Return of the SQL Jedi
Sangam 18 - Database Development: Return of the SQL Jedi
Connor McDonald
 
Random stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbenchRandom stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbench
Kashyap Adodariya
 
Node.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterNode.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitter
Simen Li
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder
 
Entrenamiento TestExec 8.1
Entrenamiento TestExec 8.1Entrenamiento TestExec 8.1
Entrenamiento TestExec 8.1
Interlatin
 
Down to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsDown to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap Dumps
Andrei Pangin
 

Similar to Uvm dcon2013 (20)

Computer Operating Systems Concurrency Slide
Computer Operating Systems Concurrency SlideComputer Operating Systems Concurrency Slide
Computer Operating Systems Concurrency Slide
 
Much Ado About Blocking: Wait/Wakke in the Linux Kernel
Much Ado About Blocking: Wait/Wakke in the Linux KernelMuch Ado About Blocking: Wait/Wakke in the Linux Kernel
Much Ado About Blocking: Wait/Wakke in the Linux Kernel
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael Barker
 
Wait for your fortune without Blocking!
Wait for your fortune without Blocking!Wait for your fortune without Blocking!
Wait for your fortune without Blocking!
 
bluespec talk
bluespec talkbluespec talk
bluespec talk
 
Async and parallel patterns and application design - TechDays2013 NL
Async and parallel patterns and application design - TechDays2013 NLAsync and parallel patterns and application design - TechDays2013 NL
Async and parallel patterns and application design - TechDays2013 NL
 
The Ring programming language version 1.9 book - Part 101 of 210
The Ring programming language version 1.9 book - Part 101 of 210The Ring programming language version 1.9 book - Part 101 of 210
The Ring programming language version 1.9 book - Part 101 of 210
 
Process Doppelgänging
Process Doppelgänging Process Doppelgänging
Process Doppelgänging
 
Lie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application FirewallsLie to Me: Bypassing Modern Web Application Firewalls
Lie to Me: Bypassing Modern Web Application Firewalls
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for Dummies
 
Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)
 
Ruxmon cve 2012-2661
Ruxmon cve 2012-2661Ruxmon cve 2012-2661
Ruxmon cve 2012-2661
 
Everything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap DumpsEverything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap Dumps
 
Sangam 18 - Database Development: Return of the SQL Jedi
Sangam 18 - Database Development: Return of the SQL JediSangam 18 - Database Development: Return of the SQL Jedi
Sangam 18 - Database Development: Return of the SQL Jedi
 
Random stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbenchRandom stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbench
 
Node.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterNode.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitter
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
 
Entrenamiento TestExec 8.1
Entrenamiento TestExec 8.1Entrenamiento TestExec 8.1
Entrenamiento TestExec 8.1
 
Down to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsDown to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap Dumps
 

More from sean chen

0021.system partitioning
0021.system partitioning0021.system partitioning
0021.system partitioningsean chen
 
0015.register allocation-graph-coloring
0015.register allocation-graph-coloring0015.register allocation-graph-coloring
0015.register allocation-graph-coloringsean chen
 
0006.scheduling not-ilp-not-force
0006.scheduling not-ilp-not-force0006.scheduling not-ilp-not-force
0006.scheduling not-ilp-not-forcesean chen
 
Dominator tree
Dominator treeDominator tree
Dominator treesean chen
 
Lect.10.arm soc.4 neon
Lect.10.arm soc.4 neonLect.10.arm soc.4 neon
Lect.10.arm soc.4 neonsean chen
 
Image scalar hw_algorithm
Image scalar hw_algorithmImage scalar hw_algorithm
Image scalar hw_algorithmsean chen
 
Virtual platform
Virtual platformVirtual platform
Virtual platformsean chen
 
Linux mouse
Linux mouseLinux mouse
Linux mouse
sean chen
 

More from sean chen (20)

0021.system partitioning
0021.system partitioning0021.system partitioning
0021.system partitioning
 
0015.register allocation-graph-coloring
0015.register allocation-graph-coloring0015.register allocation-graph-coloring
0015.register allocation-graph-coloring
 
0006.scheduling not-ilp-not-force
0006.scheduling not-ilp-not-force0006.scheduling not-ilp-not-force
0006.scheduling not-ilp-not-force
 
Lecture07
Lecture07Lecture07
Lecture07
 
Lecture04
Lecture04Lecture04
Lecture04
 
Lecture03
Lecture03Lecture03
Lecture03
 
Dominator tree
Dominator treeDominator tree
Dominator tree
 
Work items
Work itemsWork items
Work items
 
Work items
Work itemsWork items
Work items
 
ocelot
ocelotocelot
ocelot
 
Lect.10.arm soc.4 neon
Lect.10.arm soc.4 neonLect.10.arm soc.4 neon
Lect.10.arm soc.4 neon
 
Image scalar hw_algorithm
Image scalar hw_algorithmImage scalar hw_algorithm
Image scalar hw_algorithm
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
Spi
SpiSpi
Spi
 
Serializer
SerializerSerializer
Serializer
 
Defense
DefenseDefense
Defense
 
Defense
DefenseDefense
Defense
 
I2 c
I2 cI2 c
I2 c
 
Uart
UartUart
Uart
 
Linux mouse
Linux mouseLinux mouse
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