aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue18/fum.vhdl
blob: 54ce8c1394012142fc2e67e9ac1cc3c956adff60 (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
package fum is 
    type fie is protected 
        impure function foo return integer;
        impure function foo(input: real) return integer; -- 4
        impure function foo return integer_vector;
        impure function foo (input: real) return integer_vector; -- 6
        impure function foo (input: integer) return integer;
        impure function foo(input: integer) return integer_vector;

    end protected fie;
end package;

package body fum is
    type fie is protected body
        variable answer:    integer := 42;

        impure function foo return integer is
        begin
            return answer;
        end;

        impure function foo(input:real) return integer is
        begin
            return integer(input) + answer;
        end;

        impure function foo return integer_vector is 
            variable conv_vector: integer_vector (0 to 1);
        begin
            conv_vector(0) := answer;
            conv_vector(1) := 0;
            return conv_vector;
        end; 

        impure function foo (input: real) return integer_vector is
            variable conv_vector: integer_vector (0 to 1);
        begin
            conv_vector(0) := integer(input) + answer;
            conv_vector(1) := 0;
        end;

        impure function foo (input: integer) return integer is
        begin
            return answer + input;
        end;

        impure function foo(input: integer) return integer_vector is 
            variable conv_vector: integer_vector (0 to 1);
        begin
            conv_vector(0) := input + answer;
            conv_vector(1) := 0;
            return conv_vector;
        end; 
    end protected body fie;
end package body;