aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1407
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-07-26 19:44:21 +0200
committerTristan Gingold <tgingold@free.fr>2020-07-26 21:26:22 +0200
commit6fd2cf670f6ad5e589aac06088cf933ad5742737 (patch)
treee49286778d6d3a1506cdf40d825559e3f9917852 /testsuite/synth/issue1407
parent7842784e034aa5b8ad7cb4fa6b1fe3eb82ec9f8c (diff)
downloadghdl-6fd2cf670f6ad5e589aac06088cf933ad5742737.tar.gz
ghdl-6fd2cf670f6ad5e589aac06088cf933ad5742737.tar.bz2
ghdl-6fd2cf670f6ad5e589aac06088cf933ad5742737.zip
testsuite/synth: add tests for #1407
Diffstat (limited to 'testsuite/synth/issue1407')
-rw-r--r--testsuite/synth/issue1407/fixed_point_example.vhdl19
-rw-r--r--testsuite/synth/issue1407/repro.vhdl27
-rwxr-xr-xtestsuite/synth/issue1407/testsuite.sh10
3 files changed, 56 insertions, 0 deletions
diff --git a/testsuite/synth/issue1407/fixed_point_example.vhdl b/testsuite/synth/issue1407/fixed_point_example.vhdl
new file mode 100644
index 000000000..9ffb07821
--- /dev/null
+++ b/testsuite/synth/issue1407/fixed_point_example.vhdl
@@ -0,0 +1,19 @@
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.fixed_pkg.all;
+ use ieee.fixed_float_types.all;
+
+entity fixed_point_example is
+ port (
+ data_in : in std_logic_vector(7 downto 0)
+ );
+end fixed_point_example;
+
+architecture behavioral of fixed_point_example is
+ signal data_tmp : sfixed(5 downto -4);
+begin
+ data_tmp <= resize(
+ to_sfixed(data_in, 3, -4),
+ data_tmp
+ );
+end behavioral;
diff --git a/testsuite/synth/issue1407/repro.vhdl b/testsuite/synth/issue1407/repro.vhdl
new file mode 100644
index 000000000..1d99bd0fc
--- /dev/null
+++ b/testsuite/synth/issue1407/repro.vhdl
@@ -0,0 +1,27 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity repro is
+ port (a : std_logic_vector (3 downto 0);
+ o : out std_logic_vector (3 downto 0));
+end;
+
+architecture behav of repro is
+ function cancel (a : std_logic_vector) return std_logic_vector
+ is
+ variable en : boolean := false;
+ variable res : std_logic_vector (a'range);
+ begin
+ if a'length = 0 then
+ en := true;
+ end if;
+ res := a;
+ if en then
+ res (7) := '0';
+ end if;
+ return res;
+ end cancel;
+begin
+ o <= cancel (a);
+end behav;
+
diff --git a/testsuite/synth/issue1407/testsuite.sh b/testsuite/synth/issue1407/testsuite.sh
new file mode 100755
index 000000000..58bb99337
--- /dev/null
+++ b/testsuite/synth/issue1407/testsuite.sh
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+GHDL_STD_FLAGS=--std=08
+synth_analyze repro
+synth_analyze fixed_point_example
+clean
+
+echo "Test successful"