Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Monitor ready/valid without SVA

Q140·Free·Design Verification

Monitor ready/valid without SVA

Difficulty
Medium
Topic
Temporal Checks
Language
SV
Interview prompt

Question

Implement a cycle-sampled ready/valid monitor without SystemVerilog Assertions. Detect when valid drops before a handshake and when a continuously asserted valid waits more than a configured number of cycles for ready. Supply known 0/1 valid and ready samples. The threshold is 0 through 2^31 - 1. Cumulative error reports in one instance remain at most 2^31 - 1.

Candidate starting point

Implementation scaffold

class ReadyValidMonitor;
  local bit waiting;
  local bit timeout_reported;
  local longint unsigned wait_cycles;
  local int stall_threshold;
  local int errors;

  function new(int stall_threshold);
    if (stall_threshold < 0) $fatal(1, "threshold must be nonnegative");
    this.stall_threshold = stall_threshold;
    waiting = 0;
    timeout_reported = 0;
    wait_cycles = 0;
    errors = 0;
  endfunction

  function void clear_transfer();
    // Implement here: clear_transfer.
  endfunction

  function void check_timeout();
    // Implement here: check_timeout.
  endfunction

  function void sample(bit valid, bit ready);
    // Implement here: sample.
  endfunction

  function int error_count();
    return errors;
  endfunction
endclass
Reviewed example

Trace one case

Input
stall_threshold=2
cycle 0: valid=1, ready=0
cycle 1: valid=1, ready=0
cycle 2: valid=1, ready=1
Expected output
No transfer on cycles 0-1; one transfer on cycle 2; no protocol error.

The procedural monitor requires valid to stay asserted during the stall, counts only valid-without-ready cycles toward the timeout, and completes on valid && ready.

What to cover

Requirements

  1. Treat valid and ready high in the same sample as one completed transfer.
  2. Once a stalled transfer starts, require valid to remain asserted until handshake.
  3. Count only valid-without-ready cycles toward the stall limit.
  4. Report a prolonged stall once per transfer rather than once per subsequent cycle.
  5. Expose the cumulative error count.
Exact question handoffPractice Q140

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

Transfer Contracts

Review ready-valid, request-acknowledge, APB, and AHB transfer rules.

  • Temporal Checks
  • Ready-valid
  • Protocol monitor
  • Timeout
Transfer Contracts →
Continue practicing

Related questions

Q1150 · Temporal ChecksCount successful ready/valid handshakesEasyP→Q051 · Temporal ChecksMeasure ready/valid handshake latencyMedium→Q1151 · Temporal ChecksCheck payload stability during ready/valid stallsMediumP→Q017 · Protocol CheckingAPB Protocol Monitor without SVAMedium→Q055 · Protocol CheckingFour-Phase Request/Acknowledge MonitorMedium→
ASIC.FYI · Learn silicon end to end.info@asic.fyi