♻️ Amend of previous commit

This commit is contained in:
François Autin 2023-03-27 15:01:34 +02:00
parent 288703321e
commit ff93fab832
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C

View File

@ -353,7 +353,6 @@ impl Machine {
self.int_reg.set_reg(rd, val); self.int_reg.set_reg(rd, val);
Ok(()) Ok(())
}; };
match inst.funct3 { match inst.funct3 {
RISCV_LD_LB | RISCV_LD_LBU => set_reg(inst.rd, 1), RISCV_LD_LB | RISCV_LD_LBU => set_reg(inst.rd, 1),
RISCV_LD_LH | RISCV_LD_LHU => set_reg(inst.rd, 2), RISCV_LD_LH | RISCV_LD_LHU => set_reg(inst.rd, 2),
@ -373,7 +372,6 @@ impl Machine {
); );
Ok(()) Ok(())
}; };
match inst.funct3 { match inst.funct3 {
RISCV_ST_STB => store(1), RISCV_ST_STB => store(1),
RISCV_ST_STH => store(2), RISCV_ST_STH => store(2),
@ -402,7 +400,7 @@ impl Machine {
RISCV_OPI_SRI => if inst.funct7_smaller == RISCV_OPI_SRI_SRLI { RISCV_OPI_SRI => if inst.funct7_smaller == RISCV_OPI_SRI_SRLI {
compute(&|a, b| { (a >> b) & self.shiftmask[inst.shamt as usize] as i64 }, rs1, shamt) compute(&|a, b| { (a >> b) & self.shiftmask[inst.shamt as usize] as i64 }, rs1, shamt)
} else { } else {
compute(&|a, b| { a >> b }, rs1, shamt) compute(&core::ops::Shr::shr, rs1, shamt)
} }
_ => Err(MachineError::new(format!("In OPI switch case, this should never happen... Instr was %x\n {}", inst.value).as_str())) _ => Err(MachineError::new(format!("In OPI switch case, this should never happen... Instr was %x\n {}", inst.value).as_str()))
} }