Blog

What is Arbiter | Priority Arbiter | Round Robin Arbiter

What is Arbiter
Verilog

What is Arbiter | Priority Arbiter | Round Robin Arbiter

What is an arbiter?

An Arbiter is used to provide access of data bus whenever there are more than one requesters for the bus, we can say arbiter is like a traffic police constable who grant the access of road to the vehicle drivers according to the traffic rules.

Consider the case of a System-on-Chip (SoC). When we say SoC it symbolizes a complete system compromising of different units on single chip. In SoC the data transfer between different units takes place via single bus.

So to remove ambiguity we need to provide bus to a single unit at a particular time. Here we have different units as requesters and bus as our resource.

 

Priority Arbiter

An arbiter in which we set priority to the requesters and requests are serviced according to the priority of requester. In Priority arbiter the priority of requesters are fixed not varying as in case of Round-Robin arbiter.

In above case we are assuming that the priority of req0 is highest and the priority is in decreasing order is as req1, req2, req3. So when requester with higher priority requests for resource we will neglect low priority requesters.

 

Uses and Advantages

The basic use of Priority arbiter is to allocate resources on the basis of priority. In priority arbiter the priority of the requesters are fixed unlike Round-Robin Arbiter.

The main advantage of Priority arbiter over Round-Robin arbiter is that we can give preference to any particular requester.

 

Disadvantages

The main disadvantage of Priority arbiter is that it led its requesters to wait for the grant if requester has the higher priority. When a high priority requester keep requesting for resource frequently, it will result in starvation of requesters with low priority.

 

Working principle of Priority arbiter

All the requests are examined first. Now the requester with highest priority is given the resource, then we will move to the next highest priority requester among the remaining requests.

In Priority arbiter the priority of requesters are remain unchanged. So if the requester with high priority again makes a request, it will be served before serving the previous request of low priority requester.

This process is continued till there is no more requests are left.

 

Logic for assigning controls to different requesters using Priority Arbiter:

At beginning of each cycle set all the output requests as logic zero.

oreq0=0;

oreq1=0;

oreq2=0;

oreq3=0;

Now check for requests from requesters in the order of decreasing priority. Here we have assumed that req0 has highest priority then comes req1 then req2 and at last req3. In following code request with highest priority is checked first and if no request has been made then only we will move to lower priority requests otherwise resource will be allotted to requester with greater priority.

if(rreq0==1)

oreq0=1;

else

if(rreq1==1)

oreq1=1;

else

if(rreq2==1)

oreq2=1;

else

if(rreq3==1)

oreq3=1;

 

Round-Robin arbiter

An arbiter in which the priority of requesters is set in a way that every requester get resource equally. In Round-Robin arbiter the priority of every requester keep changing with each allocation of resource.

The state diagram for a Round-Robin arbiter is as shown:round robin arbiter

Figure 1: State diagram for Round-Robin Arbiter

Here all the requesters are provided with the resource in a round fashion. Consider a state let it be 01, now to get resource again it have to pass through all other states.

 

Uses and advantages

The basic use of Round-Robin arbiter is to allocate resource to requesters uniformly. In Round-Robin arbiter there is no predefined priority of requesters as in case of Priority arbiter.

The main advantage of Round-Robin arbiter over Priority arbiter is that it does not led the requesters to starvation.

 

Disadvantages

In Round-Robin arbiter every requester is treated equally. If we need to give importance to a specific unit we cannot. Even if we want to allocate resource to a particular unit frequently, between two successive allocations Round-Robin arbiter will allocate resource to all requesters once.

 

Working principle of Round-Robin arbiter

Initially when there is no request already, the first requester is given highest priority. Now request from next requester is given lower priority than previous one. This process is continued till we assign priority to all requesters.

Now the requester with highest priority is allotted resource and now we change its priority to the lowest and priority of other requesters get incremented by one. Now next time again the requester with highest priority is allotted the resource and this process is continued till there is no other requests are left.

 

Logic for assigning controls to different requesters using Round-Robin Arbiter:

Below written statement will make you understand the how you can write a verilog code of the round-robin arbiter.

Declare a variable count, for every cycle set count as zero.

At the beginning of every cycle check for requests in a sequence as shown:

if(count==0)

begin

if(!req0)

begin

count=count+1;

if(!req1)

begin

count=count+1;

if(!req2)

count=count+1;

end

end

end

Now according to the value of count we define a case and we will use three flags to show upcoming requests in sequence are made or not. As shown below:

case(count)

0:begin   // count=0 shows the initial state of the arbitration

if(req0)

oreq0=1;

if(!req1)

begin

f1=1;

if(!req2)

begin

f2=1;

if(!req3)

f3=1;

end

end

end

1:begin    // count=1 shows the 1st state of the arbitration

if(req1)

oreq1=1;

if(!req2)

begin

f2=1;

if(!req3)

f3=1;

end

end

2:begin // count=2 shows the 2nd state of the arbitration

if(req2)

oreq2=1;

if(!req3)

f3=1;

end

3:begin     // count=3 shows the third state of the arbitration

if(req3)

oreq3=1;

end

endcase

Now according to value of flags either assign a particular value to count or simply increment the value of count. As shown below:

if((f3 && f2 && f1)|| f3)

count=0;

else

if((f2 && f1)|| f2)

count=3;

else
if(f1)

count=2;

Leave your thought here