john aynsley , doulos
DESCRIPTION
The Finer Points of UVM: Tasting Tips for the Connoisseur. John Aynsley , Doulos. The Finer Points of UVM. Sequences and sequencers The arbitration queue Virtual sequences Request and response Multiple sequencer stacks. The Big Picture. uvm_test. uvm_test. uvm_env. Factory. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/1.jpg)
John Aynsley, Doulos
The Finer Points of UVM:Tasting Tipsfor the Connoisseur
![Page 2: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/2.jpg)
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
![Page 3: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/3.jpg)
The Big Picture
3
uvm_env
uvm_scoreboard Virtual sequencer
DUT
uvm_agentuvm_agent
uvm_agent
uvm_sequencer
uvm_driveruvm_monitor
uvm_test
uvm_test
Factory config db
uvm_agent
Register Layer
![Page 4: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/4.jpg)
Sequences and Sequencers
4
Sequencer
Driver
Sequence
Sequence
DUT
TLM export
TLM port
start_item(req);finish_item(req);
seq_item_port.get(req);
![Page 5: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/5.jpg)
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 endtaskendclass
![Page 6: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/6.jpg)
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
sequenceSequencer
Variable that points to sequencer
![Page 7: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/7.jpg)
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 joinendtask
Transactions will be strictly interleaved
![Page 8: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/8.jpg)
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
![Page 9: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/9.jpg)
Sequencer
The Arbitration Queue
9
Driver
priority
sequence
priority
sequence
priority
sequence
Arbitration queue
First 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
FIFO
join
end
![Page 10: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/10.jpg)
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 joinendtask Priority (default 100)
![Page 11: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/11.jpg)
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
![Page 12: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/12.jpg)
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 object
![Page 13: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/13.jpg)
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
![Page 14: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/14.jpg)
Sequencer
Driver
Sequencer
Driver
Virtual Sequences
14
Sequencer
Driver
priority
seq1
Sequencer
Virtual sequence vseq.start(seqr0, null, priority)
body
fork
seq1.start(seqr1, this)
body
start_item
...
seq2.start(seqr2, this, 50)
body
start_item
...
seqr1seqr2
seqr3
BlocksInherits priority
seqr0 Can be null
No transactions
![Page 15: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/15.jpg)
Sequencer Lock
15
Sequencer
Driver
Sequencer
Virtual sequence
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
seqy
priority
seq1
Important!
![Page 16: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/16.jpg)
Lock versus Grab
16
Sequencer
Driver
Virtual sequence
priority
seqx
priority
seqy
vseq1.start
body
begin
lock
seq1.start
unlock
Virtual sequence
vseq2.start
body
begin
lock
seq2.start
unlock
Virtual sequence
vseq3.start
body
begin
grab
seq3.start
ungrab
lock req
vseq2
grab req
vseq3
priority
seq3
Locks inserted here
Grabs inserted here
Head Tailpriority
seq1
priority
seq2
![Page 17: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/17.jpg)
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
![Page 18: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/18.jpg)
Request and Response
18
Sequencer
Driver
Sequence
TLM export
TLM port
start_item(req);finish_item(req);get_response(rsp);
seq_item_port.get(req);seq_item_port.put(rsp);
req rsp
DUTThe paper describes in detail how to code pipelined req/rsp and out-of-order responses
![Page 19: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/19.jpg)
Layered Sequencers
19
Sequencer
Driver
Sequencer
Sequence
Sequence
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
Could be one:one or one:many or many:one or many:many
DUTThe paper shows more detail
req:rsp = 1:1
![Page 20: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/20.jpg)
The Finer Points of UVM
• Sequences and sequencers
• The arbitration queue
• Virtual sequences
• Request and response
• Multiple sequencer stacks
![Page 21: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/21.jpg)
Multiple Agents / Sequencer Stacks
21
Sequencer
Driver
Sequencer
Sequence
Sequence
Sequencer
Driver
Sequencer
Sequence
Sequence
Communicate or synchronize?
get(req)
Must not block!Driven by the DUT interface
timing
Analysis ports Callbacks Events Barriers
DUT
![Page 22: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/22.jpg)
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);endelsebegin seq_item_port.item_done();
dut_vi.idle <= 0; ... @(posedge dut_vi.clock); ... seq_item_port.put(rsp);
Wiggle pins for idle cycle
Must be called in same time step
Response can be pipelined
![Page 23: John Aynsley , Doulos](https://reader033.vdocument.in/reader033/viewer/2022061608/568166c9550346895ddad68b/html5/thumbnails/23.jpg)
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 paper