aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/bug029/fft.vhdl
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2015-12-19 13:57:37 +0100
committerTristan Gingold <gingold@adacore.com>2015-12-19 13:57:37 +0100
commit7fc250bfc464604ba811e9785a4719ac2c0e6564 (patch)
tree9b2361ab9fbeaa2707b358e50f65f6dd0fcb4f6f /testsuite/gna/bug029/fft.vhdl
parent3089c62c524727d5eca16ebdbc817f19cf43e000 (diff)
downloadghdl-7fc250bfc464604ba811e9785a4719ac2c0e6564.tar.gz
ghdl-7fc250bfc464604ba811e9785a4719ac2c0e6564.tar.bz2
ghdl-7fc250bfc464604ba811e9785a4719ac2c0e6564.zip
Add testcase for ghdl-llvm unreachable code.
Diffstat (limited to 'testsuite/gna/bug029/fft.vhdl')
-rw-r--r--testsuite/gna/bug029/fft.vhdl25
1 files changed, 25 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;