aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/bug20549/tb.vhdl
blob: aa5e8e617df7c0ea74155656267cd7cdb52459a2 (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
-- This testbench fails with GHDL 0.29 and with GHDL svn_2013-02-13.

library ieee;
use ieee.std_logic_1164.all;

entity clkgen is

    -- NOTE: Removing the default value makes the testbench work as expected.
    port ( b: out std_ulogic := '0' );

end entity;

architecture arch of clkgen is
    signal a: std_ulogic;
begin
    a <= '0', '1' after 10 ns, '0' after 20 ns;
    b <= a;
end architecture;


library ieee;
use ieee.std_logic_1164.all;

entity tb is
end entity;

architecture arch of tb is

    -- NOTE: Declaring C as std_ulogic makes the testbench work as expected.
    signal c: std_logic;

begin

    u0: entity work.clkgen port map ( b => c );

    process
    begin

        wait for 1 ns;

        if c = '0' then
            report "good: C is '0' as expected";
        else
            -- This fails with GHDL 0.29.
            report "BAD: C is not '0'" severity failure;
        end if;

        wait until c = '1' for 50 ns;
        -- This is ok with GHDL 0.29.
        assert c = '1' severity failure;

        wait until c = '0' for 50 ns;

        if c = '0' then
            report "good: C is '0' as expected";
        else
            -- This fails with GHDL 0.29.
            report "BAD: C is not '0'" severity failure;
        end if;

        wait;
    end process;

end architecture;