From 5a6e53b6e6e3675350b1402a6f4c5df0febbc548 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 23 Dec 2024 16:08:39 +0100 Subject: [PATCH] o1vm/riscv32im: add tests for XOR --- o1vm/resources/programs/riscv32im/bin/xor | Bin 0 -> 480 bytes o1vm/resources/programs/riscv32im/src/xor.S | 30 ++++++++++++++++++++ o1vm/tests/test_riscv_elf.rs | 18 ++++++++++++ 3 files changed, 48 insertions(+) create mode 100755 o1vm/resources/programs/riscv32im/bin/xor create mode 100644 o1vm/resources/programs/riscv32im/src/xor.S diff --git a/o1vm/resources/programs/riscv32im/bin/xor b/o1vm/resources/programs/riscv32im/bin/xor new file mode 100755 index 0000000000000000000000000000000000000000..2a9f659899027a72af0500893945a842b8b65dc4 GIT binary patch literal 480 zcma)2J5Iwu6r6PkL_!LnEoqQws4QaV08oG^kZ7o}*2WQ*Vz72M5lX`$d;#BqmI5jF z;0%$t0P}1dTAnp;<~`5)GjCV7*Geh$72q2(dG;y!g2N7ZiW3AlqaN@=_0b<7C%;;J za#qk)H;Gp;l;t5%2cOV`2Jh<>dfcEM1M%ILst-22w?Vv4plPlNy-Oza9+}W1@~8::create(PAGE_SIZE.try_into().unwrap(), state); + + while !witness.halt { + witness.step(); + } + + assert_eq!(witness.registers[T2], 0b0110); // Result: t2 = 0b0110 + assert_eq!(witness.registers[T5], 0b1010); // Result: t5 = 0b1010 + assert_eq!(witness.registers[T1], 0); // Result: t1 = 0 +}