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
/
DE10_LITE_BUTTON_COUNTER.v
73 lines (58 loc) · 1.68 KB
/
DE10_LITE_BUTTON_COUNTER.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
//=======================================================
// This code is generated by Terasic System Builder
//=======================================================
module DE10_LITE_BUTTON_COUNTER(
//////////// CLOCK //////////
input ADC_CLK_10,
input MAX10_CLK1_50,
input MAX10_CLK2_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,
//////////// 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;
//=======================================================
// Structural coding
//=======================================================
assign count_KEY_digit = count_KEY[6:0]%10;
assign count_KEY_ten = (count_KEY[6:0]/10)%10;
assign count_SW_digit = count_SW[6:0]%10;
assign count_SW_ten = (count_SW[6:0]/10)%10;
COUNTER_BUTTON ucounter(
.rst(SW[9]),
.KEY(KEY),
.SW(SW[1:0]),
.count_KEY(count_KEY),
.count_SW(count_SW)
);
// COUNTER_DEBOUNCE ucounter(
// .clk(MAX10_CLK1_50),
// .rst(SW[9]),
// .KEY(KEY),
// .SW(SW[1:0]),
// .count_KEY(count_KEY),
// .count_SW(count_SW)
// );
SEG7_LUT_6 u_seg(
.oSEG0(HEX0),
.oSEG1(HEX1),
.oSEG2(HEX2),
.oSEG3(HEX3),
.oSEG4(HEX4),
.oSEG5(HEX5),
.iDIG({4'he, count_SW_ten, count_SW_digit, 4'he, count_KEY_ten, count_KEY_digit})
);
endmodule