aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue2112/abc.vhdl
blob: 137bacf81c468c5224248081b7677b520985be0d (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;

package abc is
    type Parameters_t is record
        BW    : natural;
        PAIRS : natural;
    end record;

    type Indices_t is array (natural range <>) of std_logic_vector;

    type Bus_t is record
        Indices : Indices_t;
    end record;

    function Test(
        abc_bus : Bus_t
    ) return Bus_t;

    function Test(
        abc_bus : Bus_t;
        indices : Indices_t
    ) return Bus_t;
end package;

package body abc is
    function Test(
        abc_bus : Bus_t;
        indices : Indices_t
    ) return Bus_t is
        variable result : Bus_t(
            Indices(abc_bus.Indices'range)(abc_bus.Indices'element'range)
        ) := Test(abc_bus);
    begin
        return result;
    end function;

    function Test(
        abc_bus : Bus_t
    ) return Bus_t is
        variable result : Bus_t(
            Indices(abc_bus.Indices'range)(abc_bus.Indices'element'range)
        ) := abc_bus;
    begin
        return result;
    end function;
end package body;