File: resolved2.vhdl

package info (click to toggle)
fauhdlc 20180504-3.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,064 kB
  • sloc: cpp: 23,188; ansic: 6,077; yacc: 3,764; lex: 763; makefile: 605; python: 412; xml: 403; sh: 61
file content (75 lines) | stat: -rw-r--r-- 1,818 bytes parent folder | download | duplicates (7)
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
-- $Id$

-- test resolution functions
-- actually this test doesn't document a parser bug, but rather a 
-- bug with evaluating resolution functions (which results from a 
-- not strictly lrm conforming design decision).

-- Copyright (C) 2009 FAUmachine Team <info@faumachine.org>.
-- This program is free software. You can redistribute it and/or modify it
-- under the terms of the GNU General Public License, either version 2 of
-- the License, or (at your option) any later version. See COPYING.

package t is
	type iv is array(integer range <>) of integer;
	function resolve_integer_vl(v : iv) return integer;
	subtype integer_vl is resolve_integer_vl integer;
end package t;

package body t is
	function resolve_integer_vl(v : iv) return integer is
	begin
		return v'length;
	end;
end;

use t.integer_vl;
entity d is
	port (
		o : out integer_vl;
		i1 : in integer;
		i2 : in integer
	);
end entity d;

architecture d_impl of d is
begin
	update_output : process(i1, i2)
	begin
		o <= i1 + i2 after 10 ms;
	end process;
end;

entity test_bench is
end entity test_bench;

use t.integer_vl;
architecture test_bench_impl of test_bench is
	signal r : integer_vl;
	signal i1 : integer;
	signal i2 : integer;
	signal i3 : integer;
	signal i4 : integer;
begin
	d1 : d port map(o => r, i1 => i1, i2 => i2);
	d2 : d port map(o => r, i1 => i3, i2 => i4);

	p : process
	begin
		i1 <= 1;
		i2 <= 2;
		i3 <= 3;
		i4 <= 4;

		wait for 12 ms;
		-- lrm 2003: there are 2 drivers for the final resolution
		-- hence the result must be 2.
		-- fauhdlc doesn't adhere to this. There every
		-- driver gets connected to the final signal (recursively).
		-- hence fauhdli's result will be 4.
		assert r = 2 report "r must be 2" severity failure;

		assert false report "simulation finished" severity note;
		wait;
	end process;
end;