From c1e1059c2fb8d44678b1db08f4ad89351df1398f Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 5 Dec 2023 22:42:33 +0000 Subject: [PATCH] Implement `sltiu` --- optimism/src/mips/interpreter.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/optimism/src/mips/interpreter.rs b/optimism/src/mips/interpreter.rs index e41c976299..f3aa6d6f2a 100644 --- a/optimism/src/mips/interpreter.rs +++ b/optimism/src/mips/interpreter.rs @@ -949,7 +949,19 @@ pub fn interpret_itype(env: &mut Env, instr: ITypeInstructi return; } ITypeInstruction::SetLessThanImmediate => (), - ITypeInstruction::SetLessThanImmediateUnsigned => (), + ITypeInstruction::SetLessThanImmediateUnsigned => { + 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(&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::AndImmediate => (), ITypeInstruction::OrImmediate => (), ITypeInstruction::XorImmediate => {