aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-17 20:49:22 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-17 20:49:22 +0100
commite26d895762e7a802c4b6c6a970a63309f7d0fdb7 (patch)
treef2ccf9698c8eca31d78fe611963293338326e6c1 /qtmips_machine
parent6312493089c8325fa6097fa7d77046bde7e75f2a (diff)
downloadqtmips-e26d895762e7a802c4b6c6a970a63309f7d0fdb7.tar.gz
qtmips-e26d895762e7a802c4b6c6a970a63309f7d0fdb7.tar.bz2
qtmips-e26d895762e7a802c4b6c6a970a63309f7d0fdb7.zip
Registers and cop0 state updates and reads are visualized by highlights.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/cop0state.cpp5
-rw-r--r--qtmips_machine/cop0state.h1
-rw-r--r--qtmips_machine/registers.cpp14
-rw-r--r--qtmips_machine/registers.h2
4 files changed, 17 insertions, 5 deletions
diff --git a/qtmips_machine/cop0state.cpp b/qtmips_machine/cop0state.cpp
index 35f78d1..1caada1 100644
--- a/qtmips_machine/cop0state.cpp
+++ b/qtmips_machine/cop0state.cpp
@@ -150,7 +150,10 @@ QString Cop0State::cop0reg_name(enum Cop0Registers reg) {
}
std::uint32_t Cop0State::read_cop0reg_default(enum Cop0Registers reg) const {
- return cop0reg[(int)reg];
+ std::uint32_t val;
+ val = cop0reg[(int)reg];
+ emit cop0reg_read(reg, val);
+ return val;
}
void Cop0State::write_cop0reg_default(enum Cop0Registers reg, std::uint32_t value) {
diff --git a/qtmips_machine/cop0state.h b/qtmips_machine/cop0state.h
index 0fd3d3f..a6af9a4 100644
--- a/qtmips_machine/cop0state.h
+++ b/qtmips_machine/cop0state.h
@@ -89,6 +89,7 @@ public:
signals:
void cop0reg_update(enum Cop0Registers reg, std::uint32_t val);
+ void cop0reg_read(enum Cop0Registers reg, std::uint32_t val) const;
public slots:
void set_interrupt_signal(uint irq_num, bool active);
diff --git a/qtmips_machine/registers.cpp b/qtmips_machine/registers.cpp
index fa9731a..ed27ec6 100644
--- a/qtmips_machine/registers.cpp
+++ b/qtmips_machine/registers.cpp
@@ -87,25 +87,31 @@ void Registers::pc_abs_jmp_28(std::uint32_t address) {
}
std::uint32_t Registers::read_gp(std::uint8_t i) const {
+ std::uint32_t value;
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];
+ value = this->gp[i - 1];
+ emit gp_read(i, value);
+ return value;
}
void Registers::write_gp(std::uint8_t i, std::uint32_t value) {
SANITY_ASSERT(i < 32, QString("Trying to write to register ") + QString(i));
if (i == 0) // Skip write to $0
return;
- emit gp_update(i, value);
this->gp[i - 1] = value;
+ emit gp_update(i, value);
}
std::uint32_t Registers::read_hi_lo(bool is_hi) const {
+ std::uint32_t value;
if (is_hi)
- return hi;
+ value = hi;
else
- return lo;
+ value = lo;
+ emit hi_lo_read(is_hi, value);
+ return value;
}
void Registers::write_hi_lo(bool is_hi, std::uint32_t value) {
diff --git a/qtmips_machine/registers.h b/qtmips_machine/registers.h
index a4f7aa8..63aa266 100644
--- a/qtmips_machine/registers.h
+++ b/qtmips_machine/registers.h
@@ -67,6 +67,8 @@ signals:
void pc_update(std::uint32_t val);
void gp_update(std::uint8_t i, std::uint32_t val);
void hi_lo_update(bool hi, std::uint32_t val);
+ void gp_read(std::uint8_t i, std::uint32_t val) const;
+ void hi_lo_read(bool hi, std::uint32_t val) const;
private:
std::uint32_t gp[31]; // general-purpose registers ($0 is intentionally skipped)