Add basic WFI test
authorAndrew Waterman <waterman@cs.berkeley.edu>
Tue, 19 May 2015 09:28:59 +0000 (02:28 -0700)
committerAndrew Waterman <waterman@cs.berkeley.edu>
Tue, 19 May 2015 09:28:59 +0000 (02:28 -0700)
env
isa/rv64mi/Makefrag
isa/rv64mi/wfi.S [new file with mode: 0644]
isa/rv64si/Makefrag
isa/rv64si/wfi.S [new file with mode: 0644]

diff --git a/env b/env
index bb05f5bc5c509e763108f954e23233ba946542ea..dac4ddd40078f31f4c2e766368c237eba84ef68c 160000 (submodule)
--- a/env
+++ b/env
@@ -1 +1 @@
-Subproject commit bb05f5bc5c509e763108f954e23233ba946542ea
+Subproject commit dac4ddd40078f31f4c2e766368c237eba84ef68c
index 52f6462e9c1405a4beb7bf3a03bbd634d51ece04..b8b1da014f3e0e1ce4f1a8f72d9460b422589f5f 100644 (file)
@@ -10,6 +10,7 @@ rv64mi_sc_tests = \
        ma_fetch \
        ma_addr \
        scall \
+       wfi \
        sbreak \
        timer \
 
diff --git a/isa/rv64mi/wfi.S b/isa/rv64mi/wfi.S
new file mode 100644 (file)
index 0000000..bfb130e
--- /dev/null
@@ -0,0 +1,8 @@
+# See LICENSE for license details.
+
+#include "riscv_test.h"
+#undef RVTEST_RV64S
+#define RVTEST_RV64S RVTEST_RV64M
+#define __MACHINE_MODE
+
+#include "../rv64si/wfi.S"
index f19d8404ceea07e629f412fa24d1e2c320c92cc7..17596c3b900065bf844db50a725568381268a420 100644 (file)
@@ -8,6 +8,7 @@ rv64si_sc_tests = \
        ma_fetch \
        ma_addr \
        scall \
+       wfi \
        sbreak \
        timer \
 
diff --git a/isa/rv64si/wfi.S b/isa/rv64si/wfi.S
new file mode 100644 (file)
index 0000000..956121a
--- /dev/null
@@ -0,0 +1,41 @@
+# See LICENSE for license details.
+
+#*****************************************************************************
+# wfi.S
+#-----------------------------------------------------------------------------
+#
+# Test wait-for-interrupt instruction.
+#
+
+#include "riscv_test.h"
+#include "test_macros.h"
+
+RVTEST_RV64S
+RVTEST_CODE_BEGIN
+
+#ifdef __MACHINE_MODE
+  #define sstatus mstatus
+  #define sie mie
+  #define sip mip
+  #undef MIP_SSIP
+  #define MIP_SSIP MIP_MSIP
+#endif
+
+  # Make sure wfi doesn't stall if an interrupt is pending
+  csrc sstatus, SSTATUS_IE
+  csrs sie, MIP_SSIP
+  csrs sip, MIP_SSIP
+  wfi
+
+  RVTEST_PASS
+
+  TEST_PASSFAIL
+
+RVTEST_CODE_END
+
+  .data
+RVTEST_DATA_BEGIN
+
+  TEST_DATA
+
+RVTEST_DATA_END