This repository was archived by the owner on Jun 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbcd2seg.v
More file actions
53 lines (50 loc) · 1.23 KB
/
bcd2seg.v
File metadata and controls
53 lines (50 loc) · 1.23 KB
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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:13:20 06/15/2024
// Design Name:
// Module Name: bcd2seg
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module bcd2seg(
input [3:0] bcd,
output [7:0] seg
);
//assign seg = ~(
// (bcd == 4'd0) ? 8'b00111111 :
// (bcd == 4'd1) ? 8'b00000110 :
// (bcd == 4'd2) ? 8'b01011011 :
// (bcd == 4'd3) ? 8'b01001111 :
// (bcd == 4'd4) ? 8'b01100110 :
// (bcd == 4'd5) ? 8'b01101101 :
// (bcd == 4'd6) ? 8'b01111101 :
// (bcd == 4'd7) ? 8'b00000111 :
// (bcd == 4'd8) ? 8'b01111111 :
// (bcd == 4'd9) ? 8'b01101111 :
// 8'b01000000
//);
assign seg =
(bcd == 4'd0) ? 8'b00000011 :
(bcd == 4'd1) ? 8'b10011111 :
(bcd == 4'd2) ? 8'b00100101 :
(bcd == 4'd3) ? 8'b00001101 :
(bcd == 4'd4) ? 8'b10011001 :
(bcd == 4'd5) ? 8'b01001001 :
(bcd == 4'd6) ? 8'b01000001 :
(bcd == 4'd7) ? 8'b00011111 :
(bcd == 4'd8) ? 8'b00000001 :
(bcd == 4'd9) ? 8'b00001001 :
8'b11111100;
endmodule