Problems

25. Round-robin arbiter

HardWrite the moduleAbout 35 min
arbiterfairnesspriority

Four requesters share one resource. Each cycle, grant at most one of them, fairly.

req[i] = 1 means requester i wants the resource this cycle. grant is combinational: it has exactly one bit set (the winner) when any request is active, and is 0 when none is.

Fairness: remember the last requester that was granted. The search for a winner starts at the requester just after it and goes upward, wrapping from 3 to 0, so the requester that was just served has the lowest priority next time. The remembered value changes only on a clock edge where some grant was given; if nobody requests, it stays as it was.

rst (synchronous, active high) sets the remembered value to 3, so that requester 0 has the highest priority after reset.

Ports

Module rr_arb4

PortDirBitsWhat it is
clkin1Clock.
rstin1Synchronous reset, active high.
reqin4Requests, one bit per requester.
grantout4One-hot grant, or 0.

Example

After reset with req = 1111, the grants on successive cycles are 0001, 0010, 0100, 1000, 0001. With req = 1010 and requester 1 just served, the grant goes to requester 3.

Stuck? . Sign in to save your progress. You can solve the free problems without an account.

Verilogrr_arb4.v
14px
Loading the editor…

Submit your answer to have it graded. The hidden test runs on the server; you see whether it passes and, if not, the first case it gets wrong.

Round-robin arbiter: Verilog interview question | breadboardhub