summaryrefslogtreecommitdiff
path: root/testsuite/gna/bug20312/repro.vhdl
blob: 8a606ee3d4903a64aa41d16267abeb7263f35b6b (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
67
68
69
70
71
72
73
entity pipeline is
  generic (width : natural; depth : natural);
  port (i : bit_vector (1 to width);
        o : out bit_vector (1 to width);  
        clk : bit);
end pipeline;

architecture behav of pipeline is
  type pipe is array (1 to depth) of bit_vector (1 to width);
begin
  process (clk) is
    variable tmp : pipe;
  begin
    if clk = '1' then
      o <= tmp (1);
      tmp (1 to depth - 1) := tmp (2 to depth);
      tmp (depth) := i;
    end if;
  end process;
end behav;

entity tb is
end tb;

architecture behav of tb is
  constant width : natural := 4;
  signal i : bit_vector (1 to width);
  signal o : bit_vector (1 to width);
  signal clk : bit;
begin
  p : entity work.pipeline
    generic map (width => width, depth => 3)
    port map (i => i, o => o, clk => clk);
  process is
  begin
    i <= "1011";
    
    clk <= '0';
    wait for 0 ns;
    clk <= '1';
    wait for 0 ns;

    i <= "1010";
    
    clk <= '0';
    wait for 0 ns;
    clk <= '1';
    wait for 0 ns;

    i <= "1001";
    
    clk <= '0';
    wait for 0 ns;
    clk <= '1';
    wait for 0 ns;

    i <= "1000";
    
    clk <= '0';
    wait for 0 ns;
    clk <= '1';
    wait for 0 ns;

    i <= "1011";
    
    clk <= '0';
    wait for 0 ns;
    clk <= '1';
    wait for 0 ns;

    wait;
  end process;
end behav;