diff options
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/memorydock.cpp | 15 | ||||
-rw-r--r-- | qtmips_gui/memoryview.cpp | 13 | ||||
-rw-r--r-- | qtmips_gui/memoryview.h | 2 |
3 files changed, 27 insertions, 3 deletions
diff --git a/qtmips_gui/memorydock.cpp b/qtmips_gui/memorydock.cpp index 7feae4e..86f8f26 100644 --- a/qtmips_gui/memorydock.cpp +++ b/qtmips_gui/memorydock.cpp @@ -54,8 +54,19 @@ QList<QWidget*> DataView::row_widget(std::uint32_t address, QWidget *parent) { l = new QLabel(parent); l->setTextInteractionFlags(Qt::TextSelectableByMouse); l->setFont(f); - if (memory != nullptr) - l->setText(QString("0x") + QString("%1").arg(memory->read_word(address), 8, 16, QChar('0')).toUpper()); + if (memory != nullptr) { + machine::LocationStatus loc_stat = machine::LOCSTAT_NONE; + QString val; + val = QString("0x") + QString("%1").arg(memory->read_word(address), 8, 16, QChar('0')).toUpper(); + if (cache_data != nullptr) { + loc_stat = cache_data->location_status(address); + if (loc_stat & machine::LOCSTAT_DIRTY) + val += " D"; + else if (loc_stat & machine::LOCSTAT_CACHED) + val += " C"; + } + l->setText(val); + } widgs.append(l); return widgs; diff --git a/qtmips_gui/memoryview.cpp b/qtmips_gui/memoryview.cpp index 0457633..c4d022a 100644 --- a/qtmips_gui/memoryview.cpp +++ b/qtmips_gui/memoryview.cpp @@ -48,6 +48,7 @@ MemoryView::MemoryView(QWidget *parent, std::uint32_t addr0) : QWidget(parent) { memory = nullptr; addr_0 = addr0; change_counter = 0; + cache_data_change_counter = 0; layout = new QVBoxLayout(this); @@ -67,6 +68,7 @@ MemoryView::MemoryView(QWidget *parent, std::uint32_t addr0) : QWidget(parent) { void MemoryView::setup(machine::QtMipsMachine *machine) { memory = (machine == nullptr) ? nullptr : machine->memory(); + cache_data = (machine == nullptr) ? nullptr : machine->cache_data(); if (machine != nullptr) connect(machine, SIGNAL(post_tick()), this, SLOT(check_for_updates())); reload_content(); @@ -97,10 +99,17 @@ void MemoryView::edit_load_focus() { } void MemoryView::check_for_updates() { + bool need_update = false; if (memory != nullptr) { if (change_counter != memory->get_change_counter()) - reload_content(); + need_update = true; } + if (cache_data != nullptr) { + if (cache_data_change_counter != cache_data->get_change_counter()) + need_update = true; + } + if (need_update) + reload_content(); } void MemoryView::reload_content() { @@ -108,6 +117,8 @@ void MemoryView::reload_content() { memf->widg->clearRows(); if (memory != nullptr) change_counter = memory->get_change_counter(); + if (cache_data != nullptr) + cache_data_change_counter = cache_data->get_change_counter(); update_content(count, 0); } diff --git a/qtmips_gui/memoryview.h b/qtmips_gui/memoryview.h index 17af34f..f60ac53 100644 --- a/qtmips_gui/memoryview.h +++ b/qtmips_gui/memoryview.h @@ -67,6 +67,7 @@ public slots: protected: const machine::Memory *memory; + const machine::Cache *cache_data; virtual QList<QWidget*> row_widget(std::uint32_t address, QWidget *parent) = 0; @@ -82,6 +83,7 @@ private slots: private: std::uint32_t change_counter; + std::uint32_t cache_data_change_counter; unsigned count; std::uint32_t addr_0; // First address in view |