Part 6 · Agents & Protocol IP · Intermediate
Streaming Agent Pattern: Throughput, Backpressure, and Packet Framing
Building streaming-protocol VIP with valid/ready handshake robustness, beat/packet reconstruction, and throughput-oriented verification hooks.
Streaming pattern fundamentals
Streaming protocols center on flow control and data movement rather than random address transactions. Agents should optimize for sustained transfer correctness and backpressure behavior.
Packetized streams may include frame markers (for example last flags) and sideband metadata. Agent item models should reflect both beat-level and packet-level semantics.
[VIP][STREAM] handshake model
producer asserts valid with data
consumer asserts ready when able
transfer occurs on valid && ready
optional framing:
sop/eop or tlast-style markers
optional sideband:
keep/user/id/channel metadata[AGT] design emphasis
driver:
controls valid/data under possible random stalls
monitor:
captures accepted beats
assembles packet boundaries
checkers:
throughput, drop, ordering, framing integrityModel accepted beats, not merely cycles with valid high.
Treat backpressure as first-class behavior in stimulus and checking.
Define packet boundary semantics clearly in transaction schema.
Driver pattern for valid/ready streams
Driver should manage beat queues and handshake stability. Data must remain stable while valid is asserted and ready is low, unless protocol allows otherwise.
class stream_item extends uvm_sequence_item;
`uvm_object_utils(stream_item)
rand bit [63:0] beats[$];
rand bit [7:0] keep[$];
rand int unsigned channel_id;
function new(string name = "stream_item");
super.new(name);
endfunction
endclasstask drive_stream(stream_item pkt);
foreach (pkt.beats[i]) begin
vif.valid <= 1'b1;
vif.data <= pkt.beats[i];
vif.keep <= pkt.keep[i];
vif.last <= (i == pkt.beats.size()-1);
do @(posedge vif.clk); while (!vif.ready);
end
vif.valid <= 1'b0;
vif.last <= 1'b0;
endtask[DRV][STREAM] stability rule
while (valid && !ready):
data/sideband must remain stable
after handshake:
advance to next beat
after final beat:
deassert valid/last cleanlyEnsure data stability under backpressure conditions.
Represent packet payload as beat arrays for flexibility.
Keep driver timing logic centralized and protocol-explicit.
Monitor and packet reconstruction
Streaming monitors must distinguish raw signal toggles from accepted transfers. Build packet objects only from cycles where valid and ready handshake completes.
task run_phase(uvm_phase phase);
stream_item pkt;
forever begin
@(posedge vif.clk);
if (!vif.rst_n) continue;
if (vif.valid && vif.ready) begin
if (pkt == null)
pkt = stream_item::type_id::create("pkt");
pkt.beats.push_back(vif.data);
pkt.keep.push_back(vif.keep);
if (vif.last) begin
ap.write(pkt);
pkt = null;
end
end
end
endtask[MON] reconstruction safeguards
1) only sample accepted beats (valid && ready)
2) guard against missing last marker timeouts
3) include timestamp/channel metadata
4) reset should flush partial packet state[STREAM] corner cases
- zero-length packet semantics (if allowed)
- ready toggles every cycle (max backpressure)
- long packets with intermittent stalls
- sideband changes under stall (should be stable)Publish packets only when framing completion criteria are satisfied.
Flush partial state on reset to prevent packet contamination.
Cover heavy-backpressure corner cases in monitor tests.
Streaming performance/debug pattern
Streaming verification often includes throughput and latency observability. Add counters and interval metrics to assist both protocol and performance triage.
[VIP][PERF] monitor metrics
beats_accepted
packets_completed
stall_cycles (valid && !ready)
utilization = beats_accepted / active_cycles
avg_packet_size
max_inter_packet_gap[DEBUG][STREAM] symptom map
symptom likely cause
------------------------------------------------------------
packet truncation missing/early last handling
duplicate packet tail pkt state not reset after publish
throughput below expectation ready backpressure or driver pacing bug
sporadic payload corruption data instability under stall[AGT] release-readiness tests
1) no-backpressure max-throughput test
2) randomized backpressure stress
3) long-packet endurance run
4) reset-mid-packet recovery test
5) active/passive monitor parity testKey takeaways
Streaming agents must focus on handshake correctness under backpressure.
Monitor logic should reconstruct packets from accepted beats only.
Performance counters improve debug and integration visibility.
Packet framing and reset handling are top reliability risks.
Common pitfalls
Sampling data when valid high but ready low.
Leaving partial packet state across reset or frame boundaries.
Ignoring sideband stability constraints during stalls.
Skipping throughput-oriented qualification for streaming VIP.