Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Find a missing packet sequence ID

Hardware interview practice

Find a missing packet sequence ID

MediumStreaming RTLSystemVerilog

After start, consume n distinct sequence IDs drawn from the inclusive range 0 through n and report the one missing value using constant word-sized state.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
n=4; accepted distinct sequence IDs=[4,1,0,3]
Expected output
missing_id=2

XOR or widened-sum constant state compares the complete 0..4 range with exactly four accepted IDs, including boundary values zero and n.

What to cover

Requirements

  1. Use no bitmap or external memory.
  2. Complete after exactly n accepted IDs and handle missing zero or missing n.
  3. For n equal to zero, return zero without waiting for input data.
  4. Hold the result until accepted and do not advance the count during input stalls.
asic.fyi · Learn silicon end to end.info@asic.fyi