aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2016-07-05 15:02:38 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2016-07-05 15:02:38 -0700
commitc6c10b4ea84850779e04bfb5762b1dff6f60caaa (patch)
tree8042183d9c53c3e59d9f530e3d6e113a5e102403
parentd1669596573c72906ac90b3c24525b9be17c4ebb (diff)
downloadriscv-tests-c6c10b4ea84850779e04bfb5762b1dff6f60caaa.zip
riscv-tests-c6c10b4ea84850779e04bfb5762b1dff6f60caaa.tar.gz
riscv-tests-c6c10b4ea84850779e04bfb5762b1dff6f60caaa.tar.bz2
Test case for JRB's SMI demo
-rw-r--r--benchmarks/Makefile1
-rw-r--r--benchmarks/ioexample/bmark.mk30
-rw-r--r--benchmarks/ioexample/ioexample_main.c14
3 files changed, 45 insertions, 0 deletions
diff --git a/benchmarks/Makefile b/benchmarks/Makefile
index e294f72..b301a10 100644
--- a/benchmarks/Makefile
+++ b/benchmarks/Makefile
@@ -27,6 +27,7 @@ bmarks = \
spmv \
mt-vvadd \
mt-matmul \
+ ioexample \
bmarks_host = \
median \
diff --git a/benchmarks/ioexample/bmark.mk b/benchmarks/ioexample/bmark.mk
new file mode 100644
index 0000000..b0897c7
--- /dev/null
+++ b/benchmarks/ioexample/bmark.mk
@@ -0,0 +1,30 @@
+#=======================================================================
+# UCB CS250 Makefile fragment for benchmarks
+#-----------------------------------------------------------------------
+#
+# Each benchmark directory should have its own fragment which
+# essentially lists what the source files are and how to link them
+# into an riscv and/or host executable. All variables should include
+# the benchmark name as a prefix so that they are unique.
+#
+
+ioexample_c_src = \
+ ioexample_main.c \
+ syscalls.c \
+
+ioexample_riscv_src = \
+ crt.S \
+
+ioexample_c_objs = $(patsubst %.c, %.o, $(ioexample_c_src))
+ioexample_riscv_objs = $(patsubst %.S, %.o, $(ioexample_riscv_src))
+
+ioexample_host_bin = ioexample.host
+$(ioexample_host_bin) : $(ioexample_c_src)
+ $(HOST_COMP) $^ -o $(ioexample_host_bin)
+
+ioexample_riscv_bin = ioexample.riscv
+$(ioexample_riscv_bin) : $(ioexample_c_objs) $(ioexample_riscv_objs)
+ $(RISCV_LINK) $(ioexample_c_objs) $(ioexample_riscv_objs) -o $(ioexample_riscv_bin) $(RISCV_LINK_OPTS)
+
+junk += $(ioexample_c_objs) $(ioexample_riscv_objs) \
+ $(ioexample_host_bin) $(ioexample_riscv_bin)
diff --git a/benchmarks/ioexample/ioexample_main.c b/benchmarks/ioexample/ioexample_main.c
new file mode 100644
index 0000000..9ac8509
--- /dev/null
+++ b/benchmarks/ioexample/ioexample_main.c
@@ -0,0 +1,14 @@
+// See LICENSE for license details.
+
+#include "util.h"
+
+int main( int argc, char* argv[] )
+{
+ volatile long *base = (long *)0x48000000UL;
+ for (long i = 0; i < 8; ++i) {
+ base[i] = (i + (1UL << 8)) << 32UL;
+ printf("base[%d]: %llx (0x%p)\n", i, base[i], &base[i]);
+ }
+
+ return 0;
+}