From 0d7da86ea5e5187dca2e843549c33f761e35f068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 25 Nov 2017 16:39:10 +0100 Subject: Add crude implementation of MOV* instructions I don't like how it's implemented but I have no other idea atm. --- qtmips_machine/alu.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'qtmips_machine/alu.cpp') diff --git a/qtmips_machine/alu.cpp b/qtmips_machine/alu.cpp index 07e174e..8be9f2a 100644 --- a/qtmips_machine/alu.cpp +++ b/qtmips_machine/alu.cpp @@ -17,6 +17,12 @@ std::uint32_t alu_operate(enum AluOp operation, std::uint32_t s, std::uint32_t t case ALU_OP_SRAV: // TODO is this correct implementation? (Should we be masking top most bit?) return ((t & 0x7fffffff) >> s) | (t & 0x80000000); + case ALU_OP_MOVZ: + // We do this just to implement valid alu operation but we have to evaluate comparison way before this to disable register write + return t == 0 ? s : 0; + case ALU_OP_MOVN: + // Same note as for MOVZ applies here + return t != 0 ? s : 0; case ALU_OP_MFHI: return regs->read_hi_lo(true); case ALU_OP_MTHI: -- cgit v1.2.3