From e255df9d0b20261a44ba0103e8e78e9b095fe300 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 26 Aug 2020 19:45:34 +0200 Subject: testsuite/synth: add a test for #1442 --- .../synth/issue1442/fixed_round_crash_correct.vhdl | 19 +++++++++++++++++++ .../synth/issue1442/fixed_round_crash_incorrect.vhdl | 19 +++++++++++++++++++ testsuite/synth/issue1442/testsuite.sh | 10 ++++++++++ 3 files changed, 48 insertions(+) create mode 100644 testsuite/synth/issue1442/fixed_round_crash_correct.vhdl create mode 100644 testsuite/synth/issue1442/fixed_round_crash_incorrect.vhdl create mode 100755 testsuite/synth/issue1442/testsuite.sh (limited to 'testsuite/synth/issue1442') 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" -- cgit v1.2.3