When coming to the task of designing a weighted round arbiter in Verilog or other HDL languages, we need to consider the timing, power and area of the design, as well as the weighted arbitration algorithm.
The purpose of a weighted arbiter is to allow each requestor a share of the common resource which is relative to his predefined weight. For example, if only two requestors have the weight of 3 and 4 respectively, then over a long period of time, assuming both requestors always have their request asserted, the first one will get 3/7 of the grants and the second will get 4/7 of the total grants.
The weight is therefore a mean for setting specific priorities to the different requestors. Contrary to the strict priority arbitration, the weighted arbiter maintains the fairness for all requestors and prevents starvation by serving all requestors according their relative predefined weight, preventing one requestor from dominating the shared resource indefinitely. Using this arbiter results in the number of acknowledges for each valid requestor being relative to its proportional weight with the exception that an inactive requestor is skipped regardless of its weight.
The design of a weighted round robin arbiter is naturally based on the implementation of an equal share round robin arbiter discussed in previous article, “how to design a round robin arbiter”, so please read this one first.
The Weighted round robin arbiter design relies on the simple concept of request masking. As it is used in the equal share arbiter, after each grant, a shift-left version of the thermometer decoded one-hot vector is loaded into the mask register, so the last requestor that was served, cannot be served again, forcing the arbiter to grant the next requestor.
The drawing shows the calculation of the next mask in the standard round robin arbiter.
The purpose of the mask is to block the request vector going into the PPC based find-first-set logic, responsible for selecting the next grant.
The idea of the weighted arbiter is not to rely on a shift left operation to block the currently granted request and allow multiple requests to be granted to the same requestor until it exceeds is predefined weight for the current round.
For that purpose, the next mask would actually be the same as the thermometer encoded grant vector and the request would be blocked by the weight logic at the input of the PPC logic priority arbiter.
The weight calculation is based on a counter, counting the number of grants to each requestor. Once the counter reaches the predefined weight of the specific requestor, it causes the request to be blocked, forcing the PPC arbitration to select the next requestor.
Each time the grant vector changes, the weight counter starts counting from the start. If the grant was acknowledged in the very first cycle, the counter would start at a value of 1; otherwise it will start at 0. At the same time the counter is loaded, the weight of the requestor is kept for the purpose of the comparison.
Every time a grant of the arbiter is acknowledged, the counter would increment until the comparison indicates that the number of acknowledges for that requestor has reached its predefined weight value. At this point, the request will become blocked until the next round.
The design of a round robin arbiter using Parallel Prefix Computation (PPC) for masked and unmasked find-first-set priority encoding, is both simple and efficient, making the seemingly complicated features of a round robin arbiter such as wraparound and “work conserving” into a straight forward task. The usage of weight counter for blocking the request at the block input is the best way to add this functionality to the round robin arbiter without interfering in its internals.
The overall design is robust, scalable, and easy to extend to any number of requestors and simple for pipeline integration.
The weighted round robin arbiter logic design, Verilog code and documentation can be found in the RTLery library arbiters section, where you can find the design and Verilog source code for a variety of round robin arbiters such as deficit round robin arbiter, weighted round robin arbiter and more. Please see the arbiters section form more details.