From f631d16de080a67116f653426ed3366f0b5df73b Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 5 Dec 2023 23:38:01 +0000 Subject: [PATCH] Implement `xor` --- optimism/src/mips/interpreter.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/optimism/src/mips/interpreter.rs b/optimism/src/mips/interpreter.rs index 459f0196b3..797d08b320 100644 --- a/optimism/src/mips/interpreter.rs +++ b/optimism/src/mips/interpreter.rs @@ -798,7 +798,19 @@ pub fn interpret_rtype(env: &mut Env, instr: RTypeInstructi env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32)); return; } - RTypeInstruction::Xor => (), + RTypeInstruction::Xor => { + let rs = env.read_register(&rs); + let rt = env.read_register(&rt); + let res = { + // FIXME: Constrain + let pos = env.alloc_scratch(); + unsafe { env.xor_witness(&rs, &rt, pos) } + }; + env.write_register(&rd, res); + env.set_instruction_pointer(next_instruction_pointer.clone()); + env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32)); + return; + } RTypeInstruction::Nor => (), RTypeInstruction::SetLessThan => { let rs = env.read_register(&rs);