aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-04-15 10:41:26 +0200
committerKarel Kočí <cynerd@email.cz>2018-04-15 10:41:26 +0200
commit25e85c6eed3c9457568de2d64ebfb32b1edfa0d0 (patch)
treed834962254d1a513bffea6edaa63ec6bbf698ee5 /qtmips_machine
parent69aaf6837c9a1da2fea8961159d574023f0c7a6d (diff)
downloadqtmips-25e85c6eed3c9457568de2d64ebfb32b1edfa0d0.tar.gz
qtmips-25e85c6eed3c9457568de2d64ebfb32b1edfa0d0.tar.bz2
qtmips-25e85c6eed3c9457568de2d64ebfb32b1edfa0d0.zip
Show cache statistics in Memory block in coreview
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/cache.cpp5
-rw-r--r--qtmips_machine/cache.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/qtmips_machine/cache.cpp b/qtmips_machine/cache.cpp
index d699cd6..d8c1fff 100644
--- a/qtmips_machine/cache.cpp
+++ b/qtmips_machine/cache.cpp
@@ -93,6 +93,9 @@ void Cache::reset() {
// Zero hit and miss rate
hitc = 0;
missc = 0;
+ // Trigger signals
+ emit hit_update(hitc);
+ emit miss_update(missc);
}
const MachineConfigCache &Cache::config() const {
@@ -153,8 +156,10 @@ void Cache::access(std::uint32_t address, std::uint32_t **data, bool read) const
// Update statistics and otherwise read from memory
if (cd.valid) {
hitc++;
+ emit hit_update(hitc);
} else {
missc++;
+ emit miss_update(missc);
for (unsigned i = 0; i < cnf.blocks(); i++)
cd.data[i] = mem->rword(base_address(tag, row) + (4*i));
}
diff --git a/qtmips_machine/cache.h b/qtmips_machine/cache.h
index 1882c6c..8321bbf 100644
--- a/qtmips_machine/cache.h
+++ b/qtmips_machine/cache.h
@@ -27,6 +27,10 @@ public:
const MachineConfigCache &config() const;
// TODO getters for cells
+signals:
+ void hit_update(unsigned) const;
+ void miss_update(unsigned) const;
+
private:
MachineConfigCache cnf;
Memory *mem;