aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/instruction.h
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-09-05 00:31:13 +0200
committerKarel Kočí <cynerd@email.cz>2017-09-05 00:31:13 +0200
commit04ea2670be26291a17808bd704ce3549795953a0 (patch)
tree3beb72850745b014eb3ed5eb2e88bfe565c8d2df /qtmips_machine/instruction.h
parentccf2283819a631cec62ceaec233ee845f28d59d8 (diff)
downloadqtmips-04ea2670be26291a17808bd704ce3549795953a0.tar.gz
qtmips-04ea2670be26291a17808bd704ce3549795953a0.tar.bz2
qtmips-04ea2670be26291a17808bd704ce3549795953a0.zip
Add some more instructions to be decoded and arithmetic I test
Diffstat (limited to 'qtmips_machine/instruction.h')
-rw-r--r--qtmips_machine/instruction.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/qtmips_machine/instruction.h b/qtmips_machine/instruction.h
index 99a3ba4..8c5ede9 100644
--- a/qtmips_machine/instruction.h
+++ b/qtmips_machine/instruction.h
@@ -6,15 +6,32 @@
#include "registers.h"
#include "memory.h"
+enum InstructionState {
+ IS_FETCH,
+ IS_DECODE,
+ IS_EXECUTE,
+ IS_MEMORY,
+ IS_WRITE_BACK,
+};
+
class Instruction {
public:
- // TODO return types should be according to what instruction can pass from this stage
- //virtual void decode(Registers *regs) = 0; // Read and prepare instructions
- //virtual void execute() = 0; // ALU operations
- //virtual void memory(Memory *mem) = 0; // Read or write to memory
- //virtual void write_back(Registers *regs) = 0; // Write results to registers
+ Instruction();
+
+ // TODO return some info for forwarding, stall, flush
+ virtual void decode(Registers *regs); // Read and prepare instructions
+ virtual void execute(); // ALU operations
+ virtual void memory(Memory *mem); // Read or write to memory
+ virtual void write_back(Registers *regs); // Write results to registers
+
+ enum InstructionState state();
+ bool running();
+ bool done();
virtual QVector<QString> to_strs() = 0; // Returns all fields of instructions in string
+
+private:
+ enum InstructionState st;
};
class InstructionR : public Instruction {