-
Notifications
You must be signed in to change notification settings - Fork 0
/
seg_converter.v
51 lines (48 loc) · 1.26 KB
/
seg_converter.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
`timescale 1ns / 1ps
module seg_converter(
input [3:0] number,
input reset,
output reg [6:0] seg
);
/*
initial begin
seg = 7'b1111110;
end
always @(*) begin
if (reset) begin
seg = 7'b1111110;
end
else begin
case(number)
1: seg = 7'b1001111;
2: seg = 7'b0010010;
3: seg = 7'b1111110;
default: seg = 7'b1111110;
endcase
end
end
*/
initial begin
seg = 7'b1111110;
end
always @(*) begin
if (reset) begin
seg = 7'b1111110;
end
else begin
case(number)
0: seg = 7'b0000001;
1: seg = 7'b1001111;
2: seg = 7'b0010010;
3: seg = 7'b0000110;
4: seg = 7'b1001100;
5: seg = 7'b0100100;
6: seg = 7'b0100000;
7: seg = 7'b0001101;
8: seg = 7'b1111110;
9: seg = 7'b1111110;
default: seg = 7'b1111110;
endcase
end
end
endmodule