summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--riscv/Makefile2
-rw-r--r--riscv/riscv_all.sail9
-rwxr-xr-xtest/riscv/run_tests.sh26
3 files changed, 32 insertions, 5 deletions
diff --git a/riscv/Makefile b/riscv/Makefile
index 80b3ebf7..73bd01c0 100644
--- a/riscv/Makefile
+++ b/riscv/Makefile
@@ -1,4 +1,4 @@
-SAIL_SRCS = prelude.sail riscv_types.sail riscv_sys.sail riscv_platform.sail riscv_mem.sail riscv_vmem.sail riscv.sail riscv_step.sail riscv_analysis.sail
+SAIL_SRCS = riscv_all.sail
PLATFORM_OCAML_SRCS = platform.ml platform_impl.ml platform_main.ml
SAIL_DIR ?= $(realpath ..)
SAIL ?= $(SAIL_DIR)/sail
diff --git a/riscv/riscv_all.sail b/riscv/riscv_all.sail
new file mode 100644
index 00000000..32356ea9
--- /dev/null
+++ b/riscv/riscv_all.sail
@@ -0,0 +1,9 @@
+$include "prelude.sail"
+$include "riscv_types.sail"
+$include "riscv_sys.sail"
+$include "riscv_platform.sail"
+$include "riscv_mem.sail"
+$include "riscv_vmem.sail"
+$include "riscv.sail"
+$include "riscv_step.sail"
+$include "riscv_analysis.sail"
diff --git a/test/riscv/run_tests.sh b/test/riscv/run_tests.sh
index 512feabf..369e72b2 100755
--- a/test/riscv/run_tests.sh
+++ b/test/riscv/run_tests.sh
@@ -61,9 +61,9 @@ fi
for test in $DIR/tests/*.elf; do
if $SAILDIR/riscv/platform "$test" >"${test/.elf/.out}" 2>&1 && grep -q SUCCESS "${test/.elf/.out}"
then
- green "$(basename $test)" "ok"
+ green "$(basename $test)_ocaml" "ok"
else
- red "$(basename $test)" "fail"
+ red "$(basename $test)_ocaml" "fail"
fi
done
@@ -78,9 +78,27 @@ for test in $DIR/tests/*.elf; do
$SAILDIR/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"
+ green "$(basename $test)_c" "ok"
else
- red "$(basename $test)" "fail"
+ red "$(basename $test)_c" "fail"
+ fi
+done
+
+printf "Interpreting RISCV specification...\n"
+
+for test in $DIR/tests/*.elf; do
+ if {
+ timeout 30 $SAILDIR/sail -i $SAILDIR/riscv/riscv_all.sail $SAILDIR/riscv/main.sail > ${test%.elf}.iout 2>&1 <<EOF
+:bin 0x1000 $SAILDIR/riscv/reset_vec.bin
+:elf $test
+main()
+:run
+EOF
+ } && grep -q SUCCESS ${test%.elf}.iout
+ then
+ green "$(basename $test)_interpreter" "ok"
+ else
+ red "$(basename $test)_interpreter" "fail"
fi
done