Skip to the selected question
ASIC.FYI

ASIC Interview Question Bank

1,000+ hardware interview questions.Curated and reviewed by industry engineers.1,000+ hardware questions1,000+ questionsEngineer-reviewed
DescriptionQ216
Page ↗
Q216DesignArchFollow-up to Q292ASIC interview problem

Predict weighted round-robin grants

TechniquesDesignArchWeighted round robinSchedulerEpoch state
DifficultyHard
TopicArbiters
LanguageSystemVerilog
Requirements6 checkpoints
01

Problem

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.

Class declarationSystemVerilog
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

Example input and output

Use this case to check your interpretation
Input
weights=[2,1,3]; all three requesters remain asserted for six accepted grants
Output
grant sequence=[0,0,1,2,2,2]
Explanation

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

02

Requirements (6)

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