blob: 4a109d14bd65b841278e6290c42da165734fffb0 (
plain)
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
|
entity tb_ram4 is
end tb_ram4;
library ieee;
use ieee.std_logic_1164.all;
architecture behav of tb_ram4 is
signal rdat : std_logic_vector(1 downto 0);
signal raddr : std_logic_vector(1 downto 0);
signal init : std_logic_vector(7 downto 0);
signal rst : std_logic;
signal clk : std_logic;
begin
dut: entity work.ram4
port map (raddr => raddr, rdat => rdat, rst => rst, init => init,
clk => clk);
process
procedure pulse is
begin
clk <= '0';
wait for 1 ns;
clk <= '1';
wait for 1 ns;
end pulse;
begin
rst <= '1';
init <= b"01_11_00_10";
pulse;
rst <= '0';
init <= b"00_00_00_00";
raddr <= "00";
pulse;
assert rdat = "10" severity failure;
raddr <= "11";
pulse;
assert rdat = "01" severity failure;
raddr <= "01";
pulse;
assert rdat = "00" severity failure;
raddr <= "10";
pulse;
assert rdat = "11" severity failure;
wait;
end process;
end behav;
|