diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-03 23:03:59 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-03 23:03:59 +0100 |
commit | 361f5aab10d72e2200dfc7985a1511044b987db8 (patch) | |
tree | 02688761a1dc29731c0fc069a2d89205a867a8ef /qtmips_gui | |
parent | 55e1bc746a45118e14554c957b4ee4663039d9af (diff) | |
download | qtmips-361f5aab10d72e2200dfc7985a1511044b987db8.tar.gz qtmips-361f5aab10d72e2200dfc7985a1511044b987db8.tar.bz2 qtmips-361f5aab10d72e2200dfc7985a1511044b987db8.zip |
Correct memory view updates for uncached and write-through case.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/memoryview.cpp | 11 | ||||
-rw-r--r-- | qtmips_gui/memoryview.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/qtmips_gui/memoryview.cpp b/qtmips_gui/memoryview.cpp index 3f5fbc3..1ce02d7 100644 --- a/qtmips_gui/memoryview.cpp +++ b/qtmips_gui/memoryview.cpp @@ -31,6 +31,8 @@ MemoryView::MemoryView(QWidget *parent, std::uint32_t addr0) : QWidget(parent) { void MemoryView::setup(machine::QtMipsMachine *machine) { memory = (machine == nullptr) ? nullptr : machine->memory(); + if (machine != nullptr) + connect(machine, SIGNAL(post_tick()), this, SLOT(check_for_updates())); reload_content(); } @@ -58,9 +60,18 @@ void MemoryView::edit_load_focus() { go_edit->setText(QString("0x%1").arg(focus(), 8, 16, QChar('0'))); } +void MemoryView::check_for_updates() { + if (memory != nullptr) { + if (change_counter != memory->get_change_counter()) + reload_content(); + } +} + void MemoryView::reload_content() { int count = memf->widg->count(); memf->widg->clearRows(); + if (memory != nullptr) + change_counter = memory->get_change_counter(); update_content(count, 0); } diff --git a/qtmips_gui/memoryview.h b/qtmips_gui/memoryview.h index 1aeaf10..7b63d47 100644 --- a/qtmips_gui/memoryview.h +++ b/qtmips_gui/memoryview.h @@ -27,6 +27,9 @@ public: void edit_load_focus(); // Set current focus to edit field +public slots: + void check_for_updates(); + protected: const machine::Memory *memory; @@ -43,6 +46,7 @@ private slots: void go_edit_finish(); private: + std::uint32_t change_counter; unsigned count; std::uint32_t addr_0; // First address in view |