Skip to content

Commit

Permalink
Merge pull request #1422 from o1-labs/feature/mips/lbu
Browse files Browse the repository at this point in the history
Implement `lbu`
  • Loading branch information
dannywillems authored Dec 6, 2023
2 parents 0313aff + 84af145 commit 59e6903
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 @@ -1076,7 +1076,19 @@ pub fn interpret_itype<Env: InterpreterEnv>(env: &mut Env, instr: ITypeInstructi
// REMOVEME: when all itype instructions are implemented.
return;
}
ITypeInstruction::Load8Unsigned => (),
ITypeInstruction::Load8Unsigned => {
let base = env.read_register(&rs);
let dest = rt;
let offset = env.sign_extend(&immediate, 16);
let addr = base + offset;
let v0 = env.read_memory(&addr);
let value = v0;
env.write_register(&dest, value);
env.set_instruction_pointer(next_instruction_pointer.clone());
env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32));
// REMOVEME: when all itype instructions are implemented.
return;
}
ITypeInstruction::Load16Unsigned => (),
ITypeInstruction::LoadWordLeft => (),
ITypeInstruction::LoadWordRight => (),
Expand Down

0 comments on commit 59e6903

Please sign in to comment.