diff --git a/o1vm/resources/programs/riscv32im/bin/addi_negative b/o1vm/resources/programs/riscv32im/bin/addi_negative index f610f7df86..5d3eca47c2 100755 Binary files a/o1vm/resources/programs/riscv32im/bin/addi_negative and b/o1vm/resources/programs/riscv32im/bin/addi_negative differ diff --git a/o1vm/resources/programs/riscv32im/src/addi_negative.S b/o1vm/resources/programs/riscv32im/src/addi_negative.S index 5ef1bfda36..1b94dfb420 100644 --- a/o1vm/resources/programs/riscv32im/src/addi_negative.S +++ b/o1vm/resources/programs/riscv32im/src/addi_negative.S @@ -10,6 +10,9 @@ _start: # Subtract 100 using addi (addi with negative immediate) addi t2, t1, -100 # t2 = t1 + (-100) (Expected: t2 = -50) + li t3, -1000 # t3 = -1000 + addi t4, t3, -500 # t4 = t0 + (-500) (Expected: t4 = -1500) + # Custom exit syscall li a0, 0 li a1, 0 diff --git a/o1vm/tests/test_riscv_elf.rs b/o1vm/tests/test_riscv_elf.rs index 53ecaa692f..a1bc903794 100644 --- a/o1vm/tests/test_riscv_elf.rs +++ b/o1vm/tests/test_riscv_elf.rs @@ -195,6 +195,8 @@ fn test_addi_negative() { assert_eq!(witness.registers[T0], 100); assert_eq!(witness.registers[T1], 50); assert_eq!(witness.registers[T2], (-50_i32) as u32); + assert_eq!(witness.registers[T3], (-1000_i32) as u32); + assert_eq!(witness.registers[T4], (-1500_i32) as u32); } #[test]