aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/mem02/tb_dpram5.vhdl
blob: c12125831ad08f185ba6377a5c166d5f52f723ec (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_dpram5 is
end;

library ieee;
use ieee.std_logic_1164.all;

architecture behav of tb_dpram5 is
  signal raddr : std_logic_vector(3 downto 0);
  signal rdat : std_logic_vector(7 downto 0);
  signal waddr : std_logic_vector(3 downto 0);
  signal wdat : std_logic_vector(7 downto 0);
  signal rclk, wclk : std_logic;
begin
  dut: entity work.dpram5
    port map (raddr => raddr, rdat => rdat, waddr => waddr, wdat => wdat,
              rclk => rclk, wclk => wclk);

  process
    procedure rpulse is
    begin
      rclk <= '0';
      wait for 1 ns;
      rclk <= '1';
      wait for 1 ns;
    end rpulse;

    procedure wpulse is
    begin
      wclk <= '0';
      wait for 1 ns;
      wclk <= '1';
      wait for 1 ns;
    end wpulse;
  begin
    raddr <= "0000";
    waddr <= "0001";
    wdat <= x"01";
    wpulse;

    raddr <= "0001";
    rpulse;
    assert rdat = x"01" severity failure;

    waddr <= "0010";
    wdat <= x"02";
    wpulse;
    assert rdat = x"01" severity failure;

    wait;
  end process;
end behav;