aboutsummaryrefslogtreecommitdiff
path: root/isa/rv32mi/shamt.S
diff options
context:
space:
mode:
Diffstat (limited to 'isa/rv32mi/shamt.S')
-rw-r--r--isa/rv32mi/shamt.S43
1 files changed, 43 insertions, 0 deletions
diff --git a/isa/rv32mi/shamt.S b/isa/rv32mi/shamt.S
new file mode 100644
index 0000000..2c92412
--- /dev/null
+++ b/isa/rv32mi/shamt.S
@@ -0,0 +1,43 @@
+# See LICENSE for license details.
+
+#*****************************************************************************
+# csr.S
+#-----------------------------------------------------------------------------
+#
+# Test CSRRx and CSRRxI instructions.
+#
+
+#include "riscv_test.h"
+#include "test_macros.h"
+
+RVTEST_RV32M
+RVTEST_CODE_BEGIN
+
+ # Make sure slli with shamt[4] set is legal.
+ TEST_CASE( 2, a0, 65536, li a0, 1; slli a0, a0, 16);
+
+ # Make sure slli with shamt[5] set is not legal.
+ TEST_CASE( 3, x0, 1, slli a0, a0, 32);
+
+ TEST_PASSFAIL
+
+mtvec_handler:
+ # Trapping on test 3 is good.
+ # Note that since the test didn't complete, TESTNUM is smaller by 1.
+ li t0, 2
+ bne TESTNUM, t0, fail
+
+ # Make sure CAUSE indicates an illegal instructino.
+ csrr t0, mcause
+ li t1, CAUSE_ILLEGAL_INSTRUCTION
+ bne t0, t1, fail
+ j pass
+
+RVTEST_CODE_END
+
+ .data
+RVTEST_DATA_BEGIN
+
+ TEST_DATA
+
+RVTEST_DATA_END