Round-Robin Arbiter with Priority Override

Problem Description
Design a 4-requester round-robin arbiter that grants access to exactly one requester per clock cycle. The arbiter maintains an internal pointer that tracks which requester was granted last, and on the next grant cycle it starts scanning from the next requester in circular order. When the priority input is HIGH and req[0] is asserted, requester 0 immediately wins the grant regardless of the round-robin pointer. On reset, the pointer initialises to 0 (scan starts from requester 0), and grant and grant_valid both deassert to 0.

All Scenarios Table:
Scenario | Pointer Before | Winner | grant[3:0] | grant_valid |
|---|---|---|---|---|
req=0001, no priority, ptr=0 | 0 | req[0] | 0001 | YES ✓ |
req=0110, no priority, ptr=0 | 0 | req[1] | 0010 | YES ✓ |
req=0110, no priority, ptr=2 | 2 | req[3]→wrap→req[1] | 0010 | YES ✓ |
req=1111, no priority, ptr=1 | 1 | req[2] | 0100 | YES ✓ |
req=1111, priority=1, ptr=2 | 2 | req[0] (override) | 0001 | YES ✓ |
req=1110, priority=1, ptr=0 | 0 | req[1] (req[0]=0, override inactive) | 0010 | YES ✓ |
req=0000, any ptr | unchanged | none | 0000 | NO ✗ |
reset=1 asserted mid-grant | 0 (cleared) | none | 0000 | NO ✗ |
Verilog
Code Editor Access
Log in to write, run and submit your solution to this interview question. It's free.
