-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisplay7Seg_4ON.vhd
106 lines (92 loc) · 2.44 KB
/
Display7Seg_4ON.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
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
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 10:27:03 11/22/2017
-- Design Name:
-- Module Name: Display7Seg_4ON - Structural
-- 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 Display7Seg_4ON is
Port ( Disp1 : in STD_LOGIC_VECTOR (3 downto 0);
Disp2 : in STD_LOGIC_VECTOR (3 downto 0);
Disp3 : in STD_LOGIC_VECTOR (3 downto 0);
Disp4 : in STD_LOGIC_VECTOR (3 downto 0);
Clk : in STD_LOGIC;
Reset : in STD_LOGIC;
Anode : out STD_LOGIC_VECTOR (3 downto 0);
Cathode : out STD_LOGIC_VECTOR (6 downto 0));
end Display7Seg_4ON;
architecture Structural of Display7Seg_4ON is
COMPONENT CLK_1KHz
PORT(
Clk : IN std_logic;
Reset : IN std_logic;
Out_1KHz : OUT std_logic
);
END COMPONENT;
COMPONENT Counter_Nbits
GENERIC (nBits : integer);
PORT(
Clk : IN std_logic;
Reset : IN std_logic;
Enable : IN std_logic;
Q : OUT std_logic_vector(nBits-1 downto 0)
);
END COMPONENT;
COMPONENT Disp7Seg
PORT(
Hex : IN std_logic_vector(3 downto 0);
Select_Disp : IN std_logic_vector(1 downto 0);
Seg : OUT std_logic_vector(6 downto 0);
Anode : OUT std_logic_vector(3 downto 0)
);
END COMPONENT;
signal sig_enable : STD_LOGIC;
signal sig_counter : STD_LOGIC_VECTOR(1 downto 0);
signal sig_data : STD_LOGIC_VECTOR(3 downto 0);
begin
Inst_CLK_1KHz: CLK_1KHz PORT MAP(
Clk => Clk,
Reset => Reset,
Out_1KHz => sig_enable
);
Inst_Counter_Nbits: Counter_Nbits
generic map (nBits => 2)
PORT MAP(
Clk => Clk,
Reset => Reset,
Enable => sig_enable,
Q => sig_counter
);
Inst_Disp7Seg: Disp7Seg PORT MAP(
Hex => sig_data,
Select_Disp => sig_counter,
Seg => Cathode,
Anode => Anode
);
with (sig_counter) select
sig_data <= Disp1 when "00",
Disp2 when "01",
Disp3 when "10",
Disp4 when others;
end Structural;