Force R15 alignment via cpu.set_reg

I've encounted many bugs with instructions that write PC but don't align
it.


Former-commit-id: b6a234564729f83c0b5e8adfa293227299aad4ac
This commit is contained in:
Michel Heily 2019-07-08 00:57:18 +03:00
parent 7e7d2c5208
commit 863838a4a4

View file

@ -116,7 +116,7 @@ impl Core {
pub fn set_reg(&mut self, reg_num: usize, val: u32) {
match reg_num {
0...14 => self.gpr[reg_num] = val,
15 => self.pc = val,
15 => self.pc = val & !1,
_ => panic!("invalid register"),
}
}