DescriptionQ347
Q347DesignASIC interview problem
Validate nested protocol delimiters
TechniquesStackParserReady/valid
DifficultyHard
TopicStreaming RTL
LanguageSystemVerilog
Requirements4 checkpoints
01
Problem
Consume a framed stream containing two kinds of open and close delimiters. Report whether nesting is balanced and return the first mismatch, underflow, overflow, or unfinished-open error.
Example input and output
Use this case to check your interpretationInput
accepted frame=[OPEN_A,OPEN_B,CLOSE_B,CLOSE_A] with one stall between the middle tokensOutput
balanced=1; error=NONEExplanation
Parser state advances only on accepted tokens, and each close matches the most recent open type in strict stack order.
02
Requirements (4)
- Assume the producer ends each frame within 16 accepted tokens; enforce a nesting depth of at most eight.
- Update parser state only on an accepted token and keep consuming after the first error.
- Each close must match the most recent open of the same type.
- Hold the final result stable until it is accepted.
