/
Button_Contention_Resolver_tb.v
126 lines (115 loc) · 2.69 KB
/
Button_Contention_Resolver_tb.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 05:33:41 11/22/2012
// Design Name: Button_Contention_Resolver
// Module Name: C:/Users/Sachin Shinde/Desktop/6.111/Final Project/Verilog/Final_Project/Button_Contention_Resolver_tb.v
// Project Name: Final_Project
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: Button_Contention_Resolver
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module Button_Contention_Resolver_tb;
// Inputs
reg clk;
reg reset;
reg button0_in;
reg button1_in;
reg button2_in;
reg button3_in;
reg button_enter_in;
reg button_left_in;
reg button_right_in;
reg button_up_in;
reg button_down_in;
// Outputs
wire button0_out;
wire button1_out;
wire button2_out;
wire button3_out;
wire button_enter_out;
wire button_left_out;
wire button_right_out;
wire button_up_out;
wire button_down_out;
// Instantiate the Unit Under Test (UUT)
Button_Contention_Resolver uut (
.clk(clk),
.reset(reset),
.button0_in(button0_in),
.button1_in(button1_in),
.button2_in(button2_in),
.button3_in(button3_in),
.button_enter_in(button_enter_in),
.button_left_in(button_left_in),
.button_right_in(button_right_in),
.button_up_in(button_up_in),
.button_down_in(button_down_in),
.button0_out(button0_out),
.button1_out(button1_out),
.button2_out(button2_out),
.button3_out(button3_out),
.button_enter_out(button_enter_out),
.button_left_out(button_left_out),
.button_right_out(button_right_out),
.button_up_out(button_up_out),
.button_down_out(button_down_out)
);
// Create 100MHz clock
always #5 clk = ~clk;
initial begin
// Initialize Inputs
clk = 0;
reset = 1;
button0_in = 0;
button1_in = 0;
button2_in = 0;
button3_in = 0;
button_enter_in = 0;
button_left_in = 0;
button_right_in = 0;
button_up_in = 0;
button_down_in = 0;
// Wait 100 ns for global reset to finish
#100;
// Add stimulus here
@(posedge clk)
reset <= 0;
button0_in <= 1;
@(posedge clk)
button1_in <= 1;
@(posedge clk)
button2_in <= 1;
@(posedge clk)
button3_in <= 1;
@(posedge clk)
button0_in <= 0;
@(posedge clk)
button1_in <= 0;
@(posedge clk)
button2_in <= 0;
@(posedge clk)
button3_in <= 0;
button0_in <= 1;
@(posedge clk)
button0_in <= 0;
button1_in <= 1;
@(posedge clk)
button1_in <= 0;
button2_in <= 1;
@(posedge clk)
button2_in <= 0;
button3_in <= 1;
end
endmodule