aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/core.cpp
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-11-25 16:39:10 +0100
committerKarel Kočí <cynerd@email.cz>2017-11-25 16:39:10 +0100
commit0d7da86ea5e5187dca2e843549c33f761e35f068 (patch)
tree5dd1df523fd7665a78532c52043dac7117cfb23d /qtmips_machine/core.cpp
parent8f6d939e8d0fdec39c53da65cfb89f288d99eb82 (diff)
downloadqtmips-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/core.cpp')
-rw-r--r--qtmips_machine/core.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/qtmips_machine/core.cpp b/qtmips_machine/core.cpp
index 1008886..20c1b74 100644
--- a/qtmips_machine/core.cpp
+++ b/qtmips_machine/core.cpp
@@ -126,8 +126,14 @@ struct Core::dtDecode Core::decode(struct dtFetch dt) {
struct Core::dtExecute Core::execute(struct dtDecode dt) {
// TODO signals
+ // Handle conditional move (we have to change regwrite signal if conditional is not met)
+ // TODO can't we do this some cleaner way?
+ bool regwrite = dt.regwrite;
+ if (dt.inst.opcode() == 0 && ((dt.inst.funct() == 10 && dt.val_rt != 0) || (dt.inst.funct() == 11 && dt.val_rt == 0)))
+ regwrite = false;
+
return {
- .regwrite = dt.regwrite,
+ .regwrite = regwrite,
.rwrite = dt.regd ? dt.inst.rd() : dt.inst.rt(),
.alu_val = alu_operate(dt.aluop, dt.val_rs, dt.alusrc ? dt.inst.immediate() : dt.val_rt, dt.inst.shamt(), regs),
};