aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue2216/pkg.vhdl
blob: 4dedf8bb4f6b61e14af3207b44e900bf5637b5a3 (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
package MemorySupportPkg is

  subtype MemoryBaseType is integer_vector ;
  type    MemBlockType   is array (integer range <>) of MemoryBaseType ;

  function InitMemoryBaseType_X(BlockWidth, BaseWidth : integer) return MemBlockType ;

end MemorySupportPkg ;

package body MemorySupportPkg is


-- Works
--  ------------------------------------------------------------
--  function InitMemoryBaseType_X(BlockWidth, BaseWidth : integer) return MemBlockType is
--  ------------------------------------------------------------
--    constant BaseU       : MemoryBaseType(0 to BaseWidth-1)  := (others => -1) ;
--  begin
--    return MemBlockType'(0 to 2**BlockWidth-1 => BaseU) ;
--  end function InitMemoryBaseType_X ;

-- Fails
  ------------------------------------------------------------
  function InitMemoryBaseType_X(BlockWidth, BaseWidth : integer) return MemBlockType is
  ------------------------------------------------------------
    constant BaseU       : MemoryBaseType  := (0 to BaseWidth-1 => -1) ;
  begin
    return MemBlockType'(0 to 2**BlockWidth-1 => BaseU) ;
  end function InitMemoryBaseType_X ;

-- Fails
--   ------------------------------------------------------------
--   function InitMemoryBaseType_X(BlockWidth, BaseWidth : integer) return MemBlockType is
--   ------------------------------------------------------------
--     constant BaseU       : MemoryBaseType(0 to BaseWidth-1)   := (others => -1) ;
--     constant BlockWidthU : MemBlockType(0 to 2**BlockWidth-1) := (others => BaseU) ;
-- --  --!! Also Fails    constant BlockWidthU : MemBlockType    := (0 to 2**BlockWidth-1 => BaseU) ;
--   begin
--     return BlockWidthU ;
--   end function InitMemoryBaseType_X ;
end MemorySupportPkg ;