aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-11-15 11:44:21 +0000
committerNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-11-15 11:44:21 +0000
commitaba1066919919bf068b723fca3741be6f3a1de97 (patch)
tree84fe16aa550b7cff31f16ea824bcac552773de02 /benchmarks
parent95861dbef966e2cb612b303615681fc29c3acd3d (diff)
downloadvericert-kvx-aba1066919919bf068b723fca3741be6f3a1de97.tar.gz
vericert-kvx-aba1066919919bf068b723fca3741be6f3a1de97.zip
some fixes
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/durbin.c9
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c13
-rwxr-xr-xbenchmarks/polybench-syn/run-vericert.sh2
-rw-r--r--benchmarks/polybench-syn/stencils/fdtd-2d.c14
-rw-r--r--benchmarks/polybench-syn/stencils/heat-3d.c20
5 files changed, 36 insertions, 22 deletions
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c b/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
index dd6d05e..4b1a87f 100644
--- a/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
@@ -9,6 +9,9 @@
*/
/* durbin.c: this file is part of PolyBench/C */
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
unsigned int divider(unsigned int x, unsigned int y)
{
@@ -76,9 +79,13 @@ int print_array(int n,
int res = 0;
for (i = 0; i < n; plus(i)) {
- res += y[i];
+ res ^= y[i];
}
+#ifndef SYNTHESIS
+ printf("finished: %u\n", res);
+#endif
+
return res;
}
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c b/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c
index 8e76231..2f636df 100644
--- a/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c
@@ -11,6 +11,11 @@
#include "../../include/misc.h"
+
+#ifndef SYNTHESIS
+#include <stdio.h>
+#endif
+
#define plus(i) i = i + ONE
static
void init_array(int n,
@@ -23,7 +28,7 @@ void init_array(int n,
for (i = 0; i < n; plus(i))
{
- x[i] = - 999;
+ x[i] = -999;
b[i] = i ;
for (j = 0; j <= i; plus(j))
L[i][j] = (int) divider((i+n-j+ONE)*(ONE+ONE), n);
@@ -42,8 +47,12 @@ int check_array(int n,
int res = 0;
int ONE = 1;
for (i = 0; i < n; plus(i)) {
- res += x[i];
+ res ^= x[i];
}
+
+#ifndef SYNTHESIS
+ printf("finished: %u\n", res);
+#endif
return res;
}
diff --git a/benchmarks/polybench-syn/run-vericert.sh b/benchmarks/polybench-syn/run-vericert.sh
index 3be6098..7256235 100755
--- a/benchmarks/polybench-syn/run-vericert.sh
+++ b/benchmarks/polybench-syn/run-vericert.sh
@@ -8,7 +8,7 @@ while read benchmark ; do
./$benchmark.o
cresult=$(echo $?)
echo "C output: "$cresult
- ../../bin/vericert -O0 -finline --debug-hls $benchmark.c -o $benchmark.v
+ ../../bin/vericert -DSYNTHESIS -O0 -finline --debug-hls $benchmark.c -o $benchmark.v
iverilog -o $benchmark.iver -- $benchmark.v
./$benchmark.iver > $benchmark.tmp
veriresult=$(tail -1 $benchmark.tmp | cut -d' ' -f2)
diff --git a/benchmarks/polybench-syn/stencils/fdtd-2d.c b/benchmarks/polybench-syn/stencils/fdtd-2d.c
index 17acd34..853d362 100644
--- a/benchmarks/polybench-syn/stencils/fdtd-2d.c
+++ b/benchmarks/polybench-syn/stencils/fdtd-2d.c
@@ -10,6 +10,8 @@
/* fdtd-2d.c: this file is part of PolyBench/C */
+#include "../include/misc.h"
+
#define plus(i) i = i + ONE
static
void init_array (int tmax,
@@ -22,18 +24,16 @@ void init_array (int tmax,
{
int i, j;
int ONE = 1;
- int TWO = 1;
- int THREE = 1;
for (i = 0; i < tmax; plus(i))
_fict_[i] = (int) i;
for (i = 0; i < nx; plus(i))
for (j = 0; j < ny; plus(j))
- {
- ex[i][j] = ((int) i*(j+ONE)) / nx;
- ey[i][j] = ((int) i*(j+TWO)) / ny;
- hz[i][j] = ((int) i*(j+THREE)) / nx;
- }
+ {
+ ex[i][j] = sdivider(i*(j+1) , nx);
+ ey[i][j] = sdivider(i*(j+2) , ny);
+ hz[i][j] = sdivider(i*(j+3) , nx);
+ }
}
diff --git a/benchmarks/polybench-syn/stencils/heat-3d.c b/benchmarks/polybench-syn/stencils/heat-3d.c
index 6529e8b..8df16d4 100644
--- a/benchmarks/polybench-syn/stencils/heat-3d.c
+++ b/benchmarks/polybench-syn/stencils/heat-3d.c
@@ -9,6 +9,8 @@
*/
/* heat-3d.c: this file is part of PolyBench/C */
+#include "../include/misc.h"
+
#define plus(i) i = i + ONE
static
void init_array (int n,
@@ -17,12 +19,11 @@ void init_array (int n,
{
int i, j, k;
int ONE = 1;
- int TEN = 10;
for (i = 0; i < n; plus(i))
for (j = 0; j < n; plus(j))
for (k = 0; k < n; plus(k))
- A[i][j][k] = B[i][j][k] = (int) (i + j + (n-k))* TEN / (n);
+ A[i][j][k] = B[i][j][k] = (int) (i + j + (n-k))* sdivider(10, n);
}
@@ -57,16 +58,14 @@ void kernel_heat_3d(int tsteps,
int t, i, j, k;
int ONE = 1;
int TWO = 2;
- int FOUR = 4;
-#pragma scop
for (t = 1; t <= 5; plus(t)) {
for (i = 1; i < n-ONE; plus(i)) {
for (j = 1; j < n-ONE; plus(j)) {
for (k = 1; k < n-ONE; plus(k)) {
- B[i][j][k] = (A[i+ONE][j][k] - TWO * A[i][j][k] + A[i-ONE][j][k]) >> FOUR
- + (A[i][j+ONE][k] - TWO * A[i][j][k] + A[i][j-ONE][k]) >> 4
- + (A[i][j][k+ONE] - TWO * A[i][j][k] + A[i][j][k-ONE]) >> 4
+ B[i][j][k] = ((A[i+ONE][j][k] - TWO * A[i][j][k] + A[i-ONE][j][k]) >> 4)
+ + ((A[i][j+ONE][k] - TWO * A[i][j][k] + A[i][j-ONE][k]) >> 4)
+ + ((A[i][j][k+ONE] - TWO * A[i][j][k] + A[i][j][k-ONE]) >> 4)
+ A[i][j][k]
;
}
@@ -75,16 +74,15 @@ void kernel_heat_3d(int tsteps,
for (i = 1; i < n-ONE; plus(i)) {
for (j = 1; j < n-ONE; plus(j)) {
for (k = 1; k < n-ONE; plus(k)) {
- A[i][j][k] = (B[i+ONE][j][k] - TWO * B[i][j][k] + B[i-ONE][j][k]) >> 4
- + (B[i][j+ONE][k] - TWO * B[i][j][k] + B[i][j-ONE][k]) >> 4
- + (B[i][j][k+ONE] - TWO * B[i][j][k] + B[i][j][k-ONE]) >> 4
+ A[i][j][k] = ((B[i+ONE][j][k] - TWO * B[i][j][k] + B[i-ONE][j][k]) >> 4 )
+ + ((B[i][j+ONE][k] - TWO * B[i][j][k] + B[i][j-ONE][k]) >> 4 )
+ + ((B[i][j][k+ONE] - TWO * B[i][j][k] + B[i][j][k-ONE]) >> 4 )
+ B[i][j][k];
//;
}
}
}
}
-#pragma endscop
}