aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--benchmarks/Makefile9
-rw-r--r--benchmarks/common/crt.S2
-rw-r--r--benchmarks/common/syscalls.c44
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac2
m---------env14
-rw-r--r--isa/Makefile5
-rwxr-xr-xmt/Makefile7
9 files changed, 40 insertions, 49 deletions
diff --git a/README.md b/README.md
index 67dd772..7149045 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Building from repository
-----------------------------
We assume that the RISCV environment variable is set to the RISC-V tools
-install path, and that the riscv-gcc package is installed.
+install path, and that the riscv-gnu-toolchain package is installed.
$ git clone https://github.com/ucb-bar/riscv-tests
$ cd riscv-tests
diff --git a/benchmarks/Makefile b/benchmarks/Makefile
index 3346c7c..23ce02d 100644
--- a/benchmarks/Makefile
+++ b/benchmarks/Makefile
@@ -50,12 +50,13 @@ bmarks_host = \
HOST_OPTS = -std=gnu99 -DPREALLOCATE=0 -DHOST_DEBUG=1
HOST_COMP = gcc $(HOST_OPTS)
-RISCV_GCC = riscv-gcc
+RISCV_PREFIX=riscv64-unknown-elf-
+RISCV_GCC = $(RISCV_PREFIX)gcc
RISCV_GCC_OPTS = -static -Wa,-march=RVIMAFDXhwacha -std=gnu99 -O2 -ffast-math
-RISCV_LINK = riscv-gcc -T $(bmarkdir)/common/test.ld $(incs)
-RISCV_LINK_MT = riscv-gcc -T $(bmarkdir)/common/test-mt.ld
+RISCV_LINK = $(RISCV_GCC) -T $(bmarkdir)/common/test.ld $(incs)
+RISCV_LINK_MT = $(RISCV_GCC) -T $(bmarkdir)/common/test-mt.ld
RISCV_LINK_OPTS = -nostdlib -nostartfiles -ffast-math -lc
-RISCV_OBJDUMP = riscv-objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data
+RISCV_OBJDUMP = $(RISCV_PREFIX)objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data
RISCV_SIM = spike
VPATH += $(addprefix $(bmarkdir)/, $(bmarks))
diff --git a/benchmarks/common/crt.S b/benchmarks/common/crt.S
index 24e3580..24d22e8 100644
--- a/benchmarks/common/crt.S
+++ b/benchmarks/common/crt.S
@@ -177,7 +177,7 @@ trap_entry:
csrr a1, epc
mv a2, sp
jal handle_trap
- csrw epc, v0
+ csrw epc, a0
LREG t0, 256(sp)
LREG t1, 264(sp)
diff --git a/benchmarks/common/syscalls.c b/benchmarks/common/syscalls.c
index 7be2b53..ddbb795 100644
--- a/benchmarks/common/syscalls.c
+++ b/benchmarks/common/syscalls.c
@@ -26,8 +26,8 @@ static long handle_frontend_syscall(long which, long arg0, long arg1, long arg2)
// In setStats, we might trap reading uarch-specific counters.
// The trap handler will skip over the instruction and write 0,
-// but only if v0 is the destination register.
-#define read_csr_safe(reg) ({ register long __tmp asm("v0"); \
+// but only if a0 is the destination register.
+#define read_csr_safe(reg) ({ register long __tmp asm("a0"); \
asm volatile ("csrr %0, " #reg : "=r"(__tmp)); \
__tmp; })
@@ -37,12 +37,8 @@ static char* counter_names[NUM_COUNTERS];
static int handle_stats(int enable)
{
//use csrs to set stats register
- if(enable) {
- asm volatile (R"(
- addi v0, x0, 1
- csrrs v0, stats, v0
- )" : : : "v0");
- }
+ if (enable)
+ asm volatile ("csrrs a0, stats, 1" ::: "a0");
int i = 0;
#define READ_CTR(name) do { \
while (i >= NUM_COUNTERS) ; \
@@ -56,12 +52,8 @@ static int handle_stats(int enable)
READ_CTR(uarch8); READ_CTR(uarch9); READ_CTR(uarch10); READ_CTR(uarch11);
READ_CTR(uarch12); READ_CTR(uarch13); READ_CTR(uarch14); READ_CTR(uarch15);
#undef READ_CTR
- if(!enable) {
- asm volatile (R"(
- addi v0, x0, 1
- csrrc v0, stats, v0
- )" : : : "v0");
- }
+ if (!enable)
+ asm volatile ("csrrc a0, stats, 1" ::: "a0");
return 0;
}
@@ -73,34 +65,34 @@ static void tohost_exit(int code)
long handle_trap(long cause, long epc, long regs[32])
{
- int csr_insn;
- asm volatile ("lw %0, 1f; j 2f; 1: csrr v0, stats; 2:" : "=r"(csr_insn));
+ int* csr_insn;
+ asm ("jal %0, 1f; csrr a0, stats; 1:" : "=r"(csr_insn));
long sys_ret = 0;
if (cause == CAUSE_ILLEGAL_INSTRUCTION &&
- (*(int*)epc & csr_insn) == csr_insn)
+ (*(int*)epc & *csr_insn) == *csr_insn)
;
else if (cause != CAUSE_SYSCALL)
tohost_exit(1337);
- else if (regs[16] == SYS_exit)
- tohost_exit(regs[18]);
- else if (regs[16] == SYS_stats)
- sys_ret = handle_stats(regs[18]);
+ else if (regs[17] == SYS_exit)
+ tohost_exit(regs[10]);
+ else if (regs[17] == SYS_stats)
+ sys_ret = handle_stats(regs[10]);
else
- sys_ret = handle_frontend_syscall(regs[16], regs[18], regs[19], regs[20]);
+ sys_ret = handle_frontend_syscall(regs[17], regs[10], regs[11], regs[12]);
- regs[16] = sys_ret;
+ regs[10] = sys_ret;
return epc+4;
}
static long syscall(long num, long arg0, long arg1, long arg2)
{
- register long v0 asm("v0") = num;
+ register long a7 asm("a7") = num;
register long a0 asm("a0") = arg0;
register long a1 asm("a1") = arg1;
register long a2 asm("a2") = arg2;
- asm volatile ("scall" : "+r"(v0) : "r"(a0), "r"(a1), "r"(a2) : "s0");
- return v0;
+ asm volatile ("scall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(a7));
+ return a0;
}
void exit(int code)
diff --git a/configure b/configure
index e843347..d0f935e 100755
--- a/configure
+++ b/configure
@@ -1713,7 +1713,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
- for ac_prog in riscv-gcc
+ for ac_prog in riscv64-unknown-elf-gcc
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -1757,7 +1757,7 @@ fi
fi
if test -z "$CC"; then
ac_ct_CC=$CC
- for ac_prog in riscv-gcc
+ for ac_prog in riscv64-unknown-elf-gcc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
diff --git a/configure.ac b/configure.ac
index da4ff02..c32adb1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_INIT(riscv-tests, 1.0)
cross_compiling=yes
-AC_PROG_CC([riscv-gcc])
+AC_PROG_CC([riscv64-unknown-elf-gcc])
AC_OUTPUT(
Makefile
diff --git a/env b/env
-Subproject cb2f03b341e9b9e2f05e5e0bf999bb7a0890499
+Subproject 9be35353ecb3252ec62b86d446c43ba89843b0b
diff --git a/isa/Makefile b/isa/Makefile
index 81acc2d..19bd1e7 100644
--- a/isa/Makefile
+++ b/isa/Makefile
@@ -18,9 +18,10 @@ default: all
# Build rules
#--------------------------------------------------------------------
-RISCV_GCC = riscv-gcc
+RISCV_PREFIX=riscv64-unknown-elf-
+RISCV_GCC = $(RISCV_PREFIX)gcc
RISCV_GCC_OPTS = -static -fpic -fvisibility=hidden -nostdlib -nostartfiles -Wa,-march=RVIMAFDXhwacha
-RISCV_OBJDUMP = riscv-objdump --disassemble-all --section=.text --section=.data --section=.bss
+RISCV_OBJDUMP = $(RISCV_PREFIX)objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data
RISCV_SIM = spike --extension=hwacha
vpath %.S $(isa_src_dir)
diff --git a/mt/Makefile b/mt/Makefile
index 16240b0..9829927 100755
--- a/mt/Makefile
+++ b/mt/Makefile
@@ -75,11 +75,12 @@ bmarks = $(bmarks_vvadd) $(bmarks_matmul)
# Build rules
#--------------------------------------------------------------------
-RISCV_GCC = riscv-gcc
+RISCV_PREFIX=riscv64-unknown-elf-
+RISCV_GCC = $(RISCV_PREFIX)gcc
RISCV_GCC_OPTS = -Wa,-march=RVIMAFDXhwacha -std=gnu99 -O2 -ffast-math
-RISCV_LINK = riscv-gcc -T $(common)/test.ld $(incs)
+RISCV_LINK = $(RISCV_GCC) -T $(common)/test.ld $(incs)
RISCV_LINK_OPTS = -nostdlib -nostartfiles -ffast-math -lc
-RISCV_OBJDUMP = riscv-objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data
+RISCV_OBJDUMP = $(RISCV_PREFIX)objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data
RISCV_SIM = spike -p2
VPATH += $(common) $(common)/../mt-matmul $(common)/../mt-vvadd