Add rv32si tests, including illegality of shamt[5]
authorAndrew Waterman <waterman@eecs.berkeley.edu>
Sat, 1 Feb 2014 02:10:35 +0000 (18:10 -0800)
committerAndrew Waterman <waterman@eecs.berkeley.edu>
Sat, 1 Feb 2014 02:10:35 +0000 (18:10 -0800)
env
isa/Makefile
isa/rv32si/Makefrag [new file with mode: 0644]
isa/rv32si/csr.S [new file with mode: 0644]
isa/rv32si/ipi.S [new file with mode: 0644]
isa/rv32si/shamt.S [new file with mode: 0644]
isa/rv32ui/srli.S
isa/rv64si/csr.S

diff --git a/env b/env
index 217bb5eef46deb0eeac7b8f11c9d36d9310feabb..d4959de3364556560c51cda343d04629a0d1cd1f 160000 (submodule)
--- a/env
+++ b/env
@@ -1 +1 @@
-Subproject commit 217bb5eef46deb0eeac7b8f11c9d36d9310feabb
+Subproject commit d4959de3364556560c51cda343d04629a0d1cd1f
index 1009c278792946df7477d0efc7182659b49c89b3..53c11ad6763ec3f51d5d382d673e3040a4838618 100644 (file)
@@ -10,6 +10,7 @@ include $(isa_src_dir)/rv64uv/Makefrag
 include $(isa_src_dir)/rv64si/Makefrag
 include $(isa_src_dir)/rv64sv/Makefrag
 include $(isa_src_dir)/rv32ui/Makefrag
+include $(isa_src_dir)/rv32si/Makefrag
 
 default: all
 
@@ -69,6 +70,7 @@ tests += $$($(1)_v_vec_tests)
 endef
 
 $(eval $(call compile_template,rv32ui,-m32))
+$(eval $(call compile_template,rv32si,-m32))
 $(eval $(call compile_template,rv64ui))
 $(eval $(call compile_template,rv64uf))
 $(eval $(call compile_template,rv64uv))
diff --git a/isa/rv32si/Makefrag b/isa/rv32si/Makefrag
new file mode 100644 (file)
index 0000000..7ffc060
--- /dev/null
@@ -0,0 +1,15 @@
+#=======================================================================
+# Makefrag for rv32si tests
+#-----------------------------------------------------------------------
+
+rv32si_sc_tests = \
+       csr \
+       shamt \
+
+rv32si_mc_tests = \
+       ipi \
+
+rv32si_p_tests = $(addprefix rv32si-p-, $(rv32si_sc_tests))
+rv32si_pm_tests = $(addprefix rv32si-pm-, $(rv32si_mc_tests))
+
+spike_tests += $(rv32si_p_tests) $(rv32si_pm_tests)
diff --git a/isa/rv32si/csr.S b/isa/rv32si/csr.S
new file mode 100644 (file)
index 0000000..c229b50
--- /dev/null
@@ -0,0 +1,14 @@
+#*****************************************************************************
+# csr.S
+#-----------------------------------------------------------------------------
+#
+# Test CSRRx and CSRRxI instructions.
+#
+
+#include "riscv_test.h"
+#include "test_macros.h"
+
+#undef RVTEST_RV64S
+#define RVTEST_RV64S RVTEST_RV32S
+
+#include "../rv64si/csr.S"
diff --git a/isa/rv32si/ipi.S b/isa/rv32si/ipi.S
new file mode 100644 (file)
index 0000000..4682bee
--- /dev/null
@@ -0,0 +1,14 @@
+#*****************************************************************************
+# ipi.S
+#-----------------------------------------------------------------------------
+#
+# Test interprocessor interrupts.
+#
+
+#include "riscv_test.h"
+#include "test_macros.h"
+
+#undef RVTEST_RV64S
+#define RVTEST_RV64S RVTEST_RV32S
+
+#include "../rv64si/ipi.S"
diff --git a/isa/rv32si/shamt.S b/isa/rv32si/shamt.S
new file mode 100644 (file)
index 0000000..df97287
--- /dev/null
@@ -0,0 +1,44 @@
+#*****************************************************************************
+# csr.S
+#-----------------------------------------------------------------------------
+#
+# Test CSRRx and CSRRxI instructions.
+#
+
+#include "riscv_test.h"
+#include "test_macros.h"
+
+RVTEST_RV32S
+RVTEST_CODE_BEGIN
+
+  la t0, evec
+  csrw evec, t0
+
+  # 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[4] set is not legal.
+  TEST_CASE( 3, x0, 1, slli a0, a0, 32);
+
+  TEST_PASSFAIL
+
+evec:
+  # 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, cause
+  li t1, CAUSE_ILLEGAL_INSTRUCTION
+  bne t0, t1, fail
+  j pass
+
+RVTEST_CODE_END
+
+  .data
+RVTEST_DATA_BEGIN
+
+  TEST_DATA
+
+RVTEST_DATA_END
index 61e01fba0d484cff7e2c1c7ae35a2531361bbcd8..a8ae06d1d757434ddec7bb4cbea414e7028122b3 100644 (file)
@@ -33,15 +33,6 @@ RVTEST_CODE_BEGIN
   TEST_IMM_OP( 15, srli, 0x00008484, 0x21212121, 14 );
   TEST_IMM_OP( 16, srli, 0x00000000, 0x21212121, 31 );
 
-  # Verify that shifts only use bottom five bits
-
-  TEST_IMM_OP( 17, srli, 0x21212121, 0x21212121, 0xffffffc0 );
-  TEST_IMM_OP( 18, srli, 0x10909090, 0x21212121, 0xffffffc1 );
-  TEST_IMM_OP( 19, srli, 0x00424242, 0x21212121, 0xffffffc7 );
-  TEST_IMM_OP( 20, srli, 0x00008484, 0x21212121, 0xffffffce );
-
-
-
   #-------------------------------------------------------------
   # Source/Destination tests
   #-------------------------------------------------------------
index 846a483f56b33c552e9f2b6250c96285260e9a28..389280dd5a9e44fd16ef32b6f5e75cf189bedde1 100644 (file)
@@ -44,7 +44,7 @@ RVTEST_CODE_BEGIN
 
 evec:
   # Trapping on tests 10, 11, and 13 is usually good news.
-  # Note that since the test didn't finished, TESTNUM is smaller by 1.
+  # Note that since the test didn't complete, TESTNUM is smaller by 1.
   li t0, 9
   beq TESTNUM, t0, privileged
   li t0, 10