Skip to content

Commit

Permalink
Implement xor
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmr1993 committed Dec 5, 2023
1 parent e8840d6 commit f631d16
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 @@ -798,7 +798,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 f631d16

Please sign in to comment.