Skip to content

Commit

Permalink
Merge pull request #1424 from o1-labs/feature/mips/slti
Browse files Browse the repository at this point in the history
Implement `slti`
  • Loading branch information
dannywillems authored Dec 6, 2023
2 parents 55d4cc4 + 3e91b7a commit 135e0da
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 @@ -1009,7 +1009,19 @@ pub fn interpret_itype<Env: InterpreterEnv>(env: &mut Env, instr: ITypeInstructi
// REMOVEME: when all itype instructions are implemented.
return;
}
ITypeInstruction::SetLessThanImmediate => (),
ITypeInstruction::SetLessThanImmediate => {
let rs = env.read_register(&rs);
let immediate = env.sign_extend(&immediate, 16);
let res = {
// FIXME: Constrain
let pos = env.alloc_scratch();
unsafe { env.test_less_than_signed(&rs, &immediate, pos) }
};
env.write_register(&rt, res);
env.set_instruction_pointer(next_instruction_pointer.clone());
env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32));
return;
}
ITypeInstruction::SetLessThanImmediateUnsigned => {
let rs = env.read_register(&rs);
let immediate = env.sign_extend(&immediate, 16);
Expand Down

0 comments on commit 135e0da

Please sign in to comment.