Skip to content

Commit

Permalink
Merge pull request #1423 from o1-labs/feature/mips/xor
Browse files Browse the repository at this point in the history
Implement `xor`
  • Loading branch information
dannywillems authored Dec 6, 2023
2 parents 59e6903 + be844c0 commit 55d4cc4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion optimism/src/mips/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,19 @@ pub fn interpret_rtype<Env: InterpreterEnv>(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);
Expand Down

0 comments on commit 55d4cc4

Please sign in to comment.