Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Detect a starving arbiter requester

Q190·Free·SystemVerilog

Detect a starving arbiter requester

Difficulty
Medium
Topic
Arbiters
Language
SV
Interview prompt

Question

Add a watchdog that flags any port that remains continuously asserted but ungranted for more than K sampled cycles.

Candidate starting point

Implementation scaffold

class StarvationWatchdog #(int N = 8);
  local longint unsigned wait_count[N];
  local bit starving[N];
  local bit starvation_alert;
  local int threshold;

  function new(int threshold);
    if (N <= 0 || threshold < 0) $fatal(1, "invalid watchdog");
    this.threshold = threshold;
    foreach (wait_count[i]) begin
      wait_count[i] = 0;
      starving[i] = 0;
    end
    starvation_alert = 0;
  endfunction

  function void sample(int grant_idx, bit [N-1:0] reqs);
    // Implement here: sample.
  endfunction

  function bit port_starving(int port);
    // Implement here: port_starving.
  endfunction

  function bit any_starving();
    // Implement here: any_starving.
  endfunction
endclass
Reviewed example

Trace one case

Input
K=2; port 1 requests without a grant on sampled cycles 0, 1 and 2, then wins on cycle 3
Expected output
wait counts = 1, 2, 3 with starvation asserted after cycle 2; cycle 3 clears count and flag

Continuous ungranted assertion increments through cycles with no winner, and an accepted grant resets that port's watchdog state.

What to cover

Requirements

  1. Maintain a wait count and starvation flag per port.
  2. Increment a port only while it requests and does not receive the accepted grant.
  3. Clear a port's state when it wins or stops requesting.
  4. Set a global alert when any per-port count exceeds K.
  5. Count asserted requesters during cycles in which there is no grant.
  6. Expose both per-port status and the global alert.
Exact question handoffPractice Q190

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.

  • Arbiters
  • Fairness
  • Watchdog
  • Starvation
QoS and Fairness →
Continue practicing

Related questions

Q289 · ArbitersPredict a strict round-robin grantMediumP→Q298 · ArbitersSelect round-robin winners with rotate and isolateHardP→Q233 · ArbitersPredict weighted round-robin grantsHardP→Q897 · ArbitersDesign a four-request arbiter verification environmentHardP→Q557 · Reference ModelsModel a round-robin arbiterMediumP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi