Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ347
Page ↗
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 interpretation
Input
accepted frame=[OPEN_A,OPEN_B,CLOSE_B,CLOSE_A] with one stall between the middle tokens
Output
balanced=1; error=NONE
Explanation

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.