Arbiter Operates: Arbiter is a device used in a multimaster bus system to decide which bus master will be allowed to control the bus for each bus cycle. The input of arbiter inclusion: request (8bits), priority (24bits), roundORpriority (1bit), reset (1bit), clock. The output of arbiter inclusion: bits of grant (8bits)
Trang 1VLSI DESIGN AUTOMATION
Homework #2
Test bench for Arbiter
Student: Bui Huu Nguyen
ID number: 2016310539
Submission Date: 2016/10/06
Trang 2Arbiter
ENB
ENB
ENB
ENB
ENB
ENB
ENB
ENB
Grant-8bits [7:0]
BUS
[7:0]
Arbiter
CPU
Priority-24bits Request-8bits RoundORpriority-1bit Reset-1bit Clock
Figure 1: Diagram input and output of Arbiter Arbiter Operates:
- Arbiter is a device used in a multi-master bus system to decide which bus master will be allowed to control the bus for each bus cycle
- The input of arbiter inclusion: request (8bits), priority (24bits), roundORpriority (1bit), reset (1bit), clock
- The output of arbiter inclusion: bits of grant (8bits)
Trang 3A Write test bench
1 Selection bit roundORpriority equal 0 that has round mode
0-1-2-3-4-5-6-7
Figure 2: Round mode a) Single request
- Value of input “request” will be changed one bit flowing table
00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000
b) Multi request
- Value of input “request” will be changed as flowing table
11000000 11100000 00001111 11110000 11100111
2 Selection bit roundORpriority equal 1 that has priority mode
c) Multi request with different priority
- Set input “priority” to a specific value:
Request: 7-6-5-4-3-2-1-0
Order: 5-6-7-0-1-2-3-4
Priority: 24’b101-110-111-000-001-010-011-100
- Value of input “request” will be changed as flowing table
11100000 01110000 01111000 $ramdom()
d) Multi request with random priority
- priority = $random();
e) Multi request with random request and priority
Trang 4- request = $random(); priority = $random();
Code Abiter test bench
`timescale 1ns / 100 ps
module arbiter_tb();
//integer i,j,k,p,q,r,s,t,u,v ; //index for "for" loops
// -
// parameters
// -
parameter NUMUNITS = 8;
parameter ADDRESSWIDTH = 3; //number of bits needed to address NUMUNITS // -
// input and output declarations
// -
reg clock;
reg reset;
reg roundORpriority;
reg [NUMUNITS-1 : 0] request;
reg [ADDRESSWIDTH*NUMUNITS-1 : 0] priority;
wire [NUMUNITS-1 : 0] grant;
//arbiter x(clock, reset, roundORpriority, request, priority,grant);
initial begin
reset = 0;
clock = 0;
request = 8'b0;
Trang 5roundORpriority = 1'b0; // round mode priority = 24'h000000;
#10 reset = 1;
//roundORpriority = 2'b00;
//single request
request = 8'b00000001;
#10
request = 8'b00000010;
#10
request = 8'b00000100;
#10
request = 8'b00001000;
#10
request = 8'b00010000;
#10
request = 8'b00100000;
#10
request = 8'b01000000;
#10
request = 8'b10000000;
//multi request
#10
request = 8'b11000000;
#10
Trang 6request = 8'b11100000;
#10
request = 8'b00001111;
#10
request = 8'b11110000;
#10
request = 8'b11100111;
//Priority mode
roundORpriority = 1'b1; // priority mode
priority = 24'b101110111000001010011100; // 7-6-5-4-3-2-1-0 request, 5-6-7-0-1-2-3-4 priority
#10
request = 8'b11100000;
#10
request = 8'b01110000;
#10
request = 8'b01111000;
#10
request = $random(); // random request
// random priority
#10
priority = $random();
#10
request = 8'b11100000;
#10
Trang 7request = 8'b01110000;
#10
request = 8'b01111000;
// random priority and random request
#10
priority = $random();
#10
request = $random();
end
always #5 clock = ! clock;
arbiter u0(.clock (clock),.reset (reset),.roundORpriority (1'b0),.request(request),.priority (priority),.grant (grant));
endmodule
B Simulation result
1 RoundORpriority = 0, round mode
a) Single request
Trang 8-request: 00000001->grant:00000001
b Multi request
-request: 10000000 grant: 10000000 (7)
-request: 11000000 grant: 01000000 (6)
-request: 11100000 grant: 10000000 (7)
-request: 00001111 grant: 00000001 (1)
2 RoundORpriority = 0, priority mode
-request: 11100000 grant: 10000000
0-1-2-3-4-5-6-7
Trang 9-request: 01110000 grant: 00010000
-request: 01111000 grant: 00010000
-request: 00100100 grant: 00000100 (random request)
3 Multi request with random priority
-priority: 24’h895e81 = 24’b100-010-010-101-111-010-000-001
-Order: 4-2-2-5-7-2-0-1
-request: 7-6-5-4-3-2-1-0
-request: 11100000 grant: 0100000
-request: 01110000 grant: 0100000
-request: 01111000 grant: 0010000
4 Multi request with random request and priority
-priority: 24’h84d609 = 24’b100-001-001-101-011-000-001-001
-Order: 4-1-1-5-3-0-1-1
-request: 7-6-5-4-3-2-1-0
-request: 01100011 grant: 0100000 or 00000001 or 00000010 or 00100000 or
01000000