Round-robin arbiter – openenoc_rr_arbiter
Selects requesting clients fairly using a rotating priority pointer.
Source: openenoc_rr_arbiter.sv.
Parameters
Name |
Default value |
Allowed values |
Description |
|---|---|---|---|
|
|
Integer >= 1 |
Number of round-robin requesters. |
|
|
>= max(1, ceil(log2(PORTS))) |
Width of the winning requester index. |
Signals
Name |
Type |
Direction / role |
Description |
|---|---|---|---|
|
|
input |
Clock for this component or interface domain. |
|
|
input |
Active-high synchronous priority reset; combinational grants remain visible. |
|
|
input |
Active requester bitmap. |
|
|
input |
Consumer accepts the current winning grant. |
|
|
output |
One-hot winning requester bitmap. |
|
|
output |
At least one requester is selected. |
|
|
output |
Index of the winning requester. |
Architecture and operation
The arbiter selects combinationally from the live request bitmap, scanning
from a registered rotating priority and wrapping at PORTS. grant
is one-hot and grant_index is its encoded port number when
grant_valid is high. An empty request vector produces zero grant and
low grant-valid; the index then reflects the retained starting priority
and must not be treated as a winner.
At a rising edge, accept && grant_valid advances priority to the port
after the accepted winner. No acceptance, or acceptance with no requester,
leaves it unchanged. Persistent requesters receive turns as grants are
accepted. PORTS need not be a power of two; wrapping uses its actual
value. INDEX_W must encode every port, with a minimum of one bit.
The selected grant is not retained under backpressure. Even with ACCEPT low, changing the request vector can change the combinational winner. An owner that needs a stable transaction selection must retain it at the surrounding handshake boundary. The arbiter itself owns only rotating priority, not transaction state.
RST synchronously resets priority to port 0 and overrides acceptance at that edge. It does not mask the combinational grant, so requests can still produce a grant while RST is high. Only grant-valid qualifies the index.
Functional scenarios
The examples use PORTS = 3 and INDEX_W = 2. Bit 0 corresponds to port
0. Request and grant bitmaps use the 0b prefix; the encoded grant index
is shown only with grant-valid. Ticks are intervals ending at rising
sampling edges. Reset has already been released except where shown.
Three-port rotation and wraparound
All three ports request in ticks 1 through 7 and every grant is accepted. Winners are 0, 1, 2, 0, 1, 2, 0, demonstrating wrap at three ports. With no request from tick 8, grant-valid falls and ACCEPT cannot advance priority by itself.
Accepted grants rotate across three ports and wrap without a bubble
An unaccepted winner can change with the requests
With priority initially at zero, request 0b100 selects port 2 in tick 1.
ACCEPT is low. Changing the bitmap to 0b110 in tick 2 changes the winner
to port 1 without a clocked acceptance. Port 1 is accepted in tick 3,
moving priority to port 2.
Port 2 wins with all ports requesting in tick 4. In tick 5, only port 0 requests and it wins even though ACCEPT remains low. When all request again in tick 6, port 2 wins and is accepted. The empty vector in tick 7 leaves priority at zero, so port 0 wins in tick 8.
Live request changes can change a grant before acceptance
Synchronous reset changes priority without masking grant
Port 1 is accepted in tick 1, placing port 2 first in tick 2. RST rises in tick 3 while every port requests; the combinational winner is still port 2. The reset edge restores priority to zero, so port 0 wins in tick 4 even though RST remains high. Reset overrides the ACCEPT asserted in tick 3.
After release, port 0 is accepted in tick 5. An empty vector in tick 6 does not advance priority. Port 2 can then win alone in tick 7 and wrap priority to zero for the all-requesting tick 8.
Reset restores priority at the edge while combinational grants remain