Part of Curriculum: Advanced SoC and Chiplet RTL (Module 2: Multi-Request Round-Robin Arbitration)
View Full Roadmap →
Level 4 Hard ★ Flagship #40 50 pts ✓ Solved

Multi-Request Round-Robin Arbiter — Advanced Arbitration

Arbitration & Interconnect · cdc, industry-rtl, arbiters, clock-domain-crossing, hard, advanced-arbiters

Design an optimized 4-client Round-Robin Arbiter using the dual-priority-encoder algorithm with masking ($req \& mask$ and $req$) for single-cycle high-frequency timing closure.

Write a synthesizable Verilog module named top_module matching the ports below exactly.
📐 Circuit Schematic Diagram
req[3:0]grant[3:0]>clkrst_nMULTI-REQUEST ROUND-DIGITAL HARDWARE BLOCK
⚡ Timing & Synthesizability Constraints

Timing Contract: Pure single-cycle arbitration logic: grant vector generated combinationally, priority mask updated on `posedge clk`.

RTL Constraints: Mutual exclusivity: at most one grant line asserted (`$onehot0(grant)`).

Objective: Master industry-standard parallel prefix arbitration, avoiding slow sequential case loops, and achieving single-cycle gigahertz timing closure.

Prerequisites: Fixed priority encoders, priority masking, round-robin algorithms.
NameDirWidthDescription
clkinput1Clock signal
areset_ninput1Active-low reset
reqinput44-bit request vector
grantoutput44-bit one-hot grant vector
Expected Waveform (Golden Timing Contract)
💡 Need Guidance? Progressive Hints (3 Levels)
Hint 1: Conceptual Direction & Hardware Primitives
The mathematical trick `req & (-req)` isolates the least-significant 1-bit in a vector in constant $O(1)$ hardware!
Hint 2: Implementation Architecture & Approach
Maintain a `mask` vector: evaluate `grant_masked = masked_req & (-masked_req)`.
Hint 3: Edge Cases, Timing & Verilog Syntax
If `|masked_req` is non-zero, choose `grant_masked`; otherwise, fall back to `grant_unmasked = req & (-req)`.
🔒 Reveal Verified Reference RTL Solution (Click to expand)
⚠️ Self-Discovery Warning: Try solving and simulating first! Viewing the verified reference implementation will bypass the real debugging experience.
Verified Synthesizable RTL
module top_module(
  input        clk,
  input        areset_n,
  input  [3:0] req,
  output [3:0] grant
);
  reg [3:0] mask;
  wire [3:0] masked_req = req & mask;
  wire [3:0] grant_masked;
  wire [3:0] grant_unmasked;

  // Priority encoder 1: operates on masked requests (above last grant)
  assign grant_masked = masked_req & (-masked_req);

  // Priority encoder 2: operates on raw requests (wrap around)
  assign grant_unmasked = req & (-req);

  // Grant logic: prefer masked request; fallback to unmasked if no masked request
  assign grant = (|masked_req) ? grant_masked : grant_unmasked;

  // Mask update logic: mask out all clients up to and including the current grant
  always @(posedge clk or negedge areset_n) begin
    if (!areset_n) begin
      mask <= 4'b1111;
    end else if (|grant) begin
      mask <= ~((grant - 1'b1) | grant);
    end
  end
endmodule
Verilog-2001 / SV Saved
Font: |
// Click Run Tests (or press Ctrl+Enter) to compile your RTL and simulate against hidden testbenches.
Simulation Timing Diagram (VCD Waveform)
100%
No simulation waveform yet. Run tests to simulate and generate VCD traces.
No compilation run yet. Syntax warnings and elaboration messages will appear here.
No simulation output yet. Raw stdout from vvp will appear here.

RTL Problems / Level 4 · Arbitration & Interconnect

What You Will Learn

By solving Multi-Request Round-Robin Arbiter — Advanced Arbitration, you will acquire core industry skills:

  • Synthesizable hardware modeling in standard Verilog-2001 / SystemVerilog.
  • Correct handling of interface port contracts, edge-triggered clocks, and active-low/high resets.
  • Simulation waveform interpretation and debugging using timing diagrams (VCD traces).
  • Architectural avoidance of timing violations, glitching hazards, and synthesis warnings.

Problem Statement & Requirements

Design an optimized 4-client Round-Robin Arbiter using the dual-priority-encoder algorithm with masking ($req \& mask$ and $req$) for single-cycle high-frequency timing closure.

Hardware design teams at leading semiconductor firms evaluate these exact port contracts, race-condition assertions, and corner cases during technical design reviews and ASIC engineer interviews.

Objective: Master industry-standard parallel prefix arbitration, avoiding slow sequential case loops, and achieving single-cycle gigahertz timing closure.

Prerequisites: Fixed priority encoders, priority masking, round-robin algorithms.

Port List & Interface Timing

The hidden testbench instantiates top_module. Module port names and bit-widths must match the interface contract exactly:

NameDirWidthDescription
clkinput1Clock signal
areset_ninput1Active-low reset
reqinput44-bit request vector
grantoutput44-bit one-hot grant vector

Timing Constraints & Synthesizable RTL Rules

⚡ Synthesizable Implementation Guidelines

Timing Contract: Pure single-cycle arbitration logic: grant vector generated combinationally, priority mask updated on `posedge clk`.

Synthesis Constraints: Mutual exclusivity: at most one grant line asserted (`$onehot0(grant)`).

Architectural Deep Dive & Implementation Walkthrough

Standard case-statement arbiters scale as $O(N^2)$ in logic depth. The dual-priority encoder algorithm ($r \& -r$) leverages two's complement carry chains to find the first asserting client in $O(\log N)$ gate delays. Combining a masked request vector with a fallback unmasked vector provides a mathematically elegant, 100% fair round-robin arbiter that achieves maximum clock speeds in high-end switch fabrics.

Common RTL Designer Pitfalls

⚠️ Common Mistakes to Avoid

['Using sequential search loops that create timing bottlenecks on critical paths.', 'Failing to reset the mask when all clients above the last grant have completed.']

Silicon & Hardware Engineering Notes

🛠️ ASIC vs FPGA Hardware Considerations

This dual-arbiter scheme is the universal standard arbiter architecture employed across Cisco/Broadcom network switches and multi-core CPU L3 cache crossbars.

Starter RTL Code

module top_module(
  input        clk,
  input        areset_n,
  input  [3:0] req,
  output [3:0] grant
);

  // High-performance Dual-Priority-Encoder Round-Robin Arbiter

endmodule

Verified Reference Solution

🔒 Reveal Verified Reference RTL Solution
module top_module(
  input        clk,
  input        areset_n,
  input  [3:0] req,
  output [3:0] grant
);
  reg [3:0] mask;
  wire [3:0] masked_req = req & mask;
  wire [3:0] grant_masked;
  wire [3:0] grant_unmasked;

  // Priority encoder 1: operates on masked requests (above last grant)
  assign grant_masked = masked_req & (-masked_req);

  // Priority encoder 2: operates on raw requests (wrap around)
  assign grant_unmasked = req & (-req);

  // Grant logic: prefer masked request; fallback to unmasked if no masked request
  assign grant = (|masked_req) ? grant_masked : grant_unmasked;

  // Mask update logic: mask out all clients up to and including the current grant
  always @(posedge clk or negedge areset_n) begin
    if (!areset_n) begin
      mask <= 4'b1111;
    end else if (|grant) begin
      mask <= ~((grant - 1'b1) | grant);
    end
  end
endmodule

Related RTL Problems in Level 4

Frequently Asked Questions

What does Multi-Request Round-Robin Arbiter — Advanced Arbitration require?

Design an optimized 4-client Round-Robin Arbiter using the dual-priority-encoder algorithm with masking ($req \& mask$ and $req$) for single-cycle high-frequency timing closure. Implement it as Verilog module top_module matching the listed ports.

Is this design combinational or sequential?

Tags: cdc, industry-rtl, arbiters, clock-domain-crossing, hard, advanced-arbiters. If a clock signal is present in the port table, implement it as sequential logic; otherwise, use continuous assignments or combinational blocks.

How is my solution graded?

A hidden SystemVerilog testbench simulates your module in the cloud judge. You pass when all directed corner cases match the golden model and the VCD timing waveform matches the contract.

How does this challenge help with semiconductor interviews?

Technical interviewers at NVIDIA, Qualcomm, Apple, and Intel routinely ask candidates to code, debug, and explain the timing waveforms of Multi-Request Round-Robin Arbiter — Advanced Arbitration to assess real-world synthesizability and race-condition awareness.