aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-04-24 18:45:34 +0200
committerTristan Gingold <tgingold@free.fr>2018-04-24 18:45:34 +0200
commit08b56bd39ce2cb2bf0641e8fb5eb58d6a1b25b8c (patch)
treea8984d77e8a403c02277f1541c17c3df4a8d9bd5 /testsuite
parent1d7382e75a52bd418f25b76dfb290081269b7b7f (diff)
downloadghdl-08b56bd39ce2cb2bf0641e8fb5eb58d6a1b25b8c.tar.gz
ghdl-08b56bd39ce2cb2bf0641e8fb5eb58d6a1b25b8c.tar.bz2
ghdl-08b56bd39ce2cb2bf0641e8fb5eb58d6a1b25b8c.zip
Add testcase for #560
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue560/reproducer.vhdl58
-rw-r--r--testsuite/gna/issue560/reproducer2.vhdl58
-rw-r--r--testsuite/gna/issue560/reproducer3.vhdl58
-rw-r--r--testsuite/gna/issue560/reproducer_ok.vhdl58
-rwxr-xr-xtestsuite/gna/issue560/testsuite.sh12
5 files changed, 244 insertions, 0 deletions
diff --git a/testsuite/gna/issue560/reproducer.vhdl b/testsuite/gna/issue560/reproducer.vhdl
new file mode 100644
index 000000000..0a7fe319c
--- /dev/null
+++ b/testsuite/gna/issue560/reproducer.vhdl
@@ -0,0 +1,58 @@
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+package reproducer_pkg is
+
+ -- Functions
+ function MIN(LEFT, RIGHT: unsigned) return unsigned;
+ function MIN(LEFT, RIGHT: integer) return integer;
+
+end reproducer_pkg;
+
+package body reproducer_pkg is
+
+ function MIN(LEFT, RIGHT: unsigned) return unsigned is
+ begin
+ if LEFT < RIGHT then
+ return LEFT;
+ else
+ return RIGHT;
+ end if;
+ end;
+
+ function MIN(LEFT, RIGHT: integer) return integer is
+ begin
+ if LEFT < RIGHT then
+ return LEFT;
+ else
+ return RIGHT;
+ end if;
+ end;
+
+end reproducer_pkg;
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+library work;
+ use work.reproducer_pkg.all;
+
+entity reproducer is
+ port(
+ inputA : in unsigned(7 downto 0);
+ inputB : in unsigned(7 downto 0);
+ inputC : in integer;
+ inputD : in integer;
+ OutputA : out unsigned(7 downto 0);
+ OutputB : out integer
+ );
+end reproducer;
+
+architecture rtl of reproducer is
+begin
+
+ OutputA <= min(inputA, inputB);
+ OutputB <= min(inputC, inputD);
+
+end rtl;
diff --git a/testsuite/gna/issue560/reproducer2.vhdl b/testsuite/gna/issue560/reproducer2.vhdl
new file mode 100644
index 000000000..5926650e2
--- /dev/null
+++ b/testsuite/gna/issue560/reproducer2.vhdl
@@ -0,0 +1,58 @@
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+package reproducer_pkg is
+
+ -- Functions
+ function MIN(LEFT, RIGHT: unsigned) return unsigned;
+-- function MIN(LEFT, RIGHT: integer) return integer;
+
+end reproducer_pkg;
+
+package body reproducer_pkg is
+
+ function MIN(LEFT, RIGHT: unsigned) return unsigned is
+ begin
+ if LEFT < RIGHT then
+ return LEFT;
+ else
+ return RIGHT;
+ end if;
+ end;
+
+ function MIN(LEFT, RIGHT: integer) return integer is
+ begin
+ if LEFT < RIGHT then
+ return LEFT;
+ else
+ return RIGHT;
+ end if;
+ end;
+
+end reproducer_pkg;
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+library work;
+ use work.reproducer_pkg.all;
+
+entity reproducer is
+ port(
+ inputA : in unsigned(7 downto 0);
+ inputB : in unsigned(7 downto 0);
+ inputC : in integer;
+ inputD : in integer;
+ OutputA : out unsigned(7 downto 0);
+ OutputB : out integer
+ );
+end reproducer;
+
+architecture rtl of reproducer is
+begin
+
+ OutputA <= min(inputA, inputB);
+-- OutputB <= min(inputC, inputD);
+
+end rtl;
diff --git a/testsuite/gna/issue560/reproducer3.vhdl b/testsuite/gna/issue560/reproducer3.vhdl
new file mode 100644
index 000000000..f5993a23c
--- /dev/null
+++ b/testsuite/gna/issue560/reproducer3.vhdl
@@ -0,0 +1,58 @@
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+package reproducer_pkg is
+
+ -- Functions
+ function MIN(LEFT, RIGHT: unsigned) return unsigned;
+ function MIN(LEFT, RIGHT: integer) return integer;
+
+end reproducer_pkg;
+
+package body reproducer_pkg is
+
+ function MIN(LEFT, RIGHT: unsigned) return unsigned is
+ begin
+ if LEFT < RIGHT then
+ return LEFT;
+ else
+ return RIGHT;
+ end if;
+ end;
+
+ function MIN(LEFT, RIGHT: integer) return integer is
+ begin
+ if LEFT < RIGHT then
+ return LEFT;
+ else
+ return RIGHT;
+ end if;
+ end;
+
+end reproducer_pkg;
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+library work;
+ use work.reproducer_pkg.all;
+
+entity reproducer is
+ port(
+ inputA : in unsigned(7 downto 0);
+ inputB : in unsigned(7 downto 0);
+ inputC : in integer;
+ inputD : in integer;
+ OutputA : out unsigned(7 downto 0);
+ OutputB : out integer
+ );
+end reproducer;
+
+architecture rtl of reproducer is
+begin
+
+-- OutputA <= min(inputA, inputB);
+ OutputB <= min(inputC, inputD);
+
+end rtl;
diff --git a/testsuite/gna/issue560/reproducer_ok.vhdl b/testsuite/gna/issue560/reproducer_ok.vhdl
new file mode 100644
index 000000000..00a98cb97
--- /dev/null
+++ b/testsuite/gna/issue560/reproducer_ok.vhdl
@@ -0,0 +1,58 @@
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+package reproducer_pkg is
+
+ -- Functions
+ function MINI(LEFT, RIGHT: unsigned) return unsigned;
+ function MINI(LEFT, RIGHT: integer) return integer;
+
+end reproducer_pkg;
+
+package body reproducer_pkg is
+
+ function MINI(LEFT, RIGHT: unsigned) return unsigned is
+ begin
+ if LEFT < RIGHT then
+ return LEFT;
+ else
+ return RIGHT;
+ end if;
+ end;
+
+ function MINI(LEFT, RIGHT: integer) return integer is
+ begin
+ if LEFT < RIGHT then
+ return LEFT;
+ else
+ return RIGHT;
+ end if;
+ end;
+
+end reproducer_pkg;
+library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+library work;
+ use work.reproducer_pkg.all;
+
+entity reproducer is
+ port(
+ inputA : in unsigned(7 downto 0);
+ inputB : in unsigned(7 downto 0);
+ inputC : in integer;
+ inputD : in integer;
+ OutputA : out unsigned(7 downto 0);
+ OutputB : out integer
+ );
+end reproducer;
+
+architecture rtl of reproducer is
+begin
+
+ OutputA <= minI(inputA, inputB);
+ OutputB <= minI(inputC, inputD);
+
+end rtl;
diff --git a/testsuite/gna/issue560/testsuite.sh b/testsuite/gna/issue560/testsuite.sh
new file mode 100755
index 000000000..b3b37535d
--- /dev/null
+++ b/testsuite/gna/issue560/testsuite.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze_failure reproducer.vhdl
+analyze_failure reproducer2.vhdl
+analyze_failure reproducer3.vhdl
+analyze reproducer_ok.vhdl
+
+clean
+
+echo "Test successful"