-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsram_test.vhd
62 lines (60 loc) · 1.25 KB
/
sram_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
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
use work.eecs361.sram;
entity sram_test is
end sram_test;
architecture behavioral of sram_test is
signal cs : std_logic;
signal oe : std_logic;
signal we : std_logic;
signal addr : std_logic_vector(31 downto 0);
signal din : std_logic_vector(31 downto 0);
signal dout : std_logic_vector(31 downto 0);
begin
test_comp : sram
generic map (
mem_file => "data/bills_branch.dat"
)
port map (
cs => cs,
oe => oe,
we => we,
addr => addr,
din => din,
dout => dout
);
testbench : process
begin
cs <= '0';
wait for 5 ns;
-- read
cs <= '1';
oe <= '1';
we <= '0';
addr <= x"1000000c";
wait for 5 ns;
assert dout = x"000002bc" report "sram read error" severity error;
wait for 5 ns;
-- write
cs <= '0';
wait for 5 ns;
oe <= '0';
we <= '1';
addr <= x"1000001c";
din <= x"efefefef";
wait for 5 ns;
cs <= '1';
wait for 5 ns;
we <= '0';
cs <= '0';
wait for 5 ns;
cs <= '1';
oe <= '1';
wait for 5 ns;
assert dout = x"efefefef" report "sram write error" severity error;
wait for 5 ns;
wait;
end process;
end;