summaryrefslogtreecommitdiff
path: root/testsuite/gna/ticket94/tb.vhd
blob: 313d59c8dbaf61bba0c16f2ddd4f48aea306492d (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

library ieee;
use ieee.std_logic_1164.all;
library alib;
use alib.acomp;

entity tb is

end; 

architecture arch of tb is

    signal clk:  std_logic := '0';
    signal lclk: std_ulogic;

    signal stop: boolean := false;
    signal lclk_count: integer := 0;

    component acomp is
        port (x: in std_ulogic; y: out std_ulogic);
    end component;

begin

    clk <= not clk after 10 ns when (not stop) else '0';

    ainst: acomp
        port map (clk, lclk);

    process (lclk) is
    begin
        if rising_edge(lclk) then
            lclk_count <= lclk_count + 1;
        end if;
    end process;

    process is
    begin
        report "start test";
        wait for 1 ms;
        report "end test";
        report "lclk_count = " & integer'image(lclk_count);
        assert lclk_count > 20000 report "test failed";
        if lclk_count > 20000 then report "test passed"; end if;
        stop <= true;
        wait;
  end process;

end architecture;