1entity alias3 is
2end entity;
3
4architecture test of alias3 is
5    type int_array is array (integer range <>) of integer;
6
7    function cut(x : int_array; low, high: integer) return int_array is
8        alias a : int_array(1 to x'length) is x;
9    begin
10        return a(low to high);
11    end function;
12
13    signal s : int_array(1 to 5) := (1, 2, 3, 4, 5);
14begin
15
16    process is
17        variable x : int_array(1 to 5) := (1, 2, 3, 4, 5);
18        variable y : int_array(4 downto 0) := (4, 3, 2, 1, 0);
19        alias sa : int_array(4 downto 0) is x;
20    begin
21        assert x(2 to 4) = (2, 3, 4);
22        assert sa(3 downto 1) = (2, 3, 4);
23        assert cut(x, 2, 3) = (2, 3);
24        assert cut(y, 1, 2) = (4, 3);
25        wait;
26    end process;
27
28end architecture;
29