-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnibble2sevenseg.vhd
80 lines (74 loc) · 1.93 KB
/
nibble2sevenseg.vhd
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
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 23:04:38 02/13/2016
-- Design Name:
-- Module Name: nibble2sevenseg - 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 primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity nibble2sevenseg is
Port ( nibble : in STD_LOGIC_VECTOR (3 downto 0);
segment : out STD_LOGIC_VECTOR (6 downto 0));
end nibble2sevenseg;
architecture Behavioral of nibble2sevenseg is
begin
decode: process(nibble)
begin
case nibble is
when "0000" =>
segment <= "0000001"; -- 0
when "0001" =>
segment <= "1001111"; -- 1
when "0010" =>
segment <= "0010010"; -- 2
when "0011" =>
segment <= "0000110"; -- 3
when "0100" =>
segment <= "1001100"; -- 4
when "0101" =>
segment <= "0100100"; -- 5
when "0110" =>
segment <= "0100000"; -- 6
when "0111" =>
segment <= "0001111"; -- 7
when "1000" =>
segment <= "0000000"; -- 8
when "1001" =>
segment <= "0000100"; -- 9
when "1010" =>
segment <= "0001000"; -- A
when "1011" =>
segment <= "1100000"; -- b
when "1100" =>
segment <= "0110001"; -- C
when "1101" =>
segment <= "1000010"; -- d
when "1110" =>
segment <= "0110000"; -- E
when "1111" =>
segment <= "0111000"; -- F
when others =>
null;
end case;
end process;
end Behavioral;