aboutsummaryrefslogtreecommitdiff
path: root/isa
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-05-09 16:39:39 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-05-09 16:39:39 -0700
commita60626553be99d69f879464dbeb71ffe1ff80c75 (patch)
tree9addb6b177536179dc4d9b72b510cbe7f0f70a78 /isa
parent5ce97df1c97b4ef39b94041350b910d12f782328 (diff)
downloadriscv-tests-a60626553be99d69f879464dbeb71ffe1ff80c75.zip
riscv-tests-a60626553be99d69f879464dbeb71ffe1ff80c75.tar.gz
riscv-tests-a60626553be99d69f879464dbeb71ffe1ff80c75.tar.bz2
Update to privileged architecture version 1.7
Diffstat (limited to 'isa')
-rw-r--r--isa/rv64mi/Makefrag1
-rw-r--r--isa/rv64mi/dirty.S4
-rw-r--r--isa/rv64mi/ipi.S5
-rw-r--r--isa/rv64mi/mcsr.S30
-rw-r--r--isa/rv64si/csr.S4
-rw-r--r--isa/rv64si/scall.S4
-rw-r--r--isa/rv64si/timer.S23
7 files changed, 55 insertions, 16 deletions
diff --git a/isa/rv64mi/Makefrag b/isa/rv64mi/Makefrag
index db40dc1..52f6462 100644
--- a/isa/rv64mi/Makefrag
+++ b/isa/rv64mi/Makefrag
@@ -5,6 +5,7 @@
rv64mi_sc_tests = \
dirty \
csr \
+ mcsr \
illegal \
ma_fetch \
ma_addr \
diff --git a/isa/rv64mi/dirty.S b/isa/rv64mi/dirty.S
index 1cf429a..2be4921 100644
--- a/isa/rv64mi/dirty.S
+++ b/isa/rv64mi/dirty.S
@@ -74,9 +74,9 @@ die:
.data
.align 12
-page_table_1: .dword PTE_TYPE_US_SRX
+page_table_1: .dword PTE_V | PTE_TYPE_URX_SRX
dummy: .dword 0
.align 12
-page_table_2: .dword PTE_TYPE_US_SRWX
+page_table_2: .dword PTE_V | PTE_TYPE_URWX_SRWX
RVTEST_CODE_END
diff --git a/isa/rv64mi/ipi.S b/isa/rv64mi/ipi.S
index 326476d..457a9cd 100644
--- a/isa/rv64mi/ipi.S
+++ b/isa/rv64mi/ipi.S
@@ -15,6 +15,7 @@ RVTEST_CODE_BEGIN
# enable interrupts
csrs mstatus, MSTATUS_IE
+ csrs mie, MIP_MSIP
# get a unique core id
la a0, coreid
@@ -30,7 +31,7 @@ RVTEST_CODE_BEGIN
bltu a1, a3, 1b
# IPI dominoes
- csrr a0, hartid
+ csrr a0, mhartid
1: bnez a0, 1b
add a0, a0, 1
rem a0, a0, a3
@@ -38,7 +39,7 @@ RVTEST_CODE_BEGIN
1: j 1b
mtvec_handler:
- csrr a0, hartid
+ csrr a0, mhartid
bnez a0, 2f
RVTEST_PASS
diff --git a/isa/rv64mi/mcsr.S b/isa/rv64mi/mcsr.S
new file mode 100644
index 0000000..c1e2cd3
--- /dev/null
+++ b/isa/rv64mi/mcsr.S
@@ -0,0 +1,30 @@
+# See LICENSE for license details.
+
+#*****************************************************************************
+# mcsr.S
+#-----------------------------------------------------------------------------
+#
+# Test various M-mode CSRs.
+#
+
+#include "riscv_test.h"
+#include "test_macros.h"
+
+RVTEST_RV64M
+RVTEST_CODE_BEGIN
+
+ # Check that mcpuid reports RV64
+ TEST_CASE(2, a0, 0x2, csrr a0, mcpuid; srl a0, a0, 62)
+
+ # Check that mhartid reports 0
+ TEST_CASE(3, a0, 0x0, csrr a0, mhartid)
+
+ # Check that mimpid reports UC Berkeley
+ TEST_CASE(4, a0, 0x1, csrr a0, mimpid; sll a0, a0, 48; srl a0, a0, 48)
+
+ # Check that mtvec reports DEFAULT_MTVEC
+ TEST_CASE(5, a0, DEFAULT_MTVEC, csrr a0, mtvec)
+
+ TEST_PASSFAIL
+
+RVTEST_CODE_END
diff --git a/isa/rv64si/csr.S b/isa/rv64si/csr.S
index 5d4b309..d66b432 100644
--- a/isa/rv64si/csr.S
+++ b/isa/rv64si/csr.S
@@ -23,7 +23,7 @@ RVTEST_CODE_BEGIN
#define SSTATUS_PS MSTATUS_PRV1
#endif
- csrwi scycle, 0
+ csrwi cyclew, 0
csrwi sscratch, 3
TEST_CASE( 2, a0, 3, csrr a0, sscratch);
@@ -85,7 +85,7 @@ privileged:
syscall:
# Make sure scause indicates a syscall.
csrr t0, scause
- li t1, CAUSE_ECALL
+ li t1, CAUSE_USER_ECALL
bne t0, t1, fail
# We're done.
diff --git a/isa/rv64si/scall.S b/isa/rv64si/scall.S
index e1c13b6..935b2dd 100644
--- a/isa/rv64si/scall.S
+++ b/isa/rv64si/scall.S
@@ -19,6 +19,8 @@ RVTEST_CODE_BEGIN
#define scause mcause
#define sepc mepc
#define stvec_handler mtvec_handler
+ #undef CAUSE_SUPERVISOR_ECALL
+ #define CAUSE_SUPERVISOR_ECALL CAUSE_MACHINE_ECALL
#endif
li TESTNUM, 2
@@ -30,7 +32,7 @@ RVTEST_CODE_BEGIN
TEST_PASSFAIL
stvec_handler:
- li t1, CAUSE_ECALL
+ li t1, CAUSE_SUPERVISOR_ECALL
csrr t0, scause
bne t0, t1, fail
csrr t0, sepc
diff --git a/isa/rv64si/timer.S b/isa/rv64si/timer.S
index c78d922..9909d41 100644
--- a/isa/rv64si/timer.S
+++ b/isa/rv64si/timer.S
@@ -16,23 +16,28 @@ RVTEST_CODE_BEGIN
#ifdef __MACHINE_MODE
#define sscratch mscratch
#define sstatus mstatus
+ #define sie mie
#define scause mcause
#define sepc mepc
#define stvec_handler mtvec_handler
#undef SSTATUS_PS
#define SSTATUS_PS MSTATUS_PRV1
- #undef SSTATUS_IE
- #define SSTATUS_IE MSTATUS_IE
- #undef SSTATUS_TIE
- #define SSTATUS_TIE MSTATUS_STIE
+ #undef SIP_STIP
+ #define SIP_STIP MIP_STIP
#endif
+#define DELTA_T 999
+
li s8, 0 # number of taken timer interrupts
li s9, 10 # how many interrupts to run for
- csrw stimecmp, 1
- csrw stime, 0
- li a0, SSTATUS_IE | SSTATUS_TIE
- csrs sstatus, a0
+
+ .align 4
+ csrr a0, stime
+ add a0, a0, DELTA_T
+ csrw stimecmp, a0
+ li a0, SIP_STIP
+ csrs sie, a0
+ csrs sstatus, SSTATUS_IE
# jump to user land
li t0, SSTATUS_PS
@@ -79,7 +84,7 @@ stvec_handler:
bnez t0, fail
csrr t0, stime
- addi t0, t0, 999
+ addi t0, t0, DELTA_T
csrw stimecmp, t0
add s8, s8, 1