aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/instructions/arithmetic.h
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-08-30 21:37:53 +0200
committerKarel Kočí <cynerd@email.cz>2017-08-30 21:42:02 +0200
commit9cf92379d5fcf0076c25dae0935daab446c992cd (patch)
treedd09a2e996db1e5a8117f01bec76f1e93eaca6e1 /qtmips_machine/instructions/arithmetic.h
downloadqtmips-9cf92379d5fcf0076c25dae0935daab446c992cd.tar.gz
qtmips-9cf92379d5fcf0076c25dae0935daab446c992cd.tar.bz2
qtmips-9cf92379d5fcf0076c25dae0935daab446c992cd.zip
Initial commit
Adding work done so far.
Diffstat (limited to 'qtmips_machine/instructions/arithmetic.h')
-rw-r--r--qtmips_machine/instructions/arithmetic.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/qtmips_machine/instructions/arithmetic.h b/qtmips_machine/instructions/arithmetic.h
new file mode 100644
index 0000000..29f89d2
--- /dev/null
+++ b/qtmips_machine/instructions/arithmetic.h
@@ -0,0 +1,46 @@
+#ifndef ARITHMETIC_H
+#define ARITHMETIC_H
+
+#include "instruction.h"
+
+enum InstructionArithmeticT {
+ IAT_ADD, // Add
+ IAT_ADDU, // Add unsigned
+ IAT_SUB, // Subtract
+ IAT_SUBU, // Subtract unsigned
+ IAT_AND,
+ IAT_OR,
+ IAT_XOR,
+ IAT_NOR,
+ IAT_SLT, // set on less than
+ IAT_SLTU, // set on less than unsigned
+};
+
+class InstructionArithmetic : public InstructionR {
+public:
+ InstructionArithmetic(enum InstructionArithmeticT type, std::uint8_t rs, std::uint8_t rd, std::uint8_t rt);
+ std::vector<std::string> to_strs();
+private:
+ enum InstructionArithmeticT type;
+};
+
+enum InstructionArithmeticImmediateT {
+ IAT_ADDI,
+ IAT_ADDIU,
+ IAT_ANDI,
+ IAT_ORI,
+ IAT_XORI,
+ IAT_SLTI,
+ IAT_SLTIU,
+ IAT_LUI
+};
+
+class InstructionArithmeticImmediate : public InstructionI {
+public:
+ InstructionArithmeticImmediate(enum InstructionArithmeticImmediateT type, std::uint8_t rs, std::uint8_t rt, std::uint16_t value);
+ std::vector<std::string> to_strs();
+private:
+ enum InstructionArithmeticImmediateT type;
+};
+
+#endif // ARITHMETIC_H