Nils Asmussen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/25706 )

Change subject: arch-riscv,tests: run p tests.
......................................................................

arch-riscv,tests: run p tests.

This commit enables the p tests (using physical memory) of the test
suite. To report success/failure, we use the pseudo instructions m5exit
and m5fail. The test based on timer ticks has been disabled, because
RISC-V has no timer yet.

Change-Id: I0f0e6d6c20210a02411aac0b8d4e85c27f0d904d
---
M tests/test-progs/asmtest/src/riscv/Makefile
M tests/test-progs/asmtest/src/riscv/env/p/riscv_test.h
M tests/test-progs/asmtest/src/riscv/isa/rv64mi/Makefrag
M tests/test-progs/asmtest/src/riscv/isa/rv64mi/illegal.S
M tests/test-progs/asmtest/src/riscv/isa/rv64si/Makefrag
5 files changed, 20 insertions(+), 7 deletions(-)



diff --git a/tests/test-progs/asmtest/src/riscv/Makefile b/tests/test-progs/asmtest/src/riscv/Makefile
index c1fe47d..7b54251 100644
--- a/tests/test-progs/asmtest/src/riscv/Makefile
+++ b/tests/test-progs/asmtest/src/riscv/Makefile
@@ -45,6 +45,11 @@

 define compile_template

+$$($(1)_p_tests): $(1)-p-%: $(1)/%.S
+       mkdir -p $(bin_dir)
+ $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -I$(src_dir)/../env/p -I$(src_dir)/macros/scalar -T$(src_dir)/../env/p/link.ld $$< -o $(bin_dir)/$$@
+$(1)_p_env_tests += $$($(1)_p_tests)
+
 $$($(1)_ps_tests): $(1)-ps-%: $(1)/%.S
        mkdir -p $(bin_dir)
$$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -I$(src_dir)/../env/ps -I$(src_dir)/macros/scalar -I$(src_dir)/macros/mt -T$(src_dir)/../env/ps/link.ld $$< -o $(bin_dir)/$$@
@@ -73,12 +78,15 @@
 $(eval $(call compile_template,rv64uamt,-march=rv64g -mabi=lp64))
 $(eval $(call compile_template,rv64samt,-march=rv64g -mabi=lp64))

+p_env_tests_dump = $(addsuffix .dump, $(p_env_tests))
 ps_env_tests_dump = $(addsuffix .dump, $(ps_env_tests))

 #------------------------------------------------------------
 # Targets

-all:   ps
+all:   p ps
+# build tests with p environment
+p:             $(p_env_tests_dump)
 # build tests with ps environment
 ps:    $(ps_env_tests_dump)

diff --git a/tests/test-progs/asmtest/src/riscv/env/p/riscv_test.h b/tests/test-progs/asmtest/src/riscv/env/p/riscv_test.h
index bb7ced6..9d90e97 100644
--- a/tests/test-progs/asmtest/src/riscv/env/p/riscv_test.h
+++ b/tests/test-progs/asmtest/src/riscv/env/p/riscv_test.h
@@ -155,7 +155,13 @@
         /* some unhandlable exception occurred */                       \
   1:    ori TESTNUM, TESTNUM, 1337;                                     \
   write_tohost:                                                         \
-        sw TESTNUM, tohost, t5;                                         \
+        li a0, 0;                                                       \
+        mv a1, TESTNUM;                                                 \
+        li a2, 1;                                                       \
+        beq a1, a2, 1f;                                                 \
+        srl a1, a1, 1;                                                  \
+        .long 0x4400007B;                                               \
+  1:    .long 0x4200007B;                                               \
         j write_tohost;                                                 \
 reset_vector:                                                           \
         RISCV_MULTICORE_DISABLE;                                        \
diff --git a/tests/test-progs/asmtest/src/riscv/isa/rv64mi/Makefrag b/tests/test-progs/asmtest/src/riscv/isa/rv64mi/Makefrag
index b0ddefe..c81c24e 100644
--- a/tests/test-progs/asmtest/src/riscv/isa/rv64mi/Makefrag
+++ b/tests/test-progs/asmtest/src/riscv/isa/rv64mi/Makefrag
@@ -13,7 +13,6 @@
        scall \
        sbreak \

-rv32ud_p_tests = $(addprefix rv32ud-p-, $(rv32ud_sc_tests))
-#rv32ud_ps_tests = $(addprefix rv32ud-ps-, $(rv32ud_sc_tests))
+rv64mi_p_tests = $(addprefix rv64mi-p-, $(rv64mi_sc_tests))

 spike_tests += $(rv64mi_p_tests)
diff --git a/tests/test-progs/asmtest/src/riscv/isa/rv64mi/illegal.S b/tests/test-progs/asmtest/src/riscv/isa/rv64mi/illegal.S
index 5531570..41097f5 100644
--- a/tests/test-progs/asmtest/src/riscv/isa/rv64mi/illegal.S
+++ b/tests/test-progs/asmtest/src/riscv/isa/rv64mi/illegal.S
@@ -40,8 +40,9 @@
   andi t0, t0, 1
   beqz t0, msip
   csrsi mstatus, MSTATUS_MIE
-1:
-  j 1b
+# TODO we don't have a timer yet, so just skip the test
+# 1:
+#   j 1b
 msip:
   csrw mtvec, s0

diff --git a/tests/test-progs/asmtest/src/riscv/isa/rv64si/Makefrag b/tests/test-progs/asmtest/src/riscv/isa/rv64si/Makefrag
index c4a5564..f01a332 100644
--- a/tests/test-progs/asmtest/src/riscv/isa/rv64si/Makefrag
+++ b/tests/test-progs/asmtest/src/riscv/isa/rv64si/Makefrag
@@ -12,6 +12,5 @@
        sbreak \

 rv64si_p_tests = $(addprefix rv64si-p-, $(rv64si_sc_tests))
-#rv64si_ps_tests = $(addprefix rv64si-ps-, $(rv64si_sc_tests))

 spike_tests += $(rv64si_p_tests)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/25706
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I0f0e6d6c20210a02411aac0b8d4e85c27f0d904d
Gerrit-Change-Number: 25706
Gerrit-PatchSet: 1
Gerrit-Owner: Nils Asmussen <nils.asmus...@barkhauseninstitut.org>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to