WHY WAS I USING S-TYPE IMMEDIATE IN LD (also add some more debugging info on an exception)
This commit is contained in:
@@ -64,6 +64,7 @@ impl Core {
|
||||
InstructionResult::Normal => {}
|
||||
InstructionResult::Exception(_e) => {
|
||||
eprintln!("Exception from instruction");
|
||||
eprintln!("PC: {:016X}, instr: {:08X}", self.pc, instr.0);
|
||||
break;
|
||||
}
|
||||
InstructionResult::Pause => {
|
||||
|
||||
@@ -62,7 +62,7 @@ pub fn sd(core: &mut Core, instr: Instruction) -> InstructionResult {
|
||||
}
|
||||
|
||||
pub fn ld(core: &mut Core, instr: Instruction) -> InstructionResult {
|
||||
let addr = core.reg_read(instr.rs1()).wrapping_add(instr.imm_s());
|
||||
let addr = core.reg_read(instr.rs1()).wrapping_add(instr.imm_i());
|
||||
|
||||
if !addr.is_multiple_of(std::mem::size_of::<DWord>() as Addr) {
|
||||
return InstructionResult::Exception(());
|
||||
|
||||
Reference in New Issue
Block a user