summaryrefslogtreecommitdiffstats
path: root/picorv32/tests/divu.S
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2022-11-24 18:49:44 +0000
committerYann Herklotz <git@yannherklotz.com>2022-11-24 18:49:44 +0000
commit46c49262fc9910ba5ff92e76d567ed2e4446fb41 (patch)
tree5bc1955e8fbf29ea454a0db3db1eaf4955e2ca28 /picorv32/tests/divu.S
parent08cf3d9a31b8acbf679b3c761edc95f3d27f7e2a (diff)
parent3291d86ec38031e191ec1e7e5e8ddfa74b77cb7c (diff)
downloadbutterstick-46c49262fc9910ba5ff92e76d567ed2e4446fb41.tar.gz
butterstick-46c49262fc9910ba5ff92e76d567ed2e4446fb41.zip
Merge commit '3291d86ec38031e191ec1e7e5e8ddfa74b77cb7c' as 'picorv32'
Diffstat (limited to 'picorv32/tests/divu.S')
-rw-r--r--picorv32/tests/divu.S41
1 files changed, 41 insertions, 0 deletions
diff --git a/picorv32/tests/divu.S b/picorv32/tests/divu.S
new file mode 100644
index 0000000..cd348c9
--- /dev/null
+++ b/picorv32/tests/divu.S
@@ -0,0 +1,41 @@
+# See LICENSE for license details.
+
+#*****************************************************************************
+# divu.S
+#-----------------------------------------------------------------------------
+#
+# Test divu instruction.
+#
+
+#include "riscv_test.h"
+#include "test_macros.h"
+
+RVTEST_RV32U
+RVTEST_CODE_BEGIN
+
+ #-------------------------------------------------------------
+ # Arithmetic tests
+ #-------------------------------------------------------------
+
+ TEST_RR_OP( 2, divu, 3, 20, 6 );
+ TEST_RR_OP( 3, divu, 715827879, -20, 6 );
+ TEST_RR_OP( 4, divu, 0, 20, -6 );
+ TEST_RR_OP( 5, divu, 0, -20, -6 );
+
+ TEST_RR_OP( 6, divu, -1<<31, -1<<31, 1 );
+ TEST_RR_OP( 7, divu, 0, -1<<31, -1 );
+
+ TEST_RR_OP( 8, divu, -1, -1<<31, 0 );
+ TEST_RR_OP( 9, divu, -1, 1, 0 );
+ TEST_RR_OP(10, divu, -1, 0, 0 );
+
+ TEST_PASSFAIL
+
+RVTEST_CODE_END
+
+ .data
+RVTEST_DATA_BEGIN
+
+ TEST_DATA
+
+RVTEST_DATA_END