-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtop_module.v
90 lines (57 loc) · 1.82 KB
/
top_module.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
module top_module (
input clk,
input rst,
input wire [7:0] mouse_data,
output reg [7:0] vga_r,
output reg [7:0] vga_g,
output reg [7:0] vga_b,
output reg vga_hs,
output reg vga_vs
);
wire [1:0] mouse_clk;
wire mouse_data_valid;
wire [3:0] mouse_x;
wire [3:0] mouse_y;
wire left_button;
wire right_button;
ps2_controller ps2_controller_inst (
.clk(clk),
.rst(rst),
.data_in(mouse_data),
.clk_out(mouse_clk),
.data_out_valid(mouse_data_valid),
.x(mouse_x),
.y(mouse_y),
.left_button(left_button),
.right_button(right_button)
);
vga_controller vga_controller_inst (
.clk(clk),
.rst(rst),
.h_sync(vga_hs),
.v_sync(vga_vs),
.r(vga_r),
.g(vga_g),
.b(vga_b)
);
mouse_controller mouse_controller_inst (
.clk(mouse_clk),
.x(mouse_x),
.y(mouse_y),
.left_button(left_button),
.right_button(right_button),
.vga_h_cnt(vga_controller_inst.h_cnt),
.vga_v_cnt(vga_controller_inst.v_cnt),
.vga_h_sync(vga_controller_inst.h_sync),
.vga_v_sync(vga_controller_inst.v_sync),
.vga_r(vga_controller_inst.r),
.vga_g(vga_controller_inst.g),
.vga_b(vga_controller_inst.b)
);
endmodule
/*Ýòîò ìîäóëü îáúåäèíÿåò â ñåáå òðè ìîäóëÿ:
ps2_controller_inst - ìîäóëü äëÿ ðàáîòû ñ ïðîòîêîëîì PS2 è ïîëó÷åíèÿ äàííûõ îò ìûøè;
vga_controller_inst - ìîäóëü äëÿ ðàáîòû ñ VGA;
mouse_controller_inst - ìîäóëü, êîòîðûé ïîëó÷àåò äàííûå îò ìûøè è ïåðåäàåò èõ â vga_controller_inst, ÷òîáû îòîáðàçèòü ðèñóíîê íà ýêðàíå.
Ìîäóëü âåðõíåãî óðîâíÿ ñîäåðæèò âõîäû äëÿ òàêòîâîãî ñèãíàëà è ñáðîñà, à òàêæå âûõîäû äëÿ öâåòîâûõ êàíàëîâ è ñèãíàëîâ ñèíõðîíèçàöèè VGA. Îí òàêæå ñîåäèíÿåò ñîîòâåòñòâóþùèå âõîäû è âûõîäû ìîäóëåé, êîòîðûå îí îáúåäèíÿåò.
*/