diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/gna/issue2216/ent.vhdl | 9 | ||||
-rw-r--r-- | testsuite/gna/issue2216/pkg.vhdl | 41 | ||||
-rwxr-xr-x | testsuite/gna/issue2216/testsuite.sh | 11 |
3 files changed, 61 insertions, 0 deletions
diff --git a/testsuite/gna/issue2216/ent.vhdl b/testsuite/gna/issue2216/ent.vhdl new file mode 100644 index 000000000..c551f5bdd --- /dev/null +++ b/testsuite/gna/issue2216/ent.vhdl @@ -0,0 +1,9 @@ +use work.MemorySupportPkg.all; + +entity ent is +end; + +architecture behav of ent is + constant c : MemBlockType := InitMemoryBaseType_X (3, 2); +begin +end; diff --git a/testsuite/gna/issue2216/pkg.vhdl b/testsuite/gna/issue2216/pkg.vhdl new file mode 100644 index 000000000..4dedf8bb4 --- /dev/null +++ b/testsuite/gna/issue2216/pkg.vhdl @@ -0,0 +1,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 ; diff --git a/testsuite/gna/issue2216/testsuite.sh b/testsuite/gna/issue2216/testsuite.sh new file mode 100755 index 000000000..331a801f8 --- /dev/null +++ b/testsuite/gna/issue2216/testsuite.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze pkg.vhdl ent.vhdl +elab_simulate ent + +clean + +echo "Test successful" |