This repository has been archived by the owner on Jun 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shot_the_Clock.v
102 lines (85 loc) · 2.18 KB
/
Shot_the_Clock.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
//=======================================================
// This code is generated by Terasic System Builder
//=======================================================
module Shot_the_Clock(
//////////// CLOCK //////////
input MAX10_CLK1_50,
//////////// SEG7 //////////
output [7:0] HEX0,
output [7:0] HEX1,
output [7:0] HEX2,
output [7:0] HEX3,
output [7:0] HEX4,
output [7:0] HEX5,
//////////// KEY //////////
input [1:0] KEY,
//////////// LED //////////
output [9:0] LEDR,
//////////// SW //////////
input [9:0] SW
);
//=======================================================
// REG/WIRE declarations
//=======================================================
wire [6:0] count_SW, count_KEY;
wire [3:0] count_KEY_digit, count_KEY_ten;
wire [3:0] count_SW_digit, count_SW_ten;
wire [9:0] SW_d;
wire clock_1s, clock_100ms, clock_10ms;
wire [3:0] hour_tens, hour_digits;
wire [3:0] min_tens, min_digits;
wire [3:0] sec_tens, sec_digits;
wire hour_add, hour_sub;
wire min_add, min_sub;
wire sec_add, sec_sub;
//=======================================================
// Structural coding
//=======================================================
SW_DEBOUNCE usw(
.clk(clock_100ms),
.iSW(SW),
.oSW_d(SW_d)
);
clock_all uclock(
.clk(MAX10_CLK1_50),
.clock_100ms(clock_100ms),
.clock_1s(clock_1s),
.clock_10ms(clock_10ms)
);
eclock u_myclock(
.clk(clock_1s),
.rst(!SW_d[0]),
.shot(KEY[0]),
.shotClk(clock_100ms),
.shotRst(KEY[1]),
.hour_add(SW_d[9]),
.hour_sub(SW_d[8]),
.hour_tens(hour_tens),
.hour_digits(hour_digits),
.min_add(SW_d[7]),
.min_sub(SW_d[6]),
.min_tens(min_tens),
.min_digits(min_digits),
.sec_add(SW_d[5]),
.sec_sub(SW_d[4]),
.sec_tens(sec_tens),
.sec_digits(sec_digits)
);
SEG7_LUT_6 u_seg(
.oSEG0(HEX0),
.oSEG1(HEX1),
.oSEG2(HEX2),
.oSEG3(HEX3),
.oSEG4(HEX4),
.oSEG5(HEX5),
.iDIG ({hour_tens, hour_digits, min_tens, min_digits, sec_tens, sec_digits }),
.iDot ({5'b0, clock_1s})
);
// assign LEDR = {SW[9], SW[8], SW[7], SW[6], SW[5], SW[4], SW[3], SW[2], SW[1], SW[0]};
ledMeteor u_meteor(
.clk(clock_10ms),
.rst(!SW_d[0]),
.shot(KEY[0]),
.LEDR(LEDR)
);
endmodule