Uvm Sequence details-Verification-SystemVerilog
Uvm Sequence details-Verification-SystemVerilog
Uvm Sequence details-Verification-SystemVerilog
uvm_env
uvm_agent
start_item(req); finish_item(req);
A Simple Sequence
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
5
Nested Sequences
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")
Variable that points to sequencer
Concurrent Sequences
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 Transactions will be strictly interleaved endtask
7
First in
priority sequence
Arbitration
FIFO
Arbitration Algorithms
Order in which requests granted FIFO order (default) Random order Highest priority first, then FIFO order
SEQ_ARB_STRICT_RANDOM
SEQ_ARB_WEIGHTED SEQ_ARB_USER
11
Virtual Sequences
seqr0
Can be null
vseq.start(seqr0, null, priority) body
No transactions
fork
seq1.start(seqr1, this)
body start_item ...
...
14
Sequencer Lock
seqr0
vseq.start(seqr0, null) body
No transactions
begin
Important!
seqr1
this.lock(seqr1);
seq1.start(seqr1, this); body
priority seqx priority seqy priority seq1
start_item
finish_item
this.unlock(seqr1); ...
15
body
begin lock seq1.start
body
begin lock seq2.start
body
begin grab seq3.start
unlock
unlock
ungrab
Head grab req vseq3 priority seqx priority seqy priority seq2 seq1 lock req vseq2 priority seq3
Tail
TLM export
get_response(rsp);
req
TLM port
rsp
seq_item_port.get(req); seq_item_port.put(rsp);
The paper describes in detail how to code pipelined req/rsp and out-of-order responses
18
Layered Sequencers
start_item(req);
finish_item(req); get_response(rsp);
req
Could be one:one or one:many or many:one or many:many
rsp
seqr_upper.get(req_up); start_item(req_lo); finish_item(req_lo);
get_response(rsp_lo);
req
req:rsp = 1:1
rsp
seqr_upper.put(rsp_up);
seq_item_port.get(req); seq_item_port.put(rsp);
Communicate or synchronize?
get(req)
21
22
The UVM sequence library Pipelined requests and responses The response handler UVM events and event pools