Hardware interview practice
Check arbitrarily reordered packets
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.
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 packetsThe checker permits id9 to finish first but preserves FIFO order A then B within reused id4.
What to cover
Requirements
- Queue every expected payload instead of overwriting a previous expectation for the same ID.
- Reject an output with no pending packet for its ID.
- On a data mismatch, keep the expected entry available for diagnosis.
- Provide a finish check that reports every missing output.
