Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Check a per-ID latency window

Q067·Free·Design Verification

Check a per-ID latency window

Difficulty
Medium
Topic
Reference Models
Language
PYTHON
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.

Per-ID request and response timeline pairing repeated ID-five requests with the oldest unmatched responses at latencies three and six.
Pair each response with the oldest unmatched request of the same ID before checking the latency window.
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."""
        pass
Reviewed example

Trace one case

Input
request id5 at cycle 10; request id5 at cycle 12; responses id5 at cycles 13 and 18
Expected output
oldest request latency=3 PASS; next request latency=6 PASS; no pending requests

Repeated IDs pair with their oldest unmatched send, and both inclusive legal boundaries 3 and 6 are exercised.

What to cover

Requirements

  1. Measure integer clock cycles, not simulator time units.
  2. Pair a response with the oldest unmatched send for its ID.
  3. Treat both latency boundaries as inclusive.
  4. Reject unexpected responses and report missing responses at the end.
Exact question handoffPractice Q067

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

QoS and Fairness

Review arbitration, service guarantees, starvation, latency distributions, and sustained contention.

  • Reference Models
  • Python
  • Latency
  • Cycles
QoS and Fairness →
Continue practicing

Related questions

Q635 · Reference ModelsEnforce a rolling bandwidth limitMediumP→Q179 · Reference ModelsExpire memory expectations without full scansHard→Q890 · Computer ArchitectureCheck per-channel link creditsHardP→Q465 · Reference ModelsCheck arbitrarily reordered packetsMediumP→Q026 · Reference ModelsRetire out-of-order completions in orderHard→
ASIC.FYI · Learn silicon end to end.info@asic.fyi