-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmemory_test.vhd
70 lines (49 loc) · 1.29 KB
/
memory_test.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
library ieee;
USE ieee.numeric_std.all;
USE ieee.std_logic_1164.all;
ENTITY test_bench IS
END test_bench;
ARCHITECTURE behavior OF test_bench IS
--- Components ---
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;
--- Signals ---
signal addr : unsigned(8 downto 0) := (others => '0');
signal addr_next : unsigned(8 downto 0) := (others => '0');
signal clk : std_logic := '0';
signal data_out : unsigned(13 downto 0);
signal CS : std_logic := '1';
signal OE : std_logic := '1'; -- Try having this at 0 zero as well.
constant clk_period : time := 1000 ns;
BEGIN
--- Connnect components ---
DUT: rom_wrapper PORT MAP (
addr => addr,
data_out => data_out,
CK => clk,
CS => CS,
OE => OE
);
seq: process
begin
clk <= '0';
OE <= '1';
wait for clk_period/2;
clk <= '1';
addr <= addr_next;
OE <= '1';
wait for clk_period/2;
end process;
address: process
begin
wait for clk_period;
addr_next <= addr + 1;
end process;
END ARCHITECTURE;