From 285b0484c261a3b46f44d750b11019d3e7604ae4 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 11 Dec 2022 12:32:28 +0100 Subject: testsuite/gna: add tests for #2223 --- testsuite/gna/issue2223/repro6.vhdl | 22 ++++++++++++++++++++++ testsuite/gna/issue2223/repro7.vhdl | 24 ++++++++++++++++++++++++ testsuite/gna/issue2223/testsuite.sh | 14 ++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 testsuite/gna/issue2223/repro6.vhdl create mode 100644 testsuite/gna/issue2223/repro7.vhdl create mode 100755 testsuite/gna/issue2223/testsuite.sh (limited to 'testsuite/gna') diff --git a/testsuite/gna/issue2223/repro6.vhdl b/testsuite/gna/issue2223/repro6.vhdl new file mode 100644 index 000000000..3bccef565 --- /dev/null +++ b/testsuite/gna/issue2223/repro6.vhdl @@ -0,0 +1,22 @@ +entity MemPkgReproducer6 is +end; +architecture behav of MemPkgReproducer6 is + function InitMemoryBaseType(Size : integer) return integer_vector is + + begin + return (1 to Size => 0); + end InitMemoryBaseType; + subtype MemoryBaseType is integer_vector ; + type MemBlockType is array (integer range <>) of MemoryBaseType ; + type MemBlockPtrType is access MemBlockType ; +begin + process + variable MemArr : MemBlockPtrType; + variable BlockWidth, BaseWidth : natural; + begin + BlockWidth := 4; + BaseWidth := 32; + MemArr := new MemBlockType'( 0 to BlockWidth - 1 => InitMemoryBaseType(BaseWidth)); + wait; + end process; +end; diff --git a/testsuite/gna/issue2223/repro7.vhdl b/testsuite/gna/issue2223/repro7.vhdl new file mode 100644 index 000000000..23c42e53a --- /dev/null +++ b/testsuite/gna/issue2223/repro7.vhdl @@ -0,0 +1,24 @@ +entity MemPkgReproducer7 is +end; + +architecture behav of MemPkgReproducer7 is + function InitMemoryBaseType(Size : integer) return integer_vector is + + begin + return (1 to Size => 0); + end InitMemoryBaseType; + subtype MemoryBaseType is integer_vector ; + type MemBlockType is array (integer range <>) of MemoryBaseType ; + type MemBlockPtrType is access MemBlockType ; + constant INIT_MEM_BASE : integer_vector := InitMemoryBaseType(32) ; +begin + process + variable MemArr : MemBlockPtrType; + variable BlockWidth, BaseWidth : natural; + begin + BlockWidth := 4; + BaseWidth := 32; + MemArr := new MemBlockType'( 0 to BlockWidth - 1 => INIT_MEM_BASE); + wait; + end process; +end; diff --git a/testsuite/gna/issue2223/testsuite.sh b/testsuite/gna/issue2223/testsuite.sh new file mode 100755 index 000000000..87bbe00a3 --- /dev/null +++ b/testsuite/gna/issue2223/testsuite.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze repro6.vhdl +elab_simulate MemPkgReproducer6 + +analyze repro7.vhdl +elab_simulate MemPkgReproducer7 + +clean + +echo "Test successful" -- cgit v1.2.3