top of page

Arbiter

Estimated reading time: 10 mins

​

 

 

 

 


​

Imagine you have a classroom with multiple students who want to use a single pencil sharpener. However, only one student can use the pencil sharpener at a time. To ensure fair access to the pencil sharpener, you decide to implement an arbiter system using SystemVerilog.

In SystemVerilog, an arbiter is a module that helps in making decisions or granting access to shared resources. In this scenario, the arbiter module will determine which student gets to use the pencil sharpener at any given time.

Here's a simplified example of an arbiter module in SystemVerilog:

Also find code at: https://edaplayground.com/x/Rifz

In this code, the Arbiter module takes two inputs: request and grant. The request input is an 8-bit signal where each bit represents a student's request to use the pencil sharpener (1 indicates a request, and 0 indicates no request). The grant output is also an 8-bit signal that indicates which student has been granted access to the pencil sharpener.

The priority variable is used to determine the highest priority request among the students who haven't been granted access yet. The & operator performs a bitwise AND operation between the request and the negation of grant (to filter out students who have already been granted access).

The if statement checks if there is a non-zero priority, indicating that there is a student who hasn't been granted access yet. If there is, the grant signal is updated using bitwise AND (&) and two's complement (-) operations to set the highest priority bit among the ungranted requests.

To put it in simpler terms, the arbiter module receives requests from students and evaluates which student has the highest priority to use the pencil sharpener based on the requests received so far. It ensures that only one student is granted access to the pencil sharpener at any given time.

Testbench code: 

Screenshot 2023-06-17 7.25.28 PM.png
bottom of page