From c33f41e4612347d1fcbb9a37bc82249d7b8366eb Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 1 Apr 2021 20:39:25 +0200 Subject: testsuite/gna: add a testcase for #1704 --- testsuite/gna/issue1704/orig.vhdl | 5 +++++ testsuite/gna/issue1704/repro1.vhdl | 15 +++++++++++++++ testsuite/gna/issue1704/repro2.vhdl | 21 +++++++++++++++++++++ testsuite/gna/issue1704/repro3.vhdl | 24 ++++++++++++++++++++++++ testsuite/gna/issue1704/testsuite.sh | 17 +++++++++++++++++ 5 files changed, 82 insertions(+) create mode 100644 testsuite/gna/issue1704/orig.vhdl create mode 100644 testsuite/gna/issue1704/repro1.vhdl create mode 100644 testsuite/gna/issue1704/repro2.vhdl create mode 100644 testsuite/gna/issue1704/repro3.vhdl create mode 100755 testsuite/gna/issue1704/testsuite.sh (limited to 'testsuite/gna') diff --git a/testsuite/gna/issue1704/orig.vhdl b/testsuite/gna/issue1704/orig.vhdl new file mode 100644 index 000000000..9b89c5292 --- /dev/null +++ b/testsuite/gna/issue1704/orig.vhdl @@ -0,0 +1,5 @@ +subtype word is std_logic_vector(word_len - 1 downto 0); +function F return word is +begin + return ("1010","101010101010", others => '0'); +end function; diff --git a/testsuite/gna/issue1704/repro1.vhdl b/testsuite/gna/issue1704/repro1.vhdl new file mode 100644 index 000000000..bbd41f75a --- /dev/null +++ b/testsuite/gna/issue1704/repro1.vhdl @@ -0,0 +1,15 @@ +entity repro1 is +end; + +architecture behav of repro1 is + constant word_len : natural := 20; + + subtype word is bit_vector(word_len - 1 downto 0); + function F return word is + begin + return ("1010","101010101010", others => '0'); + end function; +begin + assert f = b"1010_101010101010_0000"; +end; + diff --git a/testsuite/gna/issue1704/repro2.vhdl b/testsuite/gna/issue1704/repro2.vhdl new file mode 100644 index 000000000..07ea0873b --- /dev/null +++ b/testsuite/gna/issue1704/repro2.vhdl @@ -0,0 +1,21 @@ +entity repro2 is + generic ( + word_len : natural := 20); +end; + +architecture behav of repro2 is + subtype word is bit_vector(word_len - 1 downto 0); + + function F return word is + begin + return ("1010","101010101010", others => '0'); + end function; +begin + assert f = b"1010_101010101010_0000" severity failure; + process + begin + report to_string(f); + wait; + end process; +end; + diff --git a/testsuite/gna/issue1704/repro3.vhdl b/testsuite/gna/issue1704/repro3.vhdl new file mode 100644 index 000000000..3a2052911 --- /dev/null +++ b/testsuite/gna/issue1704/repro3.vhdl @@ -0,0 +1,24 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity repro3 is + generic ( + word_len : natural := 20); +end; + +architecture behav of repro3 is + subtype word is std_logic_vector(word_len - 1 downto 0); + + function F return word is + begin + return ("1010","101010101010", others => '0'); + end function; +begin + assert f = b"1010_101010101010_0000" severity failure; + process + begin + report to_string(f); + wait; + end process; +end; + diff --git a/testsuite/gna/issue1704/testsuite.sh b/testsuite/gna/issue1704/testsuite.sh new file mode 100755 index 000000000..fd66f2e79 --- /dev/null +++ b/testsuite/gna/issue1704/testsuite.sh @@ -0,0 +1,17 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze repro1.vhdl +elab_simulate repro1 + +analyze repro2.vhdl +elab_simulate repro2 + +analyze repro3.vhdl +elab_simulate repro3 + +clean + +echo "Test successful" -- cgit v1.2.3