Fix addic/addic. handling in relocation tracker

Resolves #57
This commit is contained in:
Luke Street 2024-06-03 18:01:55 -06:00
parent d9770c48b2
commit 53c6d74a6b
1 changed files with 3 additions and 2 deletions

View File

@ -257,7 +257,8 @@ impl VM {
self.gpr[ins.field_ra() as usize],
);
} else {
let left = if ins.field_ra() == 0 && ins.op == Opcode::Addi {
let load_zero = ins.field_ra() == 0 && ins.op == Opcode::Addi;
let left = if load_zero {
GprValue::Constant(0)
} else {
self.gpr[ins.field_ra() as usize].value
@ -271,7 +272,7 @@ impl VM {
),
_ => GprValue::Unknown,
};
if ins.field_ra() == 0 {
if load_zero {
// li rD, SIMM
self.gpr[ins.field_rd() as usize].set_direct(value);
} else {