aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/polybench-syn/linear-algebra/solvers/durbin.c')
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/durbin.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c b/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
index dd6d05e..5c853a7 100644
--- a/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
@@ -9,6 +9,48 @@
*/
/* durbin.c: this file is part of PolyBench/C */
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
+unsigned int divider(unsigned int x, unsigned int y)
+{
+ unsigned int r0, q0, y0, y1;
+
+ r0 = x;
+ q0 = 0;
+ y0 = y;
+ y1 = y;
+ do
+ {
+ y1 = 2 * y1;
+ } while (y1 <= x);
+ do
+ {
+ y1 = y1 / 2;
+ q0 = 2 * q0;
+ if (r0 >= y1)
+ {
+ r0 = r0 - y1;
+ q0 = q0 + 1;
+ }
+ } while ((int)y1 != (int)y0);
+ return q0;
+}
+
+int sdivider(int N, int D) {
+ if (D < 0) {
+ if (N < 0)
+ return divider(-N, -D);
+ else
+ return -divider(N, -D);
+ } else {
+ if (N < 0)
+ return -divider(-N, D);
+ else
+ return divider(N, D);
+ }
+}
unsigned int divider(unsigned int x, unsigned int y)
{
@@ -79,6 +121,10 @@ int print_array(int n,
res += y[i];
}
+#ifndef SYNTHESIS
+ printf("finished = %u\n", res);
+#endif
+
return res;
}
@@ -105,7 +151,6 @@ void kernel_durbin(int n,
sum += r[k-i-ONE]*y[i];
}
alpha = - sdivider(r[k] + sum, beta);
- //alpha = - (r[k] + sum) / beta;
for (i=0; i<k; plus(i)) {
z[i] = y[i] + alpha*y[k-i-ONE];