Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ036
Page ↗
Q036DVArchASIC interview problem

Retire out-of-order completions in order

TechniquesPythonRetirementReorder bufferWindow
DifficultyHard
TopicReference Models
LanguagePython
Requirements4 checkpoints
01

Problem

Model transactions issued with increasing IDs, completed out of order, and retired strictly in order through a 16-entry completion window.

Reorder-window timeline showing completions arriving out of order and retirement advancing only through a contiguous completed prefix.
Completion can arrive out of order; retirement advances only from the current head through contiguous completed entries.

Example input and output

Use this case to check your interpretation
Input
issue IDs 0,1,2,3; complete in order 2,0,1,3
Output
retired after each completion: [], [0], [1,2], [3]
Explanation

Completion 2 waits in the 16-entry window until IDs 0 and 1 form a contiguous completed prefix.

02

Requirements (4)

  • Issue monotonically increasing IDs starting at zero.
  • Accept completion only for an issued, not-yet-retired, not-already-completed ID.
  • Define the 16 legal slots as next_retire through next_retire + 15.
  • After each completion, retire the longest contiguous completed prefix and return those retired IDs.