Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Check arbitrarily reordered packets

Hardware interview practice

Check arbitrarily reordered packets

MediumReference ModelsPYTHON

Build a reference checker for packets that may be emitted in any order across IDs. Multiple outstanding packets may reuse an ID, but packets within an ID must remain ordered.

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
expected payloads: id4=[A,B], id9=[C]; outputs: (9,C),(4,A),(4,B)
Expected output
all outputs match; finish reports zero missing packets

The checker permits id9 to finish first but preserves FIFO order A then B within reused id4.

What to cover

Requirements

  1. Queue every expected payload instead of overwriting a previous expectation for the same ID.
  2. Reject an output with no pending packet for its ID.
  3. On a data mismatch, keep the expected entry available for diagnosis.
  4. Provide a finish check that reports every missing output.
Continue practicing

Related questions

Reference ModelsCheck a per-ID latency window→Reference ModelsScore legal packet drops without hiding errors→Reference ModelsMatch transactions in strict order→
asic.fyi · Learn silicon end to end.info@asic.fyi