Skip to content

Commit

Permalink
MIPS/Store16: add missing constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed Apr 23, 2024
1 parent bb0d63f commit 3575944
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions optimism/src/mips/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,11 @@ pub fn interpret_itype<Env: InterpreterEnv>(env: &mut Env, instr: ITypeInstructi
},
]
};
// Checking that v is the correct decomposition.
{
let res = value - v0.clone() * Env::constant(1 << 8) - v1.clone();
env.is_zero(&res)
};
env.write_memory(&addr, v0);
env.write_memory(&(addr.clone() + Env::constant(1)), v1);
env.set_instruction_pointer(next_instruction_pointer.clone());
Expand Down
4 changes: 2 additions & 2 deletions optimism/src/mips/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ fn test_mips_number_constraints() {
JumpAndLink => assert_num_constraints(&instr, 3),
},
IType(itype) => match itype {
BranchLeqZero | BranchGtZero | BranchLtZero | BranchGeqZero | Store8 | Store16 => {
BranchLeqZero | BranchGtZero | BranchLtZero | BranchGeqZero | Store8 => {
assert_num_constraints(&instr, 0)
}
BranchEq | BranchNeq | Store32 => assert_num_constraints(&instr, 2),
BranchEq | BranchNeq | Store16 | Store32 => assert_num_constraints(&instr, 2),
AddImmediate
| AddImmediateUnsigned
| SetLessThanImmediate
Expand Down

0 comments on commit 3575944

Please sign in to comment.