From e8b703b3ae1043ce12659a3d754681455b7dfd21 Mon Sep 17 00:00:00 2001 From: rileylyman <35509264+rileylyman@users.noreply.github.com> Date: Sat, 5 Jan 2019 11:35:03 -0800 Subject: [PATCH] DIVU should return 0xFFFFFFFF on divide by 0 instead of rs1 --- src/main/kotlin/venus/riscv/insts/divu.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/venus/riscv/insts/divu.kt b/src/main/kotlin/venus/riscv/insts/divu.kt index 9367c3e1..cb7626b7 100644 --- a/src/main/kotlin/venus/riscv/insts/divu.kt +++ b/src/main/kotlin/venus/riscv/insts/divu.kt @@ -10,7 +10,7 @@ val divu = RTypeInstruction( eval32 = { a, b -> val x = a.toLong() shl 32 ushr 32 val y = b.toLong() shl 32 ushr 32 - if (y == 0L) a + if (y == 0L) (-1).toInt() else (x / y).toInt() } )