Implement OR
This commit is contained in:
@@ -17,6 +17,7 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Option<Instr
|
|||||||
// OP
|
// OP
|
||||||
(0b0000000, 0b000) => Some(rvi::add(core, instr)),
|
(0b0000000, 0b000) => Some(rvi::add(core, instr)),
|
||||||
(0b0000000, 0b111) => Some(rvi::and(core, instr)),
|
(0b0000000, 0b111) => Some(rvi::and(core, instr)),
|
||||||
|
(0b0000000, 0b110) => Some(rvi::or(core, instr)),
|
||||||
_ => None,
|
_ => None,
|
||||||
},
|
},
|
||||||
0b00100 => match instr.funct3() {
|
0b00100 => match instr.funct3() {
|
||||||
|
|||||||
@@ -52,6 +52,15 @@ pub fn andi(core: &mut Core, instr: Instruction) -> InstructionResult {
|
|||||||
InstructionResult::Normal
|
InstructionResult::Normal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn or(core: &mut Core, instr: Instruction) -> InstructionResult {
|
||||||
|
core.reg_write(
|
||||||
|
instr.rd(),
|
||||||
|
core.reg_read(instr.rs1()) | core.reg_read(instr.rs2()),
|
||||||
|
);
|
||||||
|
core.advance_pc();
|
||||||
|
InstructionResult::Normal
|
||||||
|
}
|
||||||
|
|
||||||
pub fn slli(core: &mut Core, instr: Instruction) -> InstructionResult {
|
pub fn slli(core: &mut Core, instr: Instruction) -> InstructionResult {
|
||||||
core.reg_write(instr.rd(), core.reg_read(instr.rs1()) << instr.imm_shamt());
|
core.reg_write(instr.rd(), core.reg_read(instr.rs1()) << instr.imm_shamt());
|
||||||
core.advance_pc();
|
core.advance_pc();
|
||||||
|
|||||||
Reference in New Issue
Block a user