aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/bug0129/repro2.vhdl
blob: 7f3f5a5e60a0b674f2f5411ace18bd48a1a8e0ce (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
library IEEE;
use IEEE.std_logic_1164.all;

entity repro2 is
end;

architecture RTL of repro2 is

  signal tready   : std_logic;
  signal cnt      : natural;
  signal cnt_next : natural;
begin

  p_main: process (all)

    procedure count (
      constant r_ctr : in  natural;
      variable v_ctr : out natural
    ) is
    begin
      if tready = '1' then
        v_ctr := r_ctr + 1;
      else
        v_ctr := r_ctr;
      end if;
    end procedure;

    variable v : natural;

  begin
    report "execution of process p_main, cnt=" & natural'image(cnt);
    count (cnt, v);

    cnt_next <= v;
  end process p_main;

  process
  begin
    tready <= '1';
    cnt <= 1;
    wait for 1 ns;
    assert cnt_next = 2 severity failure;
    cnt <= 2;
    wait for 1 ns;
    assert cnt_next = 3 severity failure;
    tready <= '0';
    wait for 1 ns;
    assert cnt_next = 2 severity failure;
    wait;
  end process;
end;