Skip to question
ASIC.FYI
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
ASIC.FYI/Interview questions/Predict weighted round-robin grants

Q216·Free·SystemVerilog

Predict weighted round-robin grants

Difficulty
Hard
Topic
Arbiters
Language
SV
Interview prompt

Question

Extend the arbiter so port i has configurable weight W[i] and may receive up to that many consecutive grants before priority moves to the next active requester.

Starting point

Question code

class WRRPredictor #(int N = 8);
  function void set_weights(int values[N]);
  function int predict_next(bit [N-1:0] reqs);
  function void update_state(int grant_idx, bit [N-1:0] reqs);
  function void reset();
endclass
Reviewed example

Trace one case

Input
weights=[2,1,3]; all three requesters remain asserted for six accepted grants
Expected output
grant sequence=[0,0,1,2,2,2]

Each port consumes its complete positive epoch before service rotates, exactly matching the configured weights.

What to cover

Requirements

  1. Require a positive effective weight for every port.
  2. Track the current priority port and its remaining grants in the current epoch.
  3. Skip inactive requesters and return -1 when all requests are inactive.
  4. Begin a fresh weight epoch when service moves to another port.
  5. Consume one unit only after an accepted grant.
  6. Define weight reconfiguration as starting a fresh epoch at the current priority.
Exact question handoffPractice Q216

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

  • Arbiters
  • Weighted round robin
  • Scheduler
  • Epoch state
Interview preparation guide →
Continue practicing

Related questions

Q292 · ArbitersPredict a strict round-robin grant→Q293 · ArbitersSelect round-robin winners with rotate and isolate→Q182 · ArbitersDetect a starving arbiter requester→
ASIC.FYI · Learn silicon end to end.info@asic.fyi