aboutsummaryrefslogtreecommitdiff
path: root/isa/rv64si
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-05-19 02:28:59 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-05-19 02:28:59 -0700
commit80538e49f76fca845e1aa45e6033cd7648975779 (patch)
tree6980e674fee7c4a10c1a92e34a65ba61caea46b3 /isa/rv64si
parentf63ce2ad06a4d4e5d35c75fbdeec8b1ab00f3d87 (diff)
downloadriscv-tests-80538e49f76fca845e1aa45e6033cd7648975779.zip
riscv-tests-80538e49f76fca845e1aa45e6033cd7648975779.tar.gz
riscv-tests-80538e49f76fca845e1aa45e6033cd7648975779.tar.bz2
Add basic WFI test
Diffstat (limited to 'isa/rv64si')
-rw-r--r--isa/rv64si/Makefrag1
-rw-r--r--isa/rv64si/wfi.S41
2 files changed, 42 insertions, 0 deletions
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