aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue2049/engine.vhdl
blob: 2f016d90c9f820d8b30966db9e7b37200d4185ff (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity phony is
	port (
		i : in  std_logic;
		o : out std_logic
	);
end entity;

architecture synth of phony is

	constant BLOCKS : natural := 5000;
	constant BITS   : natural := 5;

	-- Unused but necessary to reproduce the crash : passing a vector is necessary
	function func1(A : std_logic_vector) return natural is
	begin
		return 1;
	end function;

	function func2(b : boolean) return natural is
	begin
		return func1(std_logic_vector(to_unsigned(0, BITS)));
	end function;

	-- Unused but necessary to reproduce the crash
	constant x : natural := func2(true);

	component LUT is
		port (
			O  : out std_logic;
			I0 : in  std_logic
		);
	end component;

begin

	gen : for b in 0 to BLOCKS-1 generate

		-- Both of these, lut and process, can reproduce the crash

		l : LUT
			port map (
				O  => open,
				I0 => '0'
			);

		p : process(all)
			variable v : natural;
		begin
			v := BITS;
		end process;

	end generate;

	o <= i;

end architecture;


library ieee;
use ieee.std_logic_1164.all;

library work;
use work.all;

entity engine is
	generic (
		SIZE : natural := 10
	);
	port (
		i : in std_logic;
		o : out std_logic
	);
end entity;

architecture synth of engine is

begin

	gen : for c in 0 to SIZE-1 generate

		ph : entity phony
			port map (
				i => '0',
				o => open
			);

	end generate;

	o <= i;

end architecture;