From 7d0280d7ad08bbf9e33164c634c538effdd1340b Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Fri, 7 Sep 2018 16:43:07 +0100 Subject: RISCV: Run RISC-V tests using version compiled to C Current pass rate is 170 out of 181. Looks like there are some issues with rv64ua-p-lrsc.elf, rv64ua-v-lrsc.elf, and rv64uc-p-rvc.elf which I think are caused by me not implementing parts of the RISC-V platform correctly in C. Some of the div and mod tests also fail, which is probably an issue with using the correct rounding. --- riscv/reset_vec.bin | Bin 0 -> 28 bytes riscv/riscv_platform.c | 2 +- test/riscv/run_tests.sh | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100755 riscv/reset_vec.bin diff --git a/riscv/reset_vec.bin b/riscv/reset_vec.bin new file mode 100755 index 00000000..d2d3563c Binary files /dev/null and b/riscv/reset_vec.bin differ diff --git a/riscv/riscv_platform.c b/riscv/riscv_platform.c index 6330ae4d..7f6ec470 100644 --- a/riscv/riscv_platform.c +++ b/riscv/riscv_platform.c @@ -62,7 +62,7 @@ void plat_insns_per_tick(sail_int *rop, unit u) mach_bits plat_htif_tohost(unit u) { - return UINT64_C(0x2000000); + return UINT64_C(0x80001000); } unit memea(mach_bits len, sail_int n) diff --git a/test/riscv/run_tests.sh b/test/riscv/run_tests.sh index 006ed425..d73fa287 100755 --- a/test/riscv/run_tests.sh +++ b/test/riscv/run_tests.sh @@ -69,5 +69,24 @@ done finish_suite "RISCV tests" +if make -C $SAILDIR/riscv riscv_c; +then + green "Building RISCV specification to C" "ok" +else + red "Building RISCV specification to C" "fail" +fi + +for test in $DIR/tests/*.elf; do + sail -elf $test -o ${test%.elf}.bin 2> /dev/null; + if timeout 5 $SAILDIR/riscv/riscv_c --binary=0x1000,reset_vec.bin --image=${test%.elf}.bin > ${test%.elf}.cout 2>&1 && grep -q SUCCESS ${test%.elf}.cout + then + green "$(basename $test)" "ok" + else + red "$(basename $test)" "fail" + fi +done + +finish_suite "RISCV C tests" + printf "\n" >> $DIR/tests.xml -- cgit v1.2.3