-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTest_Arbiter.v
77 lines (59 loc) · 1.77 KB
/
Test_Arbiter.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*##########Script Information###############################
# Purpose: Arbiter testbench For System Bus Design
# Updated: 07-08-2022
# Author : Rumesh
###########################################################*/
`timescale 1ns / 1ps
module Test_Arbiter;
// Inputs
reg CLK;
reg RST;
reg HREQ_1;
reg HLOCK_1;
reg HREQ_2;
reg HLOCK_2;
reg [1:0] HSPLIT;
reg [1:0] HRESP;
// Outputs
wire HGRANT_1;
wire HGRANT_2;
wire [1:0] HMAS;
wire MLOCK;
wire [1:0] SEL;
wire AB;
// Instantiate the Unit Under Test (UUT)
Arbiter uut (
.CLK(CLK),
.RST(RST),
.HREQ_1(HREQ_1),
.HLOCK_1(HLOCK_1),
.HREQ_2(HREQ_2),
.HLOCK_2(HLOCK_2),
.HSPLIT(HSPLIT),
.HRESP(HRESP),
.HGRANT_1(HGRANT_1),
.HGRANT_2(HGRANT_2),
.HMAS(HMAS),
.MLOCK(MLOCK),
.SEL(SEL),
.AB(AB),
.HREADY(HREADY)
);
always #15 CLK = !CLK;
initial begin
#400 RST = 1;
#50 RST = 0;
end
initial begin
// Initialize Inputs
CLK = 0;
RST = 0;
// Wait 100 ns for global reset to finish
#100 HREQ_1 <= 1; HREQ_2 <= 0; HRESP <= 0; HSPLIT <= 0;HLOCK_1 <= 0;HLOCK_2 <= 0; // Master 1 request
#100 HREQ_1 <= 0; HREQ_2 <= 0; HRESP <= 2'b01; HSPLIT <= 0;HLOCK_1 <= 0;HLOCK_2 <= 0;
#100 HREQ_1 <= 1; HREQ_2 <= 1; HRESP <= 0; HSPLIT <= 0;HLOCK_1 <= 0;HLOCK_2 <= 0; // Master 1 & 2 request
#200 HREQ_1 <= 0; HREQ_2 <= 0; HRESP <= 2'b01; HSPLIT <= 0;HLOCK_1 <= 0;HLOCK_2 <= 0;
#100 HREQ_1 <= 1; HREQ_2 <= 1; HRESP <= 0; HSPLIT <= 0;HLOCK_1 <= 1;HLOCK_2 <= 0; // Master 1 priority request
#100 HREQ_1 <= 0; HREQ_2 <= 0; HRESP <= 2'b01; HSPLIT <= 0;HLOCK_1 <= 0;HLOCK_2 <= 0;
end
endmodule