diff options
author | Karel Kočí <cynerd@email.cz> | 2017-11-25 16:39:10 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-11-25 16:39:10 +0100 |
commit | 0d7da86ea5e5187dca2e843549c33f761e35f068 (patch) | |
tree | 5dd1df523fd7665a78532c52043dac7117cfb23d /qtmips_machine/alu.cpp | |
parent | 8f6d939e8d0fdec39c53da65cfb89f288d99eb82 (diff) | |
download | qtmips-0d7da86ea5e5187dca2e843549c33f761e35f068.tar.gz qtmips-0d7da86ea5e5187dca2e843549c33f761e35f068.tar.bz2 qtmips-0d7da86ea5e5187dca2e843549c33f761e35f068.zip |
Add crude implementation of MOV* instructions
I don't like how it's implemented but I have no other idea atm.
Diffstat (limited to 'qtmips_machine/alu.cpp')
-rw-r--r-- | qtmips_machine/alu.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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: |