Skip to content

Commit

Permalink
Merge pull request #2838 from o1-labs/sai/shift_right_logical_immedia…
Browse files Browse the repository at this point in the history
…te_riscv32im

implementation for shift right logical immediate riscv32im
  • Loading branch information
dannywillems authored Dec 16, 2024
2 parents 7bb2d62 + 26f96e5 commit 08cfecf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion o1vm/src/interpreters/riscv32im/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,15 @@ pub fn interpret_itype<Env: InterpreterEnv>(env: &mut Env, instr: IInstruction)
env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32));
}
IInstruction::ShiftRightLogicalImmediate => {
unimplemented!("ShiftRightLogicalImmediate")
// srli: x[rd] = x[rs1] >> shamt
let local_rs1 = env.read_register(&rs1);
let local_rd = {
let pos = env.alloc_scratch();
unsafe { env.shift_right(&local_rs1, &shamt, pos) }
};
env.write_register(&rd, local_rd);
env.set_instruction_pointer(next_instruction_pointer.clone());
env.set_next_instruction_pointer(next_instruction_pointer + Env::constant(4u32));
}
IInstruction::ShiftRightArithmeticImmediate => {
unimplemented!("ShiftRightArithmeticImmediate")
Expand Down

0 comments on commit 08cfecf

Please sign in to comment.