-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSevenSegment_decoder.vhd
More file actions
43 lines (39 loc) · 1.36 KB
/
SevenSegment_decoder.vhd
File metadata and controls
43 lines (39 loc) · 1.36 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
-- --- Seven segment component
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity SevenSegment_decoder is
Port (
H : out STD_LOGIC_VECTOR (7 downto 0);
input : in STD_LOGIC_VECTOR (3 downto 0);
DP : in STD_LOGIC
);
end SevenSegment_decoder;
architecture Behavioral of SevenSegment_decoder is
begin
Process (input)
begin
Case input is -- 7-Segment Display:
when "0000" => H(6 downto 0)<="1000000"; -- 0
when "0001" => H(6 downto 0)<="1111001"; -- 1
when "0010" => H(6 downto 0)<="0100100"; -- 2
when "0011" => H(6 downto 0)<="0110000"; -- 3
when "0100" => H(6 downto 0)<="0011001"; -- 4
when "0101" => H(6 downto 0)<="0010010"; -- 5
when "0110" => H(6 downto 0)<="0000010"; -- 6
when "0111" => H(6 downto 0)<="1111000"; -- 7
when "1000" => H(6 downto 0)<="0000000"; -- 8
when "1001" => H(6 downto 0)<="0011000"; -- 9
when "1010" => H(6 downto 0)<="0000110"; -- E
when "1011" => H(6 downto 0)<="1001110"; -- R
When others => H(6 downto 0)<="1111111"; -- blank display
End Case;
End Process;
Process (DP)
begin
if (DP='0') then
H(7)<='1';
else
H(7)<='0';
end if;
End Process;
end Behavioral;