Uvm dcon2013

2,306 views

Published on

0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,306
On SlideShare
0
From Embeds
0
Number of Embeds
498
Actions
Shares
0
Downloads
0
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Uvm dcon2013

  1. 1. John Aynsley, DoulosThe Finer Points of UVM:Tasting Tipsfor the Connoisseur
  2. 2. The Finer Points of UVM• Sequences and sequencers• The arbitration queue• Virtual sequences• Request and response• Multiple sequencer stacks
  3. 3. The Big Picture3uvm_envuvm_envuvm_agentuvm_agent
  4. 4. Sequences and Sequencers4TLM exportTLM exportTLM portTLM portstart_item(req);finish_item(req);seq_item_port.get(req);
  5. 5. A Simple Sequence5class my_seq extends uvm_sequence #(my_tx);`uvm_object_utils(my_seq)function new(string name = "");super.new(name);endfunction: newtask body;repeat(4)beginreq = my_tx::type_id::create("req");start_item(req);if (!req.randomize())`uvm_error("", "failed to randomize")finish_item(req);endendtaskendclass
  6. 6. Nested Sequences6class top_seq extends uvm_sequence #(my_tx);...`uvm_declare_p_sequencer(my_seqr)...task body;repeat(3)beginmy_seq seq;seq = my_seq::type_id::create("seq");if (!seq.randomize())`uvm_error("", "failed to randomize")seq.start(p_sequencer, this);endendtask... Parent sequenceParent sequenceSequencerSequencerVariable that points to sequencerVariable that points to sequencer
  7. 7. Concurrent Sequences7task body;forkbeginseq1 = my_seq::type_id::create("seq1");if (!seq1.randomize())`uvm_error("", "failed to randomize")seq1.start(p_sequencer, this);endbeginseq2 = my_seq::type_id::create("seq2");if (!seq2.randomize())...seq2.start(p_sequencer, this);endbegin...seq3.start(p_sequencer, this);endjoinendtaskTransactions will be strictly interleavedTransactions will be strictly interleaved
  8. 8. The Finer Points of UVM• Sequences and sequencers• The arbitration queue• Virtual sequences• Request and response• Multiple sequencer stacks
  9. 9. The Arbitration Queue9prioritysequenceprioritysequenceprioritysequenceprioritysequenceprioritysequenceprioritysequenceArbitration queueArbitration queueFirst inFirst instartbodystart_itemseq_item_port.get(req);Arbitrationstartbodystart_itemforkstartbodystart_itemseq_item_port.get(req);seq_item_port.get(req);beginfinish_itemfinish_itemfinish_itemFIFOFIFOjoinend
  10. 10. Setting the Arbritration Algorithm10task body;p_sequencer.set_arbitration(SEQ_ARB_STRICT_RANDOM);forkbeginseq1 = my_seq::type_id::create("seq1");if (!seq1.randomize())`uvm_error("", "failed to randomize")seq1.start(p_sequencer, this, 1);endbegin...seq2.start(p_sequencer, this, 2);endbegin...seq3.start(p_sequencer, this, 3);endjoinendtask Priority (default 100)Priority (default 100)
  11. 11. Arbitration Algorithms11Arbitration mode Order in which requests grantedSEQ_ARB_FIFO FIFO order (default)SEQ_ARB_RANDOM Random orderSEQ_ARB_STRICT_FIFO Highest priority first, then FIFO orderSEQ_ARB_STRICT_RANDOM Highest priority first, then random orderSEQ_ARB_WEIGHTED Weighted by prioritySEQ_ARB_USER User-defined
  12. 12. User-Defined Arbitration Algorithm12class my_sequencer extends uvm_sequencer #(my_tx);...function integer user_priority_arbitration(integer avail_sequences[$]);foreach (avail_sequences[i])begininteger 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)...endreturn max_index;endfunctionendclassCould access properties of the sequence objectCould access properties of the sequence object
  13. 13. The Finer Points of UVM• Sequences and sequencers• The arbitration queue• Virtual sequences• Request and response• Multiple sequencer stacks
  14. 14. Virtual Sequences14priorityseq1priorityseq1vseq.start(seqr0, null, priority)bodyforkseq1.start(seqr1, this)bodystart_item...seq2.start(seqr2, this, 50)bodystart_item...seqr1seqr2seqr3BlocksInherits priorityBlocksInherits priorityseqr0 Can be nullCan be nullNo transactions
  15. 15. Sequencer Lock15seqr1seqr0No transactionsvseq.start(seqr0, null)bodybeginthis.lock(seqr1);seq1.start(seqr1, this);bodystart_itemfinish_itemthis.unlock(seqr1);...priorityseqxpriorityseqxpriorityseqypriorityseqypriorityseq1priorityseq1Important!Important!
  16. 16. Lock versus Grab16priorityseqxpriorityseqxpriorityseqypriorityseqyvseq1.startbodybeginlockseq1.startunlockvseq2.startbodybeginlockseq2.startunlockvseq3.startbodybegingrabseq3.startungrablock reqvseq2lock reqvseq2grab reqvseq3grab reqvseq3priorityseq3priorityseq3LocksinsertedhereLocksinsertedhereGrabsinsertedhereGrabsinsertedhereHead Tailpriorityseq1priorityseq1priorityseq2priorityseq2
  17. 17. The Finer Points of UVM• Sequences and sequencers• The arbitration queue• Virtual sequences• Request and response• Multiple sequencer stacks
  18. 18. Request and Response18TLM exportTLM exportTLM portTLM portstart_item(req);finish_item(req);get_response(rsp);seq_item_port.get(req);seq_item_port.put(rsp);req rspThe paper describes in detailhow to code pipelined req/rspand out-of-order responsesThe paper describes in detailhow to code pipelined req/rspand out-of-order responses
  19. 19. Layered Sequencers19seq_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 rspreq rspPtr to uppersequencerPtr to uppersequencerCould beone:one orone:many ormany:one ormany:manyCould beone:one orone:many ormany:one ormany:manyThe paper shows more detailThe paper shows more detailreq:rsp = 1:1req:rsp = 1:1
  20. 20. The Finer Points of UVM• Sequences and sequencers• The arbitration queue• Virtual sequences• Request and response• Multiple sequencer stacks
  21. 21. Multiple Agents / Sequencer Stacks21Communicate orsynchronize?Communicate orsynchronize?get(req)Must notblock!Must notblock!Driven by the DUT interface timingDriven by the DUT interface timingAnalysis portsCallbacksEventsBarriersAnalysis portsCallbacksEventsBarriers
  22. 22. Driver calls try_next_item22seq_item_port.try_next_item(req);if (req == null)begindut_vi.idle <= 1;...@(posedge dut_vi.clock);endelsebeginseq_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 cycleMust be called in same time stepMust be called in same time stepResponse can be pipelinedResponse can be pipelined
  23. 23. The Finer Points of UVM• The UVM sequence library• Pipelined requests and responses• The response handler• UVM events and event pools• The configuration databaseAlso in the paperAlso in the paper

×