aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/synth36/tb_bram.vhdl
blob: c2e6d93a7c4b9bff859b62f2bcb8fb73e136a2f5 (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
52
53
54
55
56
57
entity tb_bram is
end tb_bram;

library ieee;
use ieee.std_logic_1164.all;

architecture behav of tb_bram is
  signal clk, we : std_logic;
  signal addr : std_logic_vector (8 downto 0);
  signal dout : std_logic_vector (7 downto 0);
  signal din : std_logic_vector (7 downto 0);
begin
  dut: entity work.bram
    port map (clk => clk, we => we, addr => addr,
              data_in => din, data_out => dout);

  process
    procedure pulse is
    begin
      clk <= '0';
      wait for 1 ns;
      clk <= '1';
      wait for 1 ns;
    end pulse;
  begin
    we <= '1';
    addr <= "000000001";
    din <= x"f1";
    pulse;

    we <= '0';
    pulse;
    assert dout = x"f1" severity failure;

    we <= '1';
    addr <= "000000011";
    din <= x"f3";
    pulse;

    we <= '1';
    addr <= "111111111";
    din <= x"ff";
    pulse;

    we <= '0';
    addr <= "000000011";
    pulse;
    assert dout = x"f3" severity failure;

    we <= '0';
    addr <= "111111111";
    pulse;
    assert dout = x"ff" severity failure;

    wait;
  end process;
end behav;