diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-03-17 18:53:02 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-03-17 18:53:02 +0100 |
commit | 6312493089c8325fa6097fa7d77046bde7e75f2a (patch) | |
tree | 7dc103fdaa75d2268abba3d22f08d08dde660364 /qtmips_gui | |
parent | f44ecd1e02c0f4760124a95b5019f67d0e77ecb7 (diff) | |
download | qtmips-6312493089c8325fa6097fa7d77046bde7e75f2a.tar.gz qtmips-6312493089c8325fa6097fa7d77046bde7e75f2a.tar.bz2 qtmips-6312493089c8325fa6097fa7d77046bde7e75f2a.zip |
Show corresponding memory word address in the cacheview.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/cacheview.cpp | 5 | ||||
-rw-r--r-- | qtmips_gui/cacheview.h | 1 |
2 files changed, 6 insertions, 0 deletions
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"); diff --git a/qtmips_gui/cacheview.h b/qtmips_gui/cacheview.h index 6803e37..8e7a4fb 100644 --- a/qtmips_gui/cacheview.h +++ b/qtmips_gui/cacheview.h @@ -57,6 +57,7 @@ private slots: std::uint32_t tag, const std::uint32_t *data, bool write); private: + unsigned rows, columns; unsigned tag, row, col; unsigned s_tag, s_row, s_col; unsigned width; |