aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/cachedock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui/cachedock.cpp')
-rw-r--r--qtmips_gui/cachedock.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/qtmips_gui/cachedock.cpp b/qtmips_gui/cachedock.cpp
index eb96e06..79097b3 100644
--- a/qtmips_gui/cachedock.cpp
+++ b/qtmips_gui/cachedock.cpp
@@ -18,7 +18,10 @@ CacheDock::CacheDock(QWidget *parent, const QString &type) : QDockWidget(parent)
l_miss = new QLabel("0", top_form);
layout_top_form->addRow("Miss:", l_miss);
- // TODO cache view
+ graphicsview = new GraphicsView(top_widget);
+ graphicsview->setVisible(false);
+ layout_box->addWidget(graphicsview);
+ cachescene = nullptr;
setObjectName(type + "Cache");
setWindowTitle(type + " Cache");
@@ -27,12 +30,18 @@ CacheDock::CacheDock(QWidget *parent, const QString &type) : QDockWidget(parent)
void CacheDock::setup(const machine::Cache *cache) {
l_hit->setText("0");
l_miss->setText("0");
- if (cache) {
+ if (cache->config().enabled()) {
connect(cache, SIGNAL(hit_update(uint)), this, SLOT(hit_update(uint)));
connect(cache, SIGNAL(miss_update(uint)), this, SLOT(miss_update(uint)));
}
- top_form->setVisible((bool)cache);
- no_cache->setVisible(!(bool)cache);
+ top_form->setVisible(cache->config().enabled());
+ no_cache->setVisible(!cache->config().enabled());
+
+ if (cachescene)
+ delete cachescene;
+ cachescene = new CacheViewScene(cache);
+ graphicsview->setScene(cachescene);
+ graphicsview->setVisible(cache->config().enabled());
}
void CacheDock::hit_update(unsigned val) {