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

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

arch-riscv,tests: run v tests.

This commit enables the v tests (using virtual memory) in the test
suite. As for the p tests, success/failure is reported by pseudo
instructions. Additionally, failed asserts are reported via the
m5writeFile pseudo instruction.

Change-Id: I4fcb8b9cdf0d58460fb90de869fba8c6c8c428a1
---
M tests/test-progs/asmtest/src/riscv/Makefile
M tests/test-progs/asmtest/src/riscv/env/v/vm.c
2 files changed, 22 insertions(+), 13 deletions(-)



diff --git a/tests/test-progs/asmtest/src/riscv/Makefile b/tests/test-progs/asmtest/src/riscv/Makefile
index 7b54251..4a22ae5 100644
--- a/tests/test-progs/asmtest/src/riscv/Makefile
+++ b/tests/test-progs/asmtest/src/riscv/Makefile
@@ -55,6 +55,11 @@
$$(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)/$$@
 $(1)_ps_env_tests += $$($(1)_ps_tests)

+$$($(1)_v_tests): $(1)-v-%: $(1)/%.S
+       mkdir -p $(bin_dir)
+ $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -DENTROPY=0x$$(shell echo \$$@ | md5sum | cut -c 1-7) -std=gnu99 -O2 -I$(src_dir)/../env/v -I$(src_dir)/macros/scalar -T$(src_dir)/../env/v/link.ld $(src_dir)/../env/v/entry.S $(src_dir)/../env/v/*.c $$< -o $(bin_dir)/$$@
+$(1)_v_env_tests += $$($(1)_v_tests)
+
 $(1)_tests_dump = $$(addsuffix .dump, $$($(1)_tests))

 $(1): $$($(1)_tests_dump)
@@ -80,15 +85,18 @@

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

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

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

 #------------------------------------------------------------
 # Clean up
diff --git a/tests/test-progs/asmtest/src/riscv/env/v/vm.c b/tests/test-progs/asmtest/src/riscv/env/v/vm.c
index df302b4..51a9938 100644
--- a/tests/test-progs/asmtest/src/riscv/env/v/vm.c
+++ b/tests/test-progs/asmtest/src/riscv/env/v/vm.c
@@ -17,16 +17,6 @@
 void trap_entry();
 void pop_tf(trapframe_t*);

-volatile uint64_t tohost;
-volatile uint64_t fromhost;
-
-static void do_tohost(uint64_t tohost_value)
-{
-  while (tohost)
-    fromhost = 0;
-  tohost = tohost_value;
-}
-
 #define pa2kva(pa) ((void*)(pa) - DRAM_BASE - MEGAPAGE_SIZE)
 #define uva2kva(pa) ((void*)(pa) - MEGAPAGE_SIZE)

@@ -40,7 +30,13 @@

 static void cputchar(int x)
 {
-  do_tohost(0x0101000000000000 | (unsigned char)x);
+  static const char *fileAddr = "stdout";
+  char c = x;
+  register word_t a0 asm("a0") = (uintptr_t)(&c);
+  register word_t a1 asm("a1") = 1;
+  register word_t a2 asm("a2") = 0;
+  register word_t a3 asm("a3") = (uintptr_t)fileAddr;
+  asm volatile (".long 0x9E00007B" : : "r"(a0), "r"(a1), "r"(a2), "r"(a3));
 }

 static void cputstring(const char* s)
@@ -51,7 +47,12 @@

 static void terminate(int code)
 {
-  do_tohost(code);
+  register word_t a0 asm("a0") = 0;
+  register word_t a1 asm("a1") = code >> 1;
+  if(code == 1)
+    asm volatile (".long 0x4200007B" : : "r"(a0));
+  else
+    asm volatile (".long 0x4400007B" : : "r"(a0), "r"(a1));
   while (1);
 }


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/25707
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: I4fcb8b9cdf0d58460fb90de869fba8c6c8c428a1
Gerrit-Change-Number: 25707
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