File: functions.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 (42 lines) | stat: -rw-r--r-- 1,218 bytes parent folder | download | duplicates (3)
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
-- $Id$ 

-- test for some different arrays

-- Copyright (C) 2007-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.


entity nullentity is
end entity nullentity;

architecture implementation of nullentity is
	type R1 is record
             I: integer;
        end record;

	type unconarraytype is array(integer range <>) of r1;
	type integer_array is array(1 to 10) of integer;

	function bar(x : integer; y : integer) return integer;
	function bar(x : unconarraytype(5 to 16)) return R1;
	function bar(x : unconarraytype(5 to 16)) return integer_array;
	function f return r1;
	function f(x : R1) return R1;
	function bar(f : integer range 4 to 18) return R1;
begin	
	p : process 
		variable v1, v2, v3 : integer;
	begin
		v1 := bar(4);
		v2 := bar(4).i;
		v3 := bar(x => 4);
		v1 := bar(y => 4, x => 5);
		v2 := bar(x => bar(4));
		v3 := bar(v1, y => bar(bar(4))(5)); -- valid!
		v1 := f.i; -- call f and do selection to i. 
		v1 := f(x.i => v2);
		v2 := f(x.i => v2).i;
	end process;
end implementation;