summaryrefslogtreecommitdiff
path: root/src/mem/cache/tags/fa_lru.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/cache/tags/fa_lru.hh')
-rw-r--r--src/mem/cache/tags/fa_lru.hh30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh
index 98a64577e..e063a6ca1 100644
--- a/src/mem/cache/tags/fa_lru.hh
+++ b/src/mem/cache/tags/fa_lru.hh
@@ -50,6 +50,7 @@
#define __MEM_CACHE_TAGS_FA_LRU_HH__
#include <cstdint>
+#include <functional>
#include <string>
#include <unordered_map>
@@ -240,28 +241,19 @@ class FALRU : public BaseTags
return blk->tag;
}
- /**
- * @todo Implement as in lru. Currently not used
- */
- virtual std::string print() const override { return ""; }
+ void forEachBlk(std::function<void(CacheBlk &)> visitor) override {
+ for (int i = 0; i < numBlocks; i++) {
+ visitor(blks[i]);
+ }
+ }
- /**
- * Visit each block in the tag store and apply a visitor to the
- * block.
- *
- * The visitor should be a function (or object that behaves like a
- * function) that takes a cache block reference as its parameter
- * and returns a bool. A visitor can request the traversal to be
- * stopped by returning false, returning true causes it to be
- * called for the next block in the tag store.
- *
- * \param visitor Visitor to call on each block.
- */
- void forEachBlk(CacheBlkVisitor &visitor) override {
+ bool anyBlk(std::function<bool(CacheBlk &)> visitor) override {
for (int i = 0; i < numBlocks; i++) {
- if (!visitor(blks[i]))
- return;
+ if (visitor(blks[i])) {
+ return true;
+ }
}
+ return false;
}
private: