Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Verify a return-stack trace validator

Q087·Free·Design Verification

Verify a return-stack trace validator

Difficulty
Medium
Topic
UVM Components
Language
SV
Interview prompt

Question

Write the format and stack oracle for a validator fed by two independent Universal Verification Methodology (UVM) stream agents, one for push traces and one for pop traces. Equal transaction IDs identify the pair. Values are known unsigned bytes. Empty queues are format errors. On a format error, sequence_valid and fail_pop_index are zero; on a valid sequence, fail_pop_index is also zero. The oracle operates on the already paired complete queues, independently of the arrival order of their stream frames.

Two already assembled traces with the same ID pass format checks before a stack oracle validates their pop order.
Pair the complete matching-ID queues first. Each must contain 1 through 16 unique byte values, with equal lengths and value sets. For pushes A, B, C and pops C, B, A, the stack empties legally.
Candidate starting point

Implementation scaffold

class trace_oracle;
  typedef struct {
    bit          format_error;
    bit          sequence_valid;
    int unsigned fail_pop_index;
  } prediction_t;

  function automatic prediction_t predict(
      byte unsigned push_q[$], byte unsigned pop_q[$]);
    // TODO: implement.
  endfunction
endclass
Reviewed example

Trace one case

Input
id7 push frame=[A,B,C]; id7 pop frame=[C,B,A], with either half allowed to arrive first
Expected output
format_error=0; sequence_valid=1; first_bad_index=0

Both halves have equal unique value sets, and simulating the stack reproduces every pop in order.

What to cover

Requirements

  1. Accept two already assembled 1-to-16-value queues belonging to the same ID and predict format_error for overlength, unequal lengths, duplicate values, or unequal value sets.
  2. For a well-formed pair, simulate a stack and return sequence_valid or the first impossible pop index.
  3. Perform all format checks before stack simulation so malformed input is not mislabeled as a legal but impossible sequence.
  4. Treat frame assembly, four-ID pairing, missing-mate watchdogs, response matching, and reset epochs as follow-up scoreboard architecture.
Exact question handoffPractice Q087

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Dynamic and Polymorphic Testbenches

Review reusable agents, protocol variants, topology changes, and scalable configuration.

  • UVM Components
  • Two stream agents
  • Stack
  • ID correlation
Dynamic and Polymorphic Testbenches →
Continue practicing

Related questions

Q127 · Hardware-Software IntegrationCo-verify a memory-mapped minimum stackMedium→Q247 · Hardware-Software IntegrationVerify editable command-trace framesMediumP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi