-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHex-7seg_8bit.txt
172 lines (127 loc) · 4.53 KB
/
Hex-7seg_8bit.txt
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 03/09/2022 03:15:11 PM
-- Design Name:
-- Module Name: hex_7seg - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity hex_7seg is
Port ( hex_i : in STD_LOGIC_VECTOR (3 downto 0);
seg_o : out STD_LOGIC_VECTOR (6 downto 0));
end hex_7seg;
architecture Behavioral of hex_7seg is
begin
--------------------------------------------------------------------
-- p_7seg_decoder:
-- A combinational process for 7-segment display (Common Anode)
-- decoder. Any time "hex_i" is changed, the process is "executed".
-- Output pin seg_o(6) controls segment A, seg_o(5) segment B, etc.
-- segment A
-- | segment B
-- | | segment C
-- +-+| | ... segment G
-- ||+-+ |
-- ||| |
-- seg_o = "0000001"-------+
--------------------------------------------------------------------
p_7seg_decoder : process(hex_i)
begin
case hex_i is
when "00011111" =>
seg_o <= "0000001"; -- 0
when "00101111" =>
seg_o <= "1001111"; -- 1
when "00100111" =>
seg_o <= "0010010"; -- 2
when "00100011" =>
seg_o <= "0000110"; -- 3
when "00100001" =>
seg_o <= "1001100"; -- 4
when "00100000" =>
seg_o <= "0100100"; -- 5
when "00110000" =>
seg_o <= "0100000"; -- 6
when "00111000" =>
seg_o <= "0001111"; -- 7
when "00111100" =>
seg_o <= "0000000"; -- 8
when "00111110" =>
seg_o <= "0000100"; -- 9
when "00000101" =>
seg_o <= "0000010"; -- A
when "00011000" =>
seg_o <= "1100000"; -- B
when "00011010" =>
seg_o <= "1110010"; -- C
when "00001100" =>
seg_o <= "1000010"; -- D
when "00000010" =>
seg_o <= "0110000"; -- E
when "00010010" =>
seg_o <= "0111000"; -- F
when "00001110" =>
seg_o <= "0100001"; -- G
when "00010000" =>
seg_o <= "1101000"; -- H
when "00000100" =>
seg_o <= "0111011"; -- I
when "00010111" =>
seg_o <= "0100111"; -- J
when "00001101" =>
seg_o <= "0101000"; -- K
when "00010100" =>
seg_o <= "1110001"; -- L
when "00000111" =>
seg_o <= "0101010"; -- M
when "00000110" =>
seg_o <= "1101010"; -- N
when "00001111" =>
seg_o <= "1100010"; -- O
when "00010110" =>
seg_o <= "0011000"; -- P
when "00011101" =>
seg_o <= "0001100"; -- Q
when "00001010" =>
seg_o <= "1111010"; -- R
when "00001000" =>
seg_o <= "0100101"; -- S
when "00000011" =>
seg_o <= "1110000"; -- T
when "00001001" =>
seg_o <= "1100011"; -- U
when "00010001" =>
seg_o <= "1010101"; -- V
when "00001011" =>
seg_o <= "1010100"; -- W
when "00011001" =>
seg_o <= "1101011"; -- X
when "00011011" =>
seg_o <= "1000100"; -- Y
when "00011100" =>
seg_o <= "0010011"; -- Z
when others =>
seg_o <= ""; --
end case;
end process p_7seg_decoder;
end architecture Behavioral;