diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-04-14 16:47:27 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-04-14 16:47:27 +0200 |
commit | a40c12412c9e159ebe9276262f9257cc8cdaccbf (patch) | |
tree | 0a688b054763d84e2ddf26dfd7cddf25db2086be | |
parent | 74faba8044d401ebe3d4ce62c619ee295604ae2d (diff) | |
download | ghdl-a40c12412c9e159ebe9276262f9257cc8cdaccbf.tar.gz ghdl-a40c12412c9e159ebe9276262f9257cc8cdaccbf.tar.bz2 ghdl-a40c12412c9e159ebe9276262f9257cc8cdaccbf.zip |
testsuite/synth: add a test for #2408
-rw-r--r-- | testsuite/synth/issue2408/bug.vhdl | 39 | ||||
-rwxr-xr-x | testsuite/synth/issue2408/testsuite.sh | 8 |
2 files changed, 47 insertions, 0 deletions
diff --git a/testsuite/synth/issue2408/bug.vhdl b/testsuite/synth/issue2408/bug.vhdl new file mode 100644 index 000000000..179b30298 --- /dev/null +++ b/testsuite/synth/issue2408/bug.vhdl @@ -0,0 +1,39 @@ +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.std_logic_arith.all; + +entity bug is + generic( + LEN : positive := 32; + POS : natural := 10 + ); + port( + output : out signed(LEN-1 downto 0) + ); + + function GET_NUM_FUNC(n : natural) return integer is + variable result :integer; + begin + case n is + when 0 => result := 16#010020#; + when 1 => result := 16#020D30#; + when 2 => result := 16#00FC1#; + when 3 => result := 16#05010#; + when 4 => result := 16#02800#; + when 5 => result := 16#01400#; + when 6 => result := 16#002F#; + when 7 => result := 16#0508#; + when 8 => result := 16#0200#; + when 9 => result := 16#0100#; + when 10 => result := 16#0A0#; + when others => result := 16#0#; + end case; + return result; + end GET_NUM_FUNC; + +end bug; + +architecture behav of bug is +begin + output <= conv_signed(GET_NUM_FUNC(POS), LEN); +end architecture; diff --git a/testsuite/synth/issue2408/testsuite.sh b/testsuite/synth/issue2408/testsuite.sh new file mode 100755 index 000000000..7de7b802c --- /dev/null +++ b/testsuite/synth/issue2408/testsuite.sh @@ -0,0 +1,8 @@ +#! /bin/sh + +. ../../testenv.sh + +GHDL_STD_FLAGS=-fsynopsys +synth_only bug + +echo "Test successful" |