This repository has been archived by the owner on Apr 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bin27seg.v
executable file
·48 lines (45 loc) · 1.56 KB
/
bin27seg.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
//-----------------------------------------------------------------------------------
// Module: bin27seg.v
// Project: CPCI (PCI Control FPGA)
// DESCRIPTION : BIN to seven segments converter
// segment encoding
// a
// +---+
// f | | b
// +---+ <- g
// e | | c
// +---+
// d
// Enable (EN) active : high
// Outputs (data_out) active : low
//-----------------------------------------------------------------------------------
module bin27seg (data_in ,EN ,data_out );
input [3:0] data_in ;
input EN ;
output [6:0] data_out ;
reg [6:0] data_out ;
always @(data_in or EN )
begin
data_out = 7'b1111111;
if (EN == 0)
case (data_in )
4'b0000: data_out = 7'b1000000; // 0
4'b0001: data_out = 7'b1111001; // 1
4'b0010: data_out = 7'b0100100; // 2
4'b0011: data_out = 7'b0110000; // 3
4'b0100: data_out = 7'b0011001; // 4
4'b0101: data_out = 7'b0010010; // 5
4'b0110: data_out = 7'b0000010; // 6
4'b0111: data_out = 7'b1111000; // 7
4'b1000: data_out = 7'b0000000; // 8
4'b1001: data_out = 7'b0010000; // 9
4'b1010: data_out = 7'b0001000; // A
4'b1011: data_out = 7'b0000011; // b
4'b1100: data_out = 7'b0100111; // c
4'b1101: data_out = 7'b0100001; // d
4'b1110: data_out = 7'b0000110; // E
4'b1111: data_out = 7'b0001110; // F
default: data_out = 7'b1111111;
endcase
end
endmodule