Skip to content

Commit

Permalink
Merge pull request #1418 from o1-labs/feature/mips/sb
Browse files Browse the repository at this point in the history
Implement `sb`
  • Loading branch information
dannywillems authored Dec 6, 2023
2 parents 876f876 + 7932741 commit afd8b12
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion optimism/src/mips/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,21 @@ pub fn interpret_itype<Env: InterpreterEnv>(env: &mut Env, instr: ITypeInstructi
ITypeInstruction::Load16Unsigned => (),
ITypeInstruction::LoadWordLeft => (),
ITypeInstruction::LoadWordRight => (),
ITypeInstruction::Store8 => (),
ITypeInstruction::Store8 => {
let base = env.read_register(&rs);
let offset = env.sign_extend(&immediate, 16);
let addr = base.clone() + offset.clone();
let value = env.read_register(&rt);
let v0 = {
// FIXME: Requires a range check
let pos = env.alloc_scratch();
unsafe { env.bitmask(&value, 8, 0, pos) }
};
env.write_memory(&addr, v0);
env.set_instruction_pointer(next_instruction_pointer.clone());
env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32));
return;
}
ITypeInstruction::Store16 => (),
ITypeInstruction::Store32 => {
let base = env.read_register(&rs);
Expand Down

0 comments on commit afd8b12

Please sign in to comment.