Round-robin arbiter

Share one resource fairly among many requesters.

When to use it

When several masters want the same thing, a bus, a port, a DSP block, an arbiter picks one. A fixed-priority arbiter always favours the same requester and can starve the others; a round-robin arbiter rotates who goes first, so everyone eventually wins.

How it works

Keep a pointer to where the last grant landed. Each cycle, scan the request lines starting just after the pointer and grant the first one that's asserted (one-hot), then move the pointer past it. Watch the demo: with all four requesting, the grant walks 0 → 1 → 2 → 3 and repeats.

Gotchas

Try it

Runs on our simulator, edit the code and press Run to see the waveform.

Open & fork in the playground → Ship the verified version: lfpga add lfpga_arbiter_rr

The runnable example above is a teaching version. The libfpga library ships a hardened, parameterised, CI-tested module (lfpga_arbiter_rr) for production use.

Next recipe: UART receiver