Part 11 · Senior Prep · Intermediate

Interview Q&A: Sequence Items & Layering

Model answers on uvm_sequence_item vs uvm_sequence, beat→burst→flow layering, base sequence helpers, and when to call start() vs inline start_item.

Item and sequence fundamentals

Q: uvm_sequence_item vs uvm_sequence — what is each?

diagram
[INT][SENIOR][UVM] MODEL ANSWER

Q: sequence_item vs sequence?

A:
  MECHANISM:  sequence_item is the randomized payload (addr, data, burst_len).
              sequence is procedural code that creates/items and drives the handshake.
  MOTIVATION:  Separates data (what to send) from control flow (when and how many).
  WHEN:       Item per transaction fields; sequence per scenario/stimulus pattern.
  NOT WHEN:   One-off directed write with no reuse — plain task in test is OK at block.
  PITFALL:    Putting scenario loops inside item — items should be thin data containers.
  EXAMPLE:    axi_item holds rand addr/data; axi_burst_seq loops start_item on burst_len.

Q: Explain the beat → burst → flow → virtual layering stack

diagram
[INT][SENIOR][UVM] MODEL ANSWER

Q: Sequence layering stack?

A:
  MECHANISM:  Each layer adds one abstraction: beat = one handshake cycle;
              burst = N beats with shared metadata; flow = multiple bursts with gaps;
              vseq = multi-agent coordination via start() on real sequencers.
  MOTIVATION:  Fix send_beat once in base_seq; tests express intent at top layer.
  WHEN:       Reuse across tests/regressions; protocol with natural burst granularity.
  NOT WHEN:   Single directed test, one transaction — flat seq is fine.
  PITFALL:    500-line body() with no layers — copy-paste across 40 tests.
  EXAMPLE:    axi_single_seq (beat) ← axi_burst_seq ← axi_stress_flow_seq ← chip_vseq.

Q: When do you use start() vs inline start_item?

diagram
[INT][SENIOR][UVM] MODEL ANSWER

Q: start() vs inline start_item?

A:
  MECHANISM:  start(sub_seq, sqr) runs a whole sub-sequence on target sequencer;
              inline start_item is for atomic single-beat work in the current sequence.
  MOTIVATION:  start() preserves sub-sequence encapsulation and reuse; inline for
              one-liner beats inside a burst loop.
  WHEN:       start() crossing burst/flow boundary or agent boundary; inline at beat layer.
  PITFALL:    start() on wrong sequencer — p_sequencer type mismatch or wrong handle.
  EXAMPLE:    burst_seq body: repeat(burst_len) start_item; flow_seq: burst_seq.start(sqr).
diagram
[INT][SENIOR][UVM] layering whiteboard

  BEAT   axi_single_seq     start_item/finish_item once
  BURST  axi_burst_seq      repeat beats, shared addr/len
  FLOW   axi_stress_seq     N bursts, gaps, backpressure
  VSEQ   chip_scenario_vseq fork sub-seqs on multiple sqrs
  TEST   raises objection, starts vseq, drops objection

Key takeaways

  • Items = data; sequences = procedural stimulus control.

  • Layer by natural protocol granularity — beat, burst, flow, virtual.

  • start() delegates whole sub-sequences; inline start_item for atomic beats.

Common pitfalls

  • Mega-sequence skipping layers — zero reuse, maintenance nightmare.

  • Randomizing scenario knobs on the item instead of the sequence.


Base sequence and reuse

Q: Why use a base sequence class?

diagram
[INT][SENIOR][UVM] MODEL ANSWER

Q: Base sequence class?

A:
  MECHANISM:  axi_base_seq provides send_beat(), default constraints, cfg handle —
              derived sequences override body() only.
  MOTIVATION:  One place for start_item/finish_item boilerplate and protocol knobs.
  WHEN:       Family of sequences sharing handshake and constraint policy.
  NOT WHEN:   Two unrelated one-off sequences — inheritance adds noise.
  PITFALL:    Deep inheritance tree without shared helpers — duplicated start_item blocks.
  EXAMPLE:    axi_err_seq extends axi_base_seq; overrides body to call send_beat_with_err().

Q: How do constraints live across layers?

diagram
[INT][SENIOR][UVM] MODEL ANSWER

Q: Constraints across layers?

A:
  MECHANISM:  Item holds field rand vars; sequence holds scenario knobs (num_bursts,
              gap_cycles); flow seq randomizes knobs then calls burst seq with inline
              constraint blocks on start().
  MOTIVATION:  Separation keeps item reusable; scenario diversity at flow/test layer.
  WHEN:       Regression needs varied burst mixes without new item classes.
  PITFALL:    Hard-coding burst_len in body loop — cannot constrain from test.
  EXAMPLE:    test: flow_seq.start(sqr, null, { num_bursts inside {[8:16]} }).
systemverilog
// base helper — interviewers expect this pattern
task send_beat(bit [31:0] addr, bit [31:0] data);
  start_item(req);
  req.addr = addr; req.data = data;
  finish_item(req);
endtask

Key takeaways

  • Base sequences centralize send_beat and shared cfg — derived seqs override body().

  • Scenario knobs live in flow/vseq layer; field rand vars live in item.

Common pitfalls

  • Constraint on item when scenario intent belongs in sequence layer.

  • Base class with empty body — helpers must actually reduce duplication.