From 361f5aab10d72e2200dfc7985a1511044b987db8 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Sun, 3 Feb 2019 23:03:59 +0100 Subject: Correct memory view updates for uncached and write-through case. Signed-off-by: Pavel Pisa --- qtmips_gui/memoryview.cpp | 11 +++++++++++ qtmips_gui/memoryview.h | 4 ++++ 2 files changed, 15 insertions(+) (limited to 'qtmips_gui') 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 -- cgit v1.2.3