aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1090/tb_simple_ram.vhdl
blob: e5f515c21617bffc0c3c855c0df9d819a51aa8ce (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
entity tb_simple_ram is
end tb_simple_ram;

library ieee;
use ieee.std_logic_1164.all;

architecture behav of tb_simple_ram is
  signal raddr : std_logic_vector(5 downto 0);
  signal rdat : std_logic_vector(31 downto 0);
  signal en : std_logic;
  signal waddr : std_logic_vector(5 downto 0);
  signal wdat : std_logic_vector(31 downto 0);
  signal we : std_logic_vector (3 downto 0);
  signal clk : std_logic;
begin
  dut: entity work.simple_ram
    port map (clk => clk,
              en => en, raddr => raddr, dout => rdat,
              we => we, waddr => waddr, din => wdat);

  process
    procedure pulse is
    begin
      clk <= '0';
      wait for 1 ns;
      clk <= '1';
      wait for 1 ns;
    end pulse;
  begin
    en <= '1';
    raddr <= "000000";
    we <= "0000";
    waddr <= "000001";
    wdat <= x"00_00_00_01";
    pulse;
    assert rdat = x"0000_0110" severity failure;

    raddr <= "000001";
    waddr <= "000010";
    wdat <= x"00_00_00_02";
    pulse;
    assert rdat = x"0000_1ffc" severity failure;

    wait;
  end process;
end behav;