aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testsuite/gna/bug029/fft.vhdl25
-rw-r--r--testsuite/gna/bug029/fft1.vhdl15
-rw-r--r--testsuite/gna/bug029/fft2.vhdl14
-rw-r--r--testsuite/gna/bug029/repro1.vhdl42
-rw-r--r--testsuite/gna/bug029/repro2.vhdl11
-rwxr-xr-xtestsuite/gna/bug029/testsuite.sh14
6 files changed, 121 insertions, 0 deletions
diff --git a/testsuite/gna/bug029/fft.vhdl b/testsuite/gna/bug029/fft.vhdl
new file mode 100644
index 000000000..704de1c7e
--- /dev/null
+++ b/testsuite/gna/bug029/fft.vhdl
@@ -0,0 +1,25 @@
+package fft_package is
+ TYPE complex IS ARRAY(0 TO 1) OF INTEGER;
+ CONSTANT w0 : complex := (1, 0); --Pre-computed constants
+ CONSTANT w1 : complex := (0, -1); --Pre-computed constants
+
+ function butterfly(X1, X2 , W : complex )return complex;
+END fft_package;
+
+package body fft_package is
+
+ function butterfly ( X1, X2 , W : complex )return complex is
+ VARIABLE Y1, Y2 : complex;
+
+ BEGIN
+ -- G1 = X1 + W*X2
+ G1:Y1(0) := X1(0) + ((W(0)*X2(0)) - W(1)*X2(1)); -- G1 real
+ Y1(1) := X1(1) + ((W(0)*X2(1)) + W(1)*X2(0)); -- G1 imaginary
+
+ -- G2 = X1 - W*X2
+ Y2(0) := X1(0) - ((W(0)*X2(0)) - W(1)*X2(1)); -- G2 real
+ Y2(1) := X1(1) - ((W(0)*X2(1)) + W(1)*X2(0)); -- G2 imaginary
+ return Y1;
+ return Y2;
+ END butterfly;
+end fft_package;
diff --git a/testsuite/gna/bug029/fft1.vhdl b/testsuite/gna/bug029/fft1.vhdl
new file mode 100644
index 000000000..5ea9cf327
--- /dev/null
+++ b/testsuite/gna/bug029/fft1.vhdl
@@ -0,0 +1,15 @@
+package fft_package is
+ TYPE complex IS ARRAY(0 TO 1) OF INTEGER;
+ function butterfly(X1: complex )return complex;
+END fft_package;
+
+package body fft_package is
+
+ function butterfly ( X1: complex )return complex is
+ VARIABLE Y1 : complex := X1;
+
+ BEGIN
+ return X1;
+ return Y1;
+ END butterfly;
+end fft_package;
diff --git a/testsuite/gna/bug029/fft2.vhdl b/testsuite/gna/bug029/fft2.vhdl
new file mode 100644
index 000000000..d6c64b462
--- /dev/null
+++ b/testsuite/gna/bug029/fft2.vhdl
@@ -0,0 +1,14 @@
+package fft_package is
+ TYPE complex IS ARRAY(0 TO 1) OF INTEGER;
+ function butterfly(X1, X2 , W : complex )return complex;
+END fft_package;
+
+package body fft_package is
+
+ function butterfly ( X1, X2 , W : complex )return complex is
+
+ BEGIN
+ return X1;
+ return X2;
+ END butterfly;
+end fft_package;
diff --git a/testsuite/gna/bug029/repro1.vhdl b/testsuite/gna/bug029/repro1.vhdl
new file mode 100644
index 000000000..594133da7
--- /dev/null
+++ b/testsuite/gna/bug029/repro1.vhdl
@@ -0,0 +1,42 @@
+package foo is
+ function some_foo return integer;
+ function some_fum return integer;
+ function some_foe (x, y, w: integer) return integer;
+ function some_fee (x, y, w: integer) return integer;
+end package;
+
+package body foo is
+ function some_foo return integer is
+
+ begin
+ return -1;
+ return 0;
+ end function;
+
+ function some_fum return integer is
+ variable a: integer := -1;
+ variable b: integer := 0;
+ begin
+ return a;
+ return b;
+ end function;
+
+ function some_foe (x, y, w: integer) return integer is
+ variable a: integer := -1;
+ variable b: integer := 0;
+ begin
+ return a;
+ return b;
+ end function;
+
+ function some_fee (x, y, w: integer) return integer is
+ variable a: integer := -1;
+ variable b: integer := 0;
+ begin
+ a := x + w;
+ b := y + w;
+ return a;
+ return b;
+ end function;
+
+end package body;
diff --git a/testsuite/gna/bug029/repro2.vhdl b/testsuite/gna/bug029/repro2.vhdl
new file mode 100644
index 000000000..6d5bd9ae7
--- /dev/null
+++ b/testsuite/gna/bug029/repro2.vhdl
@@ -0,0 +1,11 @@
+package foo is
+ function some_foo return integer;
+end package;
+
+package body foo is
+ function some_foo return integer is
+ begin
+ return -1;
+ return 0;
+ end function;
+end package body;
diff --git a/testsuite/gna/bug029/testsuite.sh b/testsuite/gna/bug029/testsuite.sh
new file mode 100755
index 000000000..95404c65b
--- /dev/null
+++ b/testsuite/gna/bug029/testsuite.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze fft.vhdl
+analyze fft1.vhdl
+analyze fft2.vhdl
+analyze repro1.vhdl
+analyze repro2.vhdl
+#elab_simulate simple1
+
+clean
+
+echo "Test successful"