Hardware interview practice
Verify a return-stack trace validator
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.
Reviewed example
Work through one case
Input
id7 push frame=[A,B,C]; id7 pop frame=[C,B,A], with either half allowed to arrive firstExpected output
format_error=0; sequence_valid=1; first_bad_index=0Both halves have equal unique value sets, and simulating the stack reproduces every pop in order.
What to cover
Requirements
- 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.
- For a well-formed pair, simulate a stack and return sequence_valid or the first impossible pop index.
- Perform all format checks before stack simulation so malformed input is not mislabeled as a legal but impossible sequence.
- Treat frame assembly, four-ID pairing, missing-mate watchdogs, response matching, and reset epochs as follow-up scoreboard architecture.
