-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2896 from o1-labs/dw/test-addi-overflow
o1vm/riscv32im: test for addi with overflow
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.section .text | ||
.globl _start | ||
|
||
_start: | ||
li t0, 2147483647 # t0 = 2147483647 (Max 32-bit signed int) | ||
addi t1, t0, 1 # t1 = t0 + 1 (Expected: overflow to -2147483648) | ||
|
||
li t2, -2147483648 # t2 = -2147483648 (Min 32-bit signed int) | ||
addi t3, t2, -1 # t3 = t2 + (-1) (Expected: overflow to 2147483647) | ||
|
||
li t4, 123456789 # t4 = 123456789 | ||
addi t5, t4, 0 # t5 = t4 + 0 (Expected: t4 = 123456789) | ||
|
||
# Custom exit syscall | ||
li a0, 0 | ||
li a1, 0 | ||
li a2, 0 | ||
li a3, 0 | ||
li a4, 0 | ||
li a5, 0 | ||
li a6, 0 | ||
li a7, 42 | ||
ecall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters