-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.vhdl
More file actions
65 lines (52 loc) · 1.39 KB
/
Copy pathmain.vhdl
File metadata and controls
65 lines (52 loc) · 1.39 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
54
55
56
57
58
59
60
61
62
63
64
65
library ieee;
use ieee.std_logic_1164.all;
library work;
package attrs is
constant ADDR_BITS : integer := 5;
constant WORD_BITS : integer := 4;
type display_t is array(3 downto 0) of std_logic_vector(0 to 6);
end package;
library ieee;
use ieee.std_logic_1164.all;
library work;
use work.attrs.all;
entity main is
port (
clk, write : in std_logic;
addr : in std_logic_vector(ADDR_BITS - 1 downto 0);
data : in std_logic_vector(WORD_BITS - 1 downto 0);
hex : out display_t
);
end entity;
architecture structural of main is
signal q : std_logic_vector(WORD_BITS - 1 downto 0);
begin
ram : entity work.ram
generic map (
ADDR_BITS => ADDR_BITS,
WORD_BITS => WORD_BITS
)
port map (
clk => clk,
write => write,
addr => addr,
data => data,
q => q
);
display_q : entity work.hex(behavioral) port map (
x => q,
h => hex(0)
);
display_data_in : entity work.hex(behavioral) port map (
x => data,
h => hex(1)
);
display_addr_lower : entity work.hex(behavioral) port map (
x => addr(3 downto 0),
h => hex(2)
);
display_addr_upper : entity work.hex(behavioral) port map (
x => "000" & addr(4),
h => hex(3)
);
end architecture;