aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/registers.cpp
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-09-02 15:34:07 +0200
committerKarel Kočí <cynerd@email.cz>2017-09-02 15:34:07 +0200
commit375607d9969896c894fa2642ce4a0b8b519a2adb (patch)
treecb947a843d85f1cd278da15cff432c849986166c /qtmips_machine/registers.cpp
parent82884b3ef726889f837542d2b5e98e2cd8246c00 (diff)
downloadqtmips-375607d9969896c894fa2642ce4a0b8b519a2adb.tar.gz
qtmips-375607d9969896c894fa2642ce4a0b8b519a2adb.tar.bz2
qtmips-375607d9969896c894fa2642ce4a0b8b519a2adb.zip
Use QString and QVector instead of std ones and more
Diffstat (limited to 'qtmips_machine/registers.cpp')
-rw-r--r--qtmips_machine/registers.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/qtmips_machine/registers.cpp b/qtmips_machine/registers.cpp
index 514987a..837f403 100644
--- a/qtmips_machine/registers.cpp
+++ b/qtmips_machine/registers.cpp
@@ -1,6 +1,5 @@
#include "registers.h"
#include "qtmipsexception.h"
-#include "utils.h"
// TODO should this be configurable?
//////////////////////////////////////////////////////////////////////////////
@@ -26,26 +25,26 @@ std::uint32_t Registers::pc_inc() {
std::uint32_t Registers::pc_jmp(std::int32_t offset) {
if (offset % 4)
- throw QTMIPS_EXCEPTION(UnalignedJump, "Trying to jump by unaligned offset", to_string_hex(offset));
+ throw QTMIPS_EXCEPTION(UnalignedJump, "Trying to jump by unaligned offset", QString::number(offset, 16));
this->pc += offset;
return this->pc;
}
void Registers::pc_abs_jmp(std::uint32_t address) {
if (address % 4)
- throw QTMIPS_EXCEPTION(UnalignedJump, "Trying to jump to unaligned address", to_string_hex(address));
+ throw QTMIPS_EXCEPTION(UnalignedJump, "Trying to jump to unaligned address", QString::number(address, 16));
this->pc = address;
}
std::uint32_t Registers::read_gp(std::uint8_t i) {
- SANITY_ASSERT(i < 32, std::string("Trying to read from register ") + std::to_string(i));
+ SANITY_ASSERT(i < 32, QString("Trying to read from register ") + QString(i));
if (!i) // $0 always reads as 0
return 0;
return this->gp[i - 1];
}
void Registers::write_gp(std::uint8_t i, std::uint32_t value) {
- SANITY_ASSERT(i < 32, std::string("Trying to write to register ") + std::to_string(i));
+ SANITY_ASSERT(i < 32, QString("Trying to write to register ") + QString(i));
if (i == 0) // Skip write to $0
return;
this->gp[i - 1] = value;