This is the third part of a series of articles on VHDL arbiters.
On the first part, we commented what a VHDL arbiter is.
On the second part, we saw the VHDL code for a fixed priority VHDL arbiter.
When I talked about what a VHDL arbiter is, I gave the example of the single car we have at home, and how I have to decide who gets to use the car on next Friday evening. In a typical situation, if both children ask for the car, the first thing they will account for is, who got the car the last time.
The fixed priority arbiter is the equivalent of always giving your car to the same child. It will, no doubts, create problems.
If you don’t want to create problems, you will make a balanced assignment of the valued resource between the solicitors.
And again, in HW is just the same. If several intelligent devices want to reach a common bus or a common memory, in most cases you will want to give them equal access. The arbiter we present in this part of the series does just that. It enables all the solicitors to get equal access. It does that using what is called a round-robin strategy.
The round-robin strategy is best illustrated on an ‘all begging’ situations. Imagine that each time the arbiter decides to give the resource to one solicitor, all of them are claiming it. The first time, the arbiter gives the resource to master 0. The next time it has to decide, all masters ask for the resource, but this time, the round-robin arbiter gives the resource to master 1. On the next arbitration opportunity, to master 2. Etc.
So, enough talk for now, let’s see the code and simulation.
A core signal for the implementation of the round-robin strategy is priority. This array tells the arbiter where to start looking for in the queue of solicitors. As you can see on lines 49 and 50 of the VHDL source code, when the arbiter makes a new decision, it rotates the priority array.
By rotating the priority array, each master goes one step further into the queue. The master that had the highest priority, goes to the tail of the queue.
The priority mechanism takes into account only the masters that are asserting their req lines. Even if a master is at the tail of the queue, if it is the only one asking for the resource, it will get it. The priority mechanism is important only when there are several masters with req asserted. The master with the highest priority requesting for the resource, will receive gnt.
On the Modelsim simulation below we can see several situations where more than one master assert their request lines. The first cursor indicates a situation where master 2 and master 1 ask for the resource, and it is given to master 2. Later on (second cursor), both masters assert their req lines again, but this time, it is granted to master 1.
The source files for the round-robin arbiter and testbench are available here.