-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemory_tb.vhd
64 lines (53 loc) · 1.33 KB
/
memory_tb.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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;
entity memory_tb is
end memory_tb;
architecture test of memory_tb is
signal clk : std_logic := '0';
signal reset : std_logic;
signal memWrite : std_logic;
signal memRead : std_logic;
signal address : std_logic_vector(7 downto 0);
signal B : std_logic_vector(31 downto 0);
signal memData : std_logic_vector(31 downto 0);
begin
dut : entity work.memory(behave)
port map
(
clk=>clk, reset=>reset, memWrite=>memWrite,
memRead=>memRead, address=>address, B=>B,
memData=>memData
);
process(clk) begin
clk <= not clk after 1 ns;
end process;
process begin
memRead <= '1';
address <= x"80";
memWrite <= '0';
reset <= '0';
B <= x"00000000";
wait for 5 ns;
reset <= '1';
wait for 5 ns;
reset <= '0';
wait for 5 ns;
memRead <= '0';
address <= x"00";
memWrite <= '1';
B <= x"FFFFFFFF";
wait for 5 ns;
memRead <= '1';
memWrite <= '0';
wait for 5 ns;
memRead <= '0';
address <= x"48"; -- 72
memWrite <= '1';
B <= x"0000FFFF";
wait for 5 ns;
memRead <= '1';
memWrite <= '0';
wait;
end process;
end test;