-
Notifications
You must be signed in to change notification settings - Fork 3
/
ScoreDecoder.v
88 lines (83 loc) · 1.42 KB
/
ScoreDecoder.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
module ScoreDecoder(in, Hex2, Hex1);
input [4:0]in;
output reg [6:0] Hex2,Hex1;
parameter zero = 7'b1000000;
parameter one = 7'b1111001;
parameter two = 7'b0100100;
parameter three = 7'b0110000;
parameter four = 7'b0011001;
parameter five = 7'b0010010;
parameter six = 7'b0000010;
parameter seven = 7'b1111000;
parameter eight = 7'b0000000;
parameter nine = 7'b0011000;
parameter blank = 7'b1111111;
always@(*) begin
case(in)
0: begin
Hex1 <= zero;
Hex2 <= blank;
end
1: begin
Hex1 <= one;
Hex2 <= blank;
end
2: begin
Hex1 <= two;
Hex2 <= blank;
end
3: begin
Hex1 <= three;
Hex2 <= blank;
end
4: begin
Hex1 <= four;
Hex2 <= blank;
end
5: begin
Hex1 <= five;
Hex2 <= blank;
end
6: begin
Hex1 <= six;
Hex2 <= blank;
end
7: begin
Hex1 <= seven;
Hex2 <= blank;
end
8: begin
Hex1 <= eight;
Hex2 <= blank;
end
9: begin
Hex1 <= nine;
Hex2 <= blank;
end
10: begin
Hex1 <= zero;
Hex2 <= one;
end
11: begin
Hex1 <= one;
Hex2 <= one;
end
12: begin
Hex1 <= two;
Hex2 <= one;
end
13: begin
Hex1 <= three;
Hex2 <= one;
end
14: begin
Hex1 <= four;
Hex2 <= one;
end
15: begin
Hex1 <= five;
Hex2 <= one;
end
endcase
end
endmodule