Q067FreeDesign Verification
Check a per-ID latency window
Interview prompt
Question
Implement a checker requiring every response to arrive within a configurable inclusive latency window after its matching request; the default window is 3 through 6 cycles. Multiple requests, including repeated IDs, may be in flight. The caller supplies integer cycle indices and integer bounds satisfying 0 <= minimum <= maximum; per-ID sends are recorded in chronological order.

Candidate starting point
Implementation scaffold
from collections import defaultdict, deque
class LatencyWindowChecker:
def __init__(self, minimum=3, maximum=6):
"""TODO: implement this method."""
pass
def on_send(self, packet_id, cycle):
"""TODO: implement this method."""
pass
def on_receive(self, packet_id, cycle):
"""TODO: implement this method."""
pass
def finish(self):
"""TODO: implement this method."""
passReviewed example
Trace one case
Input
request id5 at cycle 10; request id5 at cycle 12; responses id5 at cycles 13 and 18Expected output
oldest request latency=3 PASS; next request latency=6 PASS; no pending requestsRepeated IDs pair with their oldest unmatched send, and both inclusive legal boundaries 3 and 6 are exercised.
What to cover
Requirements
- Measure integer clock cycles, not simulator time units.
- Pair a response with the oldest unmatched send for its ID.
- Treat both latency boundaries as inclusive.
- Reject unexpected responses and report missing responses at the end.
