blob: 1c25a597a39ac8919eabc948fb7132e210ed46e8 (
plain)
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
|
module hexled (
value,
s7
);
input [3:0] value;
output [6:0] s7;
reg [6:0] s7;
always @( value )
begin
case ( value )
4'h0: s7 = ~7'b0111111;
4'h1: s7 = ~7'b0000110;
4'h2: s7 = ~7'b1011011;
4'h3: s7 = ~7'b1001111;
4'h4: s7 = ~7'b1100110;
4'h5: s7 = ~7'b1101101;
4'h6: s7 = ~7'b1111101;
4'h7: s7 = ~7'b0000111;
4'h8: s7 = ~7'b1111111;
4'h9: s7 = ~7'b1101111;
4'hA: s7 = ~7'b1110111;
4'hB: s7 = ~7'b1111100;
4'hC: s7 = ~7'b0111001;
4'hD: s7 = ~7'b1011110;
4'hE: s7 = ~7'b1111001;
4'hF: s7 = ~7'b1110001;
endcase
end
endmodule // hexled
module hexledx (
value,
blank,
minus,
s7
);
input [3:0] value;
input blank;
input minus;
output [6:0] s7;
reg [6:0] s7;
always @( value or blank or minus )
begin
if ( blank )
s7 = ~7'b0000000;
else if ( minus )
s7 = ~7'b1000000;
else case ( value )
4'h0: s7 = ~7'b0111111;
4'h1: s7 = ~7'b0000110;
4'h2: s7 = ~7'b1011011;
4'h3: s7 = ~7'b1001111;
4'h4: s7 = ~7'b1100110;
4'h5: s7 = ~7'b1101101;
4'h6: s7 = ~7'b1111101;
4'h7: s7 = ~7'b0000111;
4'h8: s7 = ~7'b1111111;
4'h9: s7 = ~7'b1101111;
4'hA: s7 = ~7'b1110111;
4'hB: s7 = ~7'b1111100;
4'hC: s7 = ~7'b0111001;
4'hD: s7 = ~7'b1011110;
4'hE: s7 = ~7'b1111001;
4'hF: s7 = ~7'b1110001;
endcase
end
endmodule // hexledx
|