aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------env13
-rw-r--r--isa/rv64mi/Makefrag1
-rw-r--r--isa/rv64mi/wfi.S8
-rw-r--r--isa/rv64si/Makefrag1
-rw-r--r--isa/rv64si/wfi.S41
5 files changed, 59 insertions, 5 deletions
diff --git a/env b/env
-Subproject bb05f5bc5c509e763108f954e23233ba946542e
+Subproject dac4ddd40078f31f4c2e766368c237eba84ef68
diff --git a/isa/rv64mi/Makefrag b/isa/rv64mi/Makefrag
index 52f6462..b8b1da0 100644
--- a/isa/rv64mi/Makefrag
+++ b/isa/rv64mi/Makefrag
@@ -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
index 0000000..bfb130e
--- /dev/null
+++ b/isa/rv64mi/wfi.S
@@ -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"
diff --git a/isa/rv64si/Makefrag b/isa/rv64si/Makefrag
index f19d840..17596c3 100644
--- a/isa/rv64si/Makefrag
+++ b/isa/rv64si/Makefrag
@@ -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
index 0000000..956121a
--- /dev/null
+++ b/isa/rv64si/wfi.S
@@ -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