aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-08-26 19:45:34 +0200
committerTristan Gingold <tgingold@free.fr>2020-08-26 22:39:05 +0200
commite255df9d0b20261a44ba0103e8e78e9b095fe300 (patch)
tree40b32ce785c021c13def175870ed74706c82f72d /testsuite
parent89578f1793a01fbeb701cbe13fc5f586e08400d2 (diff)
downloadghdl-e255df9d0b20261a44ba0103e8e78e9b095fe300.tar.gz
ghdl-e255df9d0b20261a44ba0103e8e78e9b095fe300.tar.bz2
ghdl-e255df9d0b20261a44ba0103e8e78e9b095fe300.zip
testsuite/synth: add a test for #1442
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/synth/issue1442/fixed_round_crash_correct.vhdl19
-rw-r--r--testsuite/synth/issue1442/fixed_round_crash_incorrect.vhdl19
-rwxr-xr-xtestsuite/synth/issue1442/testsuite.sh10
3 files changed, 48 insertions, 0 deletions
diff --git a/testsuite/synth/issue1442/fixed_round_crash_correct.vhdl b/testsuite/synth/issue1442/fixed_round_crash_correct.vhdl
new file mode 100644
index 000000000..a15177bce
--- /dev/null
+++ b/testsuite/synth/issue1442/fixed_round_crash_correct.vhdl
@@ -0,0 +1,19 @@
+library IEEE;
+use IEEE.STD_LOGIC_1164.ALL;
+use IEEE.NUMERIC_STD.ALL;
+use IEEE.FIXED_PKG.ALL;
+
+entity fixed_round_crash_correct is
+ Port (
+ input_fixed: in SFIXED(3 downto -2);
+ output_signed: out SIGNED(7 downto 0)
+ );
+end entity;
+
+architecture Behavioral of fixed_round_crash_correct is
+ -- real * sfixed(a downto b) -> sfixed(2a+1 downto 2b)
+ signal intermediate: SFIXED(7 downto -4);
+begin
+ intermediate <= 1.5*input_fixed;
+ output_signed <= to_signed(input_fixed, 8);
+end Behavioral;
diff --git a/testsuite/synth/issue1442/fixed_round_crash_incorrect.vhdl b/testsuite/synth/issue1442/fixed_round_crash_incorrect.vhdl
new file mode 100644
index 000000000..f8856b014
--- /dev/null
+++ b/testsuite/synth/issue1442/fixed_round_crash_incorrect.vhdl
@@ -0,0 +1,19 @@
+library IEEE;
+use IEEE.STD_LOGIC_1164.ALL;
+use IEEE.NUMERIC_STD.ALL;
+use IEEE.FIXED_PKG.ALL;
+
+entity fixed_round_crash_incorrect is
+ Port (
+ input_fixed: in SFIXED(3 downto -2);
+ output_signed: out SIGNED(3 downto 0)
+ );
+end entity;
+
+architecture Behavioral of fixed_round_crash_incorrect is
+ -- real * sfixed(a downto b) -> sfixed(2a+1 downto 2b)
+ signal intermediate: SFIXED(3 downto -2);
+begin
+ intermediate <= 1.5*input_fixed;
+ output_signed <= to_signed(input_fixed, 4);
+end Behavioral;
diff --git a/testsuite/synth/issue1442/testsuite.sh b/testsuite/synth/issue1442/testsuite.sh
new file mode 100755
index 000000000..d2718954f
--- /dev/null
+++ b/testsuite/synth/issue1442/testsuite.sh
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+synth_analyze fixed_round_crash_correct
+synth_failure fixed_round_crash_incorrect
+clean
+
+echo "Test successful"