aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/instructions
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_machine/instructions')
-rw-r--r--qtmips_machine/instructions/arithmetic.cpp9
-rw-r--r--qtmips_machine/instructions/arithmetic.h4
-rw-r--r--qtmips_machine/instructions/jumpbranch.cpp8
-rw-r--r--qtmips_machine/instructions/jumpbranch.h6
-rw-r--r--qtmips_machine/instructions/loadstore.cpp8
-rw-r--r--qtmips_machine/instructions/loadstore.h4
-rw-r--r--qtmips_machine/instructions/nop.cpp6
-rw-r--r--qtmips_machine/instructions/nop.h2
-rw-r--r--qtmips_machine/instructions/shift.cpp8
-rw-r--r--qtmips_machine/instructions/shift.h4
10 files changed, 29 insertions, 30 deletions
diff --git a/qtmips_machine/instructions/arithmetic.cpp b/qtmips_machine/instructions/arithmetic.cpp
index 8c8f40e..a620436 100644
--- a/qtmips_machine/instructions/arithmetic.cpp
+++ b/qtmips_machine/instructions/arithmetic.cpp
@@ -1,13 +1,12 @@
#include "instructions/arithmetic.h"
-#include <iostream>
InstructionArithmetic::InstructionArithmetic(enum InstructionArithmeticT type, std::uint8_t rs, std::uint8_t rd, std::uint8_t rt)
: InstructionR(rs, rd, rt, 0) {
this->type = type;
}
-std::vector<std::string> InstructionArithmetic::to_strs() {
- std::vector<std::string> str = this->InstructionR::to_strs();
+QVector<QString> InstructionArithmetic::to_strs() {
+ QVector<QString> str = this->InstructionR::to_strs();
str.erase(str.begin() + 4); // Drop sa field
switch (this->type) {
case IAT_ADD:
@@ -52,8 +51,8 @@ InstructionArithmeticImmediate::InstructionArithmeticImmediate(enum InstructionA
this->type = type;
}
-std::vector<std::string> InstructionArithmeticImmediate::to_strs() {
- std::vector<std::string> str = this->InstructionI::to_strs();
+QVector<QString> InstructionArithmeticImmediate::to_strs() {
+ QVector<QString> str = this->InstructionI::to_strs();
switch (this->type) {
case IAT_ADDI:
str[0] = "addi";
diff --git a/qtmips_machine/instructions/arithmetic.h b/qtmips_machine/instructions/arithmetic.h
index 29f89d2..19f1df5 100644
--- a/qtmips_machine/instructions/arithmetic.h
+++ b/qtmips_machine/instructions/arithmetic.h
@@ -19,7 +19,7 @@ enum InstructionArithmeticT {
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();
+ QVector<QString> to_strs();
private:
enum InstructionArithmeticT type;
};
@@ -38,7 +38,7 @@ enum InstructionArithmeticImmediateT {
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();
+ QVector<QString> to_strs();
private:
enum InstructionArithmeticImmediateT type;
};
diff --git a/qtmips_machine/instructions/jumpbranch.cpp b/qtmips_machine/instructions/jumpbranch.cpp
index 2ede399..6579c2b 100644
--- a/qtmips_machine/instructions/jumpbranch.cpp
+++ b/qtmips_machine/instructions/jumpbranch.cpp
@@ -5,8 +5,8 @@ InstructionJump::InstructionJump(bool link, std::uint32_t address)
this->link = link;
}
-std::vector<std::string> InstructionJump::to_strs() {
- std::vector<std::string> str = this->InstructionJ::to_strs();
+QVector<QString> InstructionJump::to_strs() {
+ QVector<QString> str = this->InstructionJ::to_strs();
if (link)
str[0] = "j";
else
@@ -19,8 +19,8 @@ InstructionJumpRegister::InstructionJumpRegister(bool link, std::uint8_t rs)
this->link = link;
}
-std::vector<std::string> InstructionJumpRegister::to_strs() {
- std::vector<std::string> str = this->InstructionR::to_strs();
+QVector<QString> InstructionJumpRegister::to_strs() {
+ QVector<QString> str = this->InstructionR::to_strs();
str.erase(str.begin() + 2, str.end()); // Drop every field after rs
if (link)
str[0] = "j";
diff --git a/qtmips_machine/instructions/jumpbranch.h b/qtmips_machine/instructions/jumpbranch.h
index b8dee5c..762ad95 100644
--- a/qtmips_machine/instructions/jumpbranch.h
+++ b/qtmips_machine/instructions/jumpbranch.h
@@ -6,7 +6,7 @@
class InstructionJump : InstructionJ {
public:
InstructionJump(bool link, std::uint32_t address);
- std::vector<std::string> to_strs();
+ QVector<QString> to_strs();
private:
bool link;
};
@@ -14,7 +14,7 @@ private:
class InstructionJumpRegister : InstructionR {
public:
InstructionJumpRegister(bool link, std::uint8_t rs);
- std::vector<std::string> to_strs();
+ QVector<QString> to_strs();
private:
bool link;
};
@@ -26,7 +26,7 @@ enum InstructionBranchT {
class InstructionBranch : InstructionI {
public:
InstructionBranch();
- std::vector<std::string> to_strs();
+ QVector<QString> to_strs();
private:
// TODO
};
diff --git a/qtmips_machine/instructions/loadstore.cpp b/qtmips_machine/instructions/loadstore.cpp
index c83eae4..27c6402 100644
--- a/qtmips_machine/instructions/loadstore.cpp
+++ b/qtmips_machine/instructions/loadstore.cpp
@@ -5,8 +5,8 @@ InstructionLoad::InstructionLoad(enum InstructionLoadStoreT type, std::uint8_t r
this->type = type;
}
-std::vector<std::string> InstructionLoad::to_strs() {
- std::vector<std::string> str = this->InstructionI::to_strs();
+QVector<QString> InstructionLoad::to_strs() {
+ QVector<QString> str = this->InstructionI::to_strs();
switch (this->type) {
case ILST_B:
str[0] = "lb";
@@ -41,8 +41,8 @@ InstructionStore::InstructionStore(enum InstructionLoadStoreT type, std::uint8_t
this->type = type;
}
-std::vector<std::string> InstructionStore::to_strs() {
- std::vector<std::string> str = this->InstructionI::to_strs();
+QVector<QString> InstructionStore::to_strs() {
+ QVector<QString> str = this->InstructionI::to_strs();
switch (this->type) {
case ILST_B:
str[0] = "sb";
diff --git a/qtmips_machine/instructions/loadstore.h b/qtmips_machine/instructions/loadstore.h
index 9741bd7..6f028fd 100644
--- a/qtmips_machine/instructions/loadstore.h
+++ b/qtmips_machine/instructions/loadstore.h
@@ -16,7 +16,7 @@ enum InstructionLoadStoreT {
class InstructionLoad : public InstructionI {
public:
InstructionLoad(enum InstructionLoadStoreT type, std::uint8_t rs, std::uint8_t rt, std::uint16_t offset);
- std::vector<std::string> to_strs();
+ QVector<QString> to_strs();
private:
enum InstructionLoadStoreT type;
};
@@ -24,7 +24,7 @@ private:
class InstructionStore : public InstructionI {
public:
InstructionStore(enum InstructionLoadStoreT type, std::uint8_t rs, std::uint8_t rt, std::uint16_t offset);
- std::vector<std::string> to_strs();
+ QVector<QString> to_strs();
private:
enum InstructionLoadStoreT type;
};
diff --git a/qtmips_machine/instructions/nop.cpp b/qtmips_machine/instructions/nop.cpp
index 5fd5e47..7623dff 100644
--- a/qtmips_machine/instructions/nop.cpp
+++ b/qtmips_machine/instructions/nop.cpp
@@ -1,7 +1,7 @@
#include "nop.h"
-std::vector<std::string> InstructionNop::to_strs() {
- std::vector<std::string> str;
- str.push_back("nop");
+QVector<QString> InstructionNop::to_strs() {
+ QVector<QString> str;
+ str << QString("nop");
return str;
}
diff --git a/qtmips_machine/instructions/nop.h b/qtmips_machine/instructions/nop.h
index b098b11..5c019fd 100644
--- a/qtmips_machine/instructions/nop.h
+++ b/qtmips_machine/instructions/nop.h
@@ -5,7 +5,7 @@
class InstructionNop : public Instruction {
public:
- std::vector<std::string> to_strs();
+ QVector<QString> to_strs();
};
#endif // NOP_H
diff --git a/qtmips_machine/instructions/shift.cpp b/qtmips_machine/instructions/shift.cpp
index a8c6e41..34bc1c9 100644
--- a/qtmips_machine/instructions/shift.cpp
+++ b/qtmips_machine/instructions/shift.cpp
@@ -5,8 +5,8 @@ InstructionShift::InstructionShift(enum InstructionShiftT type, std::uint8_t rt,
this->type = type;
}
-std::vector<std::string> InstructionShift::to_strs() {
- std::vector<std::string> str = this->InstructionR::to_strs();
+QVector<QString> InstructionShift::to_strs() {
+ QVector<QString> str = this->InstructionR::to_strs();
str.erase(str.begin() + 1); // Drop rs field
switch (this->type) {
case IST_LL:
@@ -30,8 +30,8 @@ InstructionShiftVariable::InstructionShiftVariable(enum InstructionShiftT type,
this->type = type;
}
-std::vector<std::string> InstructionShiftVariable::to_strs() {
- std::vector<std::string> str = this->InstructionR::to_strs();
+QVector<QString> InstructionShiftVariable::to_strs() {
+ QVector<QString> str = this->InstructionR::to_strs();
str.erase(str.begin() + 4); // Drop sa field
switch (this->type) {
case IST_LL:
diff --git a/qtmips_machine/instructions/shift.h b/qtmips_machine/instructions/shift.h
index 9ce29e0..69e2e1e 100644
--- a/qtmips_machine/instructions/shift.h
+++ b/qtmips_machine/instructions/shift.h
@@ -12,7 +12,7 @@ enum InstructionShiftT {
class InstructionShift : public InstructionR {
public:
InstructionShift(enum InstructionShiftT type, std::uint8_t rt, std::uint8_t rd, std::uint8_t sa);
- std::vector<std::string> to_strs();
+ QVector<QString> to_strs();
private:
enum InstructionShiftT type;
};
@@ -20,7 +20,7 @@ private:
class InstructionShiftVariable : public InstructionR {
public:
InstructionShiftVariable(enum InstructionShiftT type, std::uint8_t rs, std::uint8_t rt, std::uint8_t rd);
- std::vector<std::string> to_strs();
+ QVector<QString> to_strs();
private:
enum InstructionShiftT type;
};