From 6312493089c8325fa6097fa7d77046bde7e75f2a Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Sun, 17 Mar 2019 18:53:02 +0100 Subject: Show corresponding memory word address in the cacheview. Signed-off-by: Pavel Pisa --- qtmips_gui/cacheview.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'qtmips_gui/cacheview.cpp') diff --git a/qtmips_gui/cacheview.cpp b/qtmips_gui/cacheview.cpp index b0fdb9a..23b5557 100644 --- a/qtmips_gui/cacheview.cpp +++ b/qtmips_gui/cacheview.cpp @@ -49,6 +49,8 @@ using namespace std; CacheAddressBlock::CacheAddressBlock(const machine::Cache *cache, unsigned width) { + rows = cache->config().sets(); + columns = cache->config().blocks(); s_row = cache->config().sets() > 1 ? sqrt(cache->config().sets()) : 0; this->width = width; s_col = cache->config().blocks() > 1 ? sqrt(cache->config().blocks()) : 0; @@ -108,6 +110,8 @@ void CacheAddressBlock::paint(QPainter *painter, const QStyleOptionGraphicsItem // Pain address label painter->drawText(QRectF(5, 0, wpos - 5, 14), Qt::AlignCenter, "Address"); + std::uint32_t addr = (((tag * rows) + row) * columns + col) * 4; + painter->drawText(QRectF(50, 0, wpos + 40, 14), Qt::AlignCenter, "0x" + QString("%1").arg(addr, 8, 16, QChar('0'))); QPen p; p.setWidth(2); @@ -343,6 +347,7 @@ void CacheViewBlock::cache_update(unsigned associat, unsigned set, unsigned col, if (associat != block) { if (last_highlighted) this->data[last_set][last_col]->setBrush(QBrush(QColor(0, 0, 0))); + last_highlighted = false; return; // Ignore blocks that are not us } validity[set]->setText(valid ? "1" : "0"); -- cgit v1.2.3