aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue412/tb_my_fifo.vhdl
blob: 8f3def0dee9a8a9a1de8d38a8fda26732397d7a1 (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
58
59
60
61
62
63
64
65
66
library ieee;
use ieee.std_logic_1164.all;

entity tb_my_FIFO is
end;

architecture behav of tb_my_fifo is
  signal clk       : std_ulogic;
  signal rst       : std_ulogic;
  signal data_in   : std_logic_vector(7 downto 0);
  signal valid_in  : std_ulogic;
  signal ready_out : std_ulogic;
  signal data_out  : std_logic_vector(7 downto 0);
  signal valid_out : std_ulogic;
  signal ready_in  : std_ulogic;
begin
  inst_my_FIFO: entity work.my_FIFO
    port map (
      clk       => clk,
      rst       => rst,
      data_in   => data_in,
      valid_in  => valid_in,
      ready_out => ready_out,
      data_out  => data_out,
      valid_out => valid_out,
      ready_in  => ready_in);

  process
    procedure pulse is
    begin
      clk <= '0';
      wait for 5 ns;
      clk <= '1';
      wait for 5 ns;
    end pulse;
  begin
    rst <= '1';
    valid_in <= '0';
    ready_in <= '0';
    pulse;

    rst <= '0';
    pulse;

    assert valid_out = '0' severity failure;
    assert ready_out = '1' severity failure;

    data_in <= x"d5";
    valid_in <= '1';
    pulse;

    valid_in <= '0';

    --  Need a second cycle to see the data on the outputs.
    pulse;
    assert valid_out = '1' severity failure;
    assert data_out = x"d5" severity failure;

    ready_in <= '1';
    pulse;
    assert valid_out = '0' severity failure;

    ready_in <= '0';
    wait;
  end process;
end behav;