From 99de083894843f8d75b243569c92a6e5aaa1db8f Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sat, 17 Apr 2021 23:14:56 +0200 Subject: [PATCH] minor instruction fixes such as added assertions --- riscemu/CPU.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/riscemu/CPU.py b/riscemu/CPU.py index efbec9a..5f43cf9 100644 --- a/riscemu/CPU.py +++ b/riscemu/CPU.py @@ -102,7 +102,7 @@ class CPU: reg = ins.get_reg(1) imm = ins.get_imm(2) addr = self.regs.get(reg) + imm - self.mmu.write(addr, 4, int_to_bytes(self.regs.get(reg), 4)) + self.mmu.write(addr, 4, int_to_bytes(self.regs.get(src), 4)) def instruction_sll(self, ins: 'LoadedInstruction'): INS_NOT_IMPLEMENTED(ins) @@ -123,6 +123,7 @@ class CPU: INS_NOT_IMPLEMENTED(ins) def instruction_add(self, ins: 'LoadedInstruction'): + ASSERT_LEN(ins.args, 3) dst = ins.get_reg(0) src1 = ins.get_reg(1) src2 = ins.get_reg(2) @@ -142,7 +143,6 @@ class CPU: ) def instruction_sub(self, ins: 'LoadedInstruction'): - INS_NOT_IMPLEMENTED(ins) def instruction_lui(self, ins: 'LoadedInstruction'):