Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • Study Route: One Week Before the Interview
  • Study Route: Two Weeks
  • Study Route: Four Weeks (Full Course)4
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • UVM Testbench Puzzles25
  • Clock, Reset & CDC Puzzles25
  • Bus and Interface Protocol Puzzles25
    • Valid/Ready Handshake Puzzles
    • APB Protocol Puzzles
    • AXI Protocol Puzzles
    • FIFO, Arbitration and Credit Puzzles
      • Sizing a FIFO for a Rate Mismatch Burst
      • Empty and Full With Simultaneous Read and Write
      • Full and Empty From Gray-Coded Pointers
      • Round-Robin Grants and the Starved Requester
      • Credit Window vs Round-Trip Time
      • Circular Wait Between Two Full Queues
    • Bus and Interface Protocol Puzzles: Tricky Q&A
  • Interview Prep: Puzzle Rounds7
  • DV Puzzle Cheatsheet
Loading lesson

←FIFO, Arbitration and Credit Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Bus and Interface Protocol Puzzles
  4. FIFO, Arbitration and Credit Puzzles
  5. Round-Robin Grants and the Starved Requester
On this page

    VLSI DV Interview PuzzlesAll levels

    Round-Robin Grants and the Starved Requester

    A 3-requester arbiter grants one requester per cycle. The request vectors (bit order {req2, req1, req0}) over 9 cycles are 111, 111, 111, 101, 101, 010, 111, 111, 000, each held for just that cycle. The round-robin arbiter starts with the pointer on requester 2 (so requester 0 has first priority), searches from the requester after the last one granted, and moves the pointer only on a grant. Give the grant sequence for round-robin and for a fixed-priority (0 > 1 > 2) arbiter.

    Puzzle

    Difficulty: Medium · Puzzle 4 of 6 · Topic: FIFO, Arbitration and Credit Puzzles

    A 3-requester arbiter grants one requester per cycle. The request vectors (bit order {req2, req1, req0}) over 9 cycles are 111, 111, 111, 101, 101, 010, 111, 111, 000, each held for just that cycle. The round-robin arbiter starts with the pointer on requester 2 (so requester 0 has first priority), searches from the requester after the last one granted, and moves the pointer only on a grant. Give the grant sequence for round-robin and for a fixed-priority (0 > 1 > 2) arbiter.

    Code

    arb.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    `timescale 1ns/1ns
    module arb #(parameter bit RR = 1, parameter string NAME = "?", parameter int N = 9) (input bit clk, input bit [2:0] req);
      int last = 2;          // requester served last: the search starts after it
      int g, c, cyc = 0;
      string s = "";
      always @(posedge clk) begin
        g = -1;
        for (int k = 1; k <= 3; k++) begin
          c = RR ? (last + k) % 3 : (k - 1);
          if (g < 0 && req[c]) g = c;
        end
        if (g >= 0) last = g;                 // the pointer moves only when somebody is granted
        s = {s, (g < 0) ? "- " : $sformatf("%0d ", g)};
        if (cyc == N-1) $display("%s grants: %s", NAME, s);
        cyc++;
      end
    endmodule
    
    module tb;
      localparam int N = 9;
      //                              cycle: 012345678
      localparam bit [2:0] REQ [N] = '{3'b111, 3'b111, 3'b111, 3'b101, 3'b101, 3'b010, 3'b111, 3'b111, 3'b000};
      bit clk = 0;
      int cyc = 0;
      always #5 clk = ~clk;
      always @(posedge clk) cyc <= cyc + 1;
      wire [2:0] req = REQ[cyc];
      arb #(1, "round-robin") rr(clk, req);
      arb #(0, "fixed-prio ") fx(clk, req);
      initial #(10*N) $finish;
    endmodule

    Hint

    For round-robin the search order after 'last = L' is L+1, L+2, L (mod 3). For cycle 4 the last grant is 0, so requester 1 is checked first.

    Step-by-step solution

    Diagram
    1) Round-robin: cycle 0 -> 0 (last=0); cycle 1 -> 1; cycle 2 -> 2; cycle 3 (101, last=2) -> 0.
    2) Cycle 4 (101, last=0): the search order is 1, 2, 0, requester 1 is idle, so grant 2. Cycle 5 (010) -> 1. Cycle 6 (111, last=1) -> 2. Cycle 7 (111, last=2) -> 0. Cycle 8: no request, no grant, the pointer stays.
    3) Fixed priority always picks the lowest request: 0 0 0 0 0 1 0 0 -.
    4) Requester 2 requests in 7 of the 9 cycles but is granted 0 times with fixed priority, and 3 times with round-robin.

    Answer

    Answer: Round-robin: 0 1 2 0 2 1 2 0 - . Fixed priority: 0 0 0 0 0 1 0 0 - , so requester 2 starves under fixed priority.

    How this was checked

    Checked by running the code in Verilator 5; the printed output supports the answer above. The same request stream through both arbiters: round-robin serves requester 2 three times, fixed priority never.

    Why candidates get it wrong

    Cycle 4 is the trap: after granting 0 the search must go to 1 (idle) and then 2, so 2 wins; a design that restarts from 0 or only skips to the next INDEX without checking its request gets it wrong. The pointer must follow the last GRANTED requester. A second trap is moving the pointer in the no-request cycle 8, which would bias the next grant.

    Interviewer follow-up

    What is the worst-case wait for a requester that holds its request in an N-requester round-robin arbiter that grants one per cycle? Model answer: N-1 grants of other requesters, i.e. at most N-1 cycles before its own grant (so at most 2 here). That bound is the fairness property a checker should assert.

    Related topics

    • Back to FIFO, Arbitration and Credit Puzzles

    • Bus and Interface Protocol Puzzles section

    Previous

    282 / 293

    Next: Credit Window vs Round-Trip Time

    Up next

    Up nextCredit Window vs Round-Trip Time

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • Sizing a FIFO for a Rate Mismatch Burst
    • Empty and Full With Simultaneous Read and Write
    • Circular Wait Between Two Full Queues