diff options
Diffstat (limited to 'qtmips_machine')
-rw-r--r-- | qtmips_machine/cache.cpp | 5 | ||||
-rw-r--r-- | qtmips_machine/cache.h | 4 |
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; |