Show cache block "dirty" in tooltip for block
MODIFY
src/cachesim/cachegraphic.cpp
src/cachesim/cachegraphic.cpp
@@ -86,7 +86,11 @@ void CacheGraphic::updateWay(unsigned lineIdx, unsigned wayIdx) {
const auto data = ProcessorHandler::getMemory().readMemConst(addressForBlock);
const QString text = encodeRadixValue(data, Radix::Hex);
blockTextItem->setText(text);
- blockTextItem->setToolTip("Address: " + encodeRadixValue(addressForBlock, Radix::Hex));
+ QString tooltip = "Address: " + encodeRadixValue(addressForBlock, Radix::Hex);
+ if (simWay.dirtyBlocks.count(i)) {
+ tooltip += "\n> Dirty";
+ }
+ blockTextItem->setToolTip(tooltip);
// Store the address within the userrole of the block text. Doing this, we are able to easily retrieve the
// address for the block if the block is clicked.
blockTextItem->setData(Qt::UserRole, addressForBlock);

MODIFY
src/cachesim/cachesim.h
src/cachesim/cachesim.h
@@ -113,6 +113,10 @@ public:
Q_ASSERT(way != s_invalidIndex && "Cache way index is invalid");
Q_ASSERT(block != s_invalidIndex && "Cache block index is invalid");
}
+
+ bool operator==(const CacheIndex& other) const {
+ return this->line == other.line && this->way == other.way && this->block == other.block;
+ }
};
struct CacheTransaction {

Show cache block "dirty" in tooltip for block