-
Notifications
You must be signed in to change notification settings - Fork 1
/
Top.vhd
109 lines (87 loc) · 2.38 KB
/
Top.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
107
108
109
library ieee;
USE ieee.numeric_std.all;
USE ieee.std_logic_1164.all;
ENTITY Top is
port( start : in std_logic;
clk : in std_logic;
reset : in std_logic;
input0 : in std_logic_vector(7 downto 0);
finish : out std_logic
);
END ENTITY;
ARCHITECTURE behavior OF Top IS
COMPONENT HA
port (
start : in std_logic;
clk : in std_logic;
reset : in std_logic;
data_rom : in unsigned (13 downto 0);
address_rom: out unsigned(8 downto 0);
input0: in std_logic_vector(7 downto 0);
web : out std_logic;
data_ram : out std_logic_vector(31 downto 0);
address : out unsigned(6 downto 0); -- 0 to 15 adress
finish : out std_logic
);
END COMPONENT;
COMPONENT rom_wrapper
port (
addr : in unsigned(8 downto 0);
data_out : out unsigned(13 downto 0);
CK : IN std_logic; -- clk
CS : IN std_logic; -- chip select. set as 1
OE : IN std_logic -- Output enable.
);
END COMPONENT;
COMPONENT ram_wrapper
port (
addr : in unsigned(6 downto 0);
data_out : out std_logic_vector(31 downto 0);
data_in : in std_logic_vector(31 downto 0);
CK : in std_logic;
CS : in std_logic;
WEB : in std_logic;
OE : in std_logic
);
END COMPONENT;
--- Signals TOP---
signal data_rom : unsigned(13 downto 0);
signal address_rom : unsigned (8 downto 0);
signal web : std_logic;
signal data_ram : std_logic_vector(31 downto 0);
signal address_ram : unsigned(6 downto 0);
signal data_out : std_logic_vector(31 downto 0);
--- Signals ---
signal HIGH : std_logic;
BEGIN
HIGH <= '1';
--- Connnect components ---
DUT: HA PORT MAP (
start => start,
clk => clk,
reset => reset,
data_rom => data_rom,
address_rom => address_rom,
input0 => input0,
web => web,
data_ram => data_ram,
address => address_ram,
finish => finish
);
DUT2: rom_wrapper PORT MAP (
addr => address_rom,
data_out => data_rom,
CK => clk,
CS => HIGH,
OE => HIGH
);
DUT3: ram_wrapper PORT MAP (
addr => address_ram,
data_out => data_out,
data_in => data_ram,
CK => clk,
CS =>HIGH,
WEB => web,
OE =>HIGH
);
END ARCHITECTURE; ---