Skip to question
ASIC.FYI
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
ASIC.FYI/Interview questions/Measure ready/valid handshake latency

Q098·Free·SystemVerilog

Measure ready/valid handshake latency

Difficulty
Medium
Topic
Temporal Checks
Language
SV
Interview prompt

Question

Track minimum, maximum, total, and average latency from the first valid sample of each transfer through its successful ready/valid handshake.

Starting point

Question code

class HandshakeLatency;
  function void sample(bit valid, bit ready);
  function real average_latency();
endclass
Reviewed example

Trace one case

Input
valid rises at cycle 4; ready first overlaps valid at cycle 7
Expected output
handshake_latency = 3 cycles

Latency is measured from the first pending-valid cycle through the accepting edge, without resetting while valid is stalled.

What to cover

Requirements

  1. Define a same-cycle valid-and-ready handshake as zero stalled cycles.
  2. Update statistics exactly once per successful transfer.
  3. Initialize minimum latency from the first completed transfer rather than from zero.
  4. Avoid division by zero and return a real-valued average.
  5. Do not add failed or incomplete transfers to the latency statistics.
Exact question handoffPractice Q098

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

Open in question bank →
Solution accessA Free account unlocks the complete reviewed solution.
Continue learning

SystemVerilog

  • Temporal Checks
  • Ready-valid
  • Latency
  • Running statistics
RTL design questions →
Continue practicing

Related questions

Q097 · Temporal ChecksMonitor ready/valid without SVA→Q034 · Temporal ChecksProve an elastic one-hot checker→Q117 · Functional CoverageDetect missing type-priority coverage→
ASIC.FYI · Learn silicon end to end.info@asic.fyi