-
Notifications
You must be signed in to change notification settings - Fork 0
/
top.v
134 lines (106 loc) · 2.48 KB
/
top.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
126
127
128
129
130
131
132
133
134
`timescale 1ns / 1ps
module Top(
input clk,reset,
inout wire ps2d, ps2c,
//output wire mouseclick2,
output reg [7:0] seg,
output reg [3:0] an,
input linksBtn,
input rechtsBtn,
input zentrumBtn,
output wire [7:0] RGB,
output hsync,output vsync
);
wire [9:0] px_reg;
wire [9:0] py_reg;
wire mouseclick2;
// signal declaration
wire video_on, pixel_tick;
wire enable;
//Screen position
wire [9:0] pixel_x, pixel_y;
///Wires used for the game connection
wire [1:0] topLeft;
wire [1:0] topCenter;
wire [1:0] topRight;
wire [1:0] middleLeft;
wire [1:0] middleCenter;
wire [1:0] middleRight;
wire [1:0] bottonLeft;
wire [1:0] bottonCenter;
wire [1:0] bottonRight;
wire [2:0] state;
wire [9:0] xScore;
wire [9:0] yScore;
wire selectedOption;
wire Links;
wire Rechts;
wire Zentrum;
debouncer DB6(.clk(clk), .PB(linksBtn), .PB_state(Links));
debouncer DB7(.clk(clk), .PB(rechtsBtn), .PB_state(Rechts));
debouncer DB8(.clk(clk), .PB(zentrumBtn), .PB_state(Zentrum));
TicTacToe gameLogic(
.clk(clk),
.Boton_izquierda(Links),
.Boton_derecha(Rechts),
.Boton_onoff(Zentrum),
//input signals from the mouse
.mouseX(px_reg),
.mouseY(py_reg),
.mouseBotton(mouseclick2),
//State of each of the cells
.topLeft(topLeft),
.topCenter(topCenter),
.topRight(topRight),
.middleLeft(middleLeft),
.middleCenter(middleCenter),
.middleRight(middleRight),
.bottonLeft(bottonLeft),
.bottonCenter(bottonCenter),
.bottonRight(bottonRight),
//Current State
.state(state),
//Score of each player
.xScore(xScore),
.OScore(yScore),
//Current option for the buttons
.selectedOption(selectedOption)
);
pixel_Gen pixls(
.topLeft(topLeft),
.topCenter(topCenter),
.topRight(topRight),
.middleLeft(middleLeft),
.middleCenter(middleCenter),
.middleRight(middleRight),
.bottonLeft(bottonLeft),
.bottonCenter(bottonCenter),
.bottonRight(bottonRight),
.state(state),
.xScore(xScore),
.yScore(yScore),
.selectedOption(selectedOption),
.mousex(px_reg),
.mousey(py_reg),
.pixel_tick(pixel_tick),
.pixel_x(pixel_x),
.pixel_y(pixel_y),
.video_on(video_on),
.rgb(RGB)
);
//Control del VGA
vga_sync Sincronizador(.clk(clk),
.hsync(hsync), .vsync(vsync),
.video_on(video_on), .p_tick(pixel_tick),
.pixel_x(pixel_x), .pixel_y(pixel_y));
// Instantiate the module
mouse_led instance_name (
.clk(clk),
.reset(reset),
.ps2d(ps2d),
.ps2c(ps2c),
.px_reg(px_reg),
.py_reg(py_reg),
.mouseclick(mouseclick2)
);
endmodule