From 8b5298566773275b5c8423dace3396a325f38541 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Sun, 17 Mar 2019 00:28:01 +0100 Subject: Correct word in block visualization in cache view. The word index (column) has been erroneously used for set index value. Signed-off-by: Pavel Pisa --- qtmips_gui/cacheview.cpp | 15 +++++++++------ qtmips_gui/cacheview.h | 4 ++-- qtmips_machine/cache.cpp | 6 +++--- qtmips_machine/cache.h | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/qtmips_gui/cacheview.cpp b/qtmips_gui/cacheview.cpp index b246102..6eb1bfe 100644 --- a/qtmips_gui/cacheview.cpp +++ b/qtmips_gui/cacheview.cpp @@ -59,7 +59,8 @@ CacheAddressBlock::CacheAddressBlock(const machine::Cache *cache, unsigned width row = 0; col = 0; - connect(cache, SIGNAL(cache_update(uint,uint,bool,bool,std::uint32_t,const std::uint32_t*)), this, SLOT(cache_update(uint,uint,bool,bool,std::uint32_t,const std::uint32_t*))); + connect(cache, SIGNAL(cache_update(uint,uint,uint,bool,bool,std::uint32_t,const std::uint32_t*)), + this, SLOT(cache_update(uint,uint,uint,bool,bool,std::uint32_t,const std::uint32_t*))); } QRectF CacheAddressBlock::boundingRect() const { @@ -130,10 +131,10 @@ void CacheAddressBlock::paint(QPainter *painter, const QStyleOptionGraphicsItem } } -void CacheAddressBlock::cache_update(unsigned associat, unsigned set, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data) { +void CacheAddressBlock::cache_update(unsigned associat, unsigned set, unsigned col, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data) { this->tag = tag; - this->row = 0; // TODO we are missing this information - this->col = set; + this->row = set; + this->col = col; update(); } @@ -207,7 +208,8 @@ CacheViewBlock::CacheViewBlock(const machine::Cache *cache, unsigned block , boo box = l_data->boundingRect(); l_data->setPos(wd + (columns*DATA_WIDTH - box.width())/2 , -1 - box.height()); - connect(cache, SIGNAL(cache_update(uint,uint,bool,bool,std::uint32_t,const std::uint32_t*)), this, SLOT(cache_update(uint,uint,bool,bool,std::uint32_t,const std::uint32_t*))); + connect(cache, SIGNAL(cache_update(uint,uint,uint,bool,bool,std::uint32_t,const std::uint32_t*)), + this, SLOT(cache_update(uint,uint,uint,bool,bool,std::uint32_t,const std::uint32_t*))); } CacheViewBlock::~CacheViewBlock() { @@ -325,7 +327,8 @@ void CacheViewBlock::paint(QPainter *painter, const QStyleOptionGraphicsItem *op } } -void CacheViewBlock::cache_update(unsigned associat, unsigned set, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data) { +void CacheViewBlock::cache_update(unsigned associat, unsigned set, unsigned col, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data) { + (void)col; if (associat != block) 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 6e3a9b7..70e312b 100644 --- a/qtmips_gui/cacheview.h +++ b/qtmips_gui/cacheview.h @@ -53,7 +53,7 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); private slots: - void cache_update(unsigned associat, unsigned set, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data); + void cache_update(unsigned associat, unsigned set, unsigned col, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data); private: unsigned tag, row, col; @@ -72,7 +72,7 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); private slots: - void cache_update(unsigned associat, unsigned set, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data); + void cache_update(unsigned associat, unsigned set, unsigned col, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data); private: bool islast; diff --git a/qtmips_machine/cache.cpp b/qtmips_machine/cache.cpp index 3cc36e2..961ab49 100644 --- a/qtmips_machine/cache.cpp +++ b/qtmips_machine/cache.cpp @@ -179,7 +179,7 @@ void Cache::flush() { for (unsigned st = 0; st < cnf.sets(); st++) if (dt[as][st].valid) { kick(as, st); - emit cache_update(as, st, false, false, 0, 0); + emit cache_update(as, st, 0, false, false, 0, 0); } change_counter++; update_statistics(); @@ -264,7 +264,7 @@ void Cache::reset() { if (cnf.enabled()) { for (unsigned as = 0; as < cnf.associativity(); as++) for (unsigned st = 0; st < cnf.sets(); st++) - emit cache_update(as, st, false, false, 0, 0); + emit cache_update(as, st, 0, false, false, 0, 0); } } @@ -415,7 +415,7 @@ bool Cache::access(std::uint32_t address, std::uint32_t *data, bool write, std:: cd.data[col] = value; } - emit cache_update(indx, row, cd.valid, cd.dirty, cd.tag, cd.data); + emit cache_update(indx, row, col, cd.valid, cd.dirty, cd.tag, cd.data); if (changed) change_counter++; return changed; diff --git a/qtmips_machine/cache.h b/qtmips_machine/cache.h index e15909a..2602f0b 100644 --- a/qtmips_machine/cache.h +++ b/qtmips_machine/cache.h @@ -76,7 +76,7 @@ signals: void hit_update(unsigned) const; void miss_update(unsigned) const; void statistics_update(unsigned stalled_cycles, double speed_improv, double hit_rate) const; - void cache_update(unsigned associat, unsigned set, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data) const; + void cache_update(unsigned associat, unsigned set, unsigned col, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data) const; void memory_writes_update(unsigned) const; void memory_reads_update(unsigned) const; -- cgit v1.2.3