From 80538e49f76fca845e1aa45e6033cd7648975779 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Tue, 19 May 2015 02:28:59 -0700 Subject: Add basic WFI test --- isa/rv64mi/Makefrag | 1 + isa/rv64mi/wfi.S | 8 ++++++++ isa/rv64si/Makefrag | 1 + isa/rv64si/wfi.S | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 isa/rv64mi/wfi.S create mode 100644 isa/rv64si/wfi.S (limited to 'isa') 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 -- cgit v1.1