summaryrefslogtreecommitdiff
path: root/src/mem/cache
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2018-06-07 12:19:27 +0200
committerDaniel Carvalho <odanrc@yahoo.com.br>2018-10-10 18:17:42 +0000
commit86a54d91936b524c0ef0f282959f0fc29bafe7eb (patch)
treee1037f22f3a2867e64b17f3b78b0dcf7c3c62915 /src/mem/cache
parentdd017903991f51e1fa8df8dbc21cbb4a1501c1c1 (diff)
downloadgem5-86a54d91936b524c0ef0f282959f0fc29bafe7eb.tar.xz
mem-cache: Remove Packet dependency in Tags
Decouple Tags from Packets, only extracting the necessary functionality for block insertion. As a side effect, create a new function to update common insertion statistics. Change-Id: I5c58f7c17de3255beee531f72a3fd25a30d74c90 Reviewed-on: https://gem5-review.googlesource.com/c/11098 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/mem/cache')
-rw-r--r--src/mem/cache/base.cc3
-rw-r--r--src/mem/cache/tags/base.cc18
-rw-r--r--src/mem/cache/tags/base.hh10
-rw-r--r--src/mem/cache/tags/base_set_assoc.hh12
-rw-r--r--src/mem/cache/tags/fa_lru.cc6
-rw-r--r--src/mem/cache/tags/fa_lru.hh10
-rw-r--r--src/mem/cache/tags/sector_tags.cc8
-rw-r--r--src/mem/cache/tags/sector_tags.hh10
8 files changed, 47 insertions, 30 deletions
diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc
index a0614100f..6c79fd683 100644
--- a/src/mem/cache/base.cc
+++ b/src/mem/cache/base.cc
@@ -1280,7 +1280,8 @@ BaseCache::allocateBlock(const PacketPtr pkt, PacketList &writebacks)
}
// Insert new block at victimized entry
- tags->insertBlock(pkt, victim);
+ tags->insertBlock(addr, is_secure, pkt->req->masterId(),
+ pkt->req->taskId(), victim);
return victim;
}
diff --git a/src/mem/cache/tags/base.cc b/src/mem/cache/tags/base.cc
index 9548d491a..7f848e0d8 100644
--- a/src/mem/cache/tags/base.cc
+++ b/src/mem/cache/tags/base.cc
@@ -52,7 +52,6 @@
#include "base/types.hh"
#include "mem/cache/base.hh"
-#include "mem/packet.hh"
#include "mem/request.hh"
#include "sim/core.hh"
#include "sim/sim_exit.hh"
@@ -80,25 +79,22 @@ BaseTags::setCache(BaseCache *_cache)
}
void
-BaseTags::insertBlock(const PacketPtr pkt, CacheBlk *blk)
+BaseTags::insertBlock(const Addr addr, const bool is_secure,
+ const int src_master_ID, const uint32_t task_ID,
+ CacheBlk *blk)
{
assert(!blk->isValid());
- // Get address
- Addr addr = pkt->getAddr();
-
// Previous block, if existed, has been removed, and now we have
// to insert the new one
-
// Deal with what we are bringing in
- MasterID master_id = pkt->req->masterId();
- assert(master_id < cache->system->maxMasters());
- occupancies[master_id]++;
+ assert(src_master_ID < cache->system->maxMasters());
+ occupancies[src_master_ID]++;
// Insert block with tag, src master id and task id
- blk->insert(extractTag(addr), pkt->isSecure(), master_id,
- pkt->req->taskId());
+ blk->insert(extractTag(addr), is_secure, src_master_ID, task_ID);
+ // Check if cache warm up is done
if (!warmedUp && tagsInUse.value() >= warmupBound) {
warmedUp = true;
warmupCycle = curTick();
diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh
index 9a9de8cfa..30a7af72c 100644
--- a/src/mem/cache/tags/base.hh
+++ b/src/mem/cache/tags/base.hh
@@ -58,7 +58,6 @@
#include "base/statistics.hh"
#include "base/types.hh"
#include "mem/cache/blk.hh"
-#include "mem/packet.hh"
#include "params/BaseTags.hh"
#include "sim/clocked_object.hh"
@@ -285,10 +284,15 @@ class BaseTags : public ClockedObject
/**
* Insert the new block into the cache and update stats.
*
- * @param pkt Packet holding the address to update
+ * @param addr Address of the block.
+ * @param is_secure Whether the block is in secure space or not.
+ * @param src_master_ID The source requestor ID.
+ * @param task_ID The new task ID.
* @param blk The block to update.
*/
- virtual void insertBlock(const PacketPtr pkt, CacheBlk *blk);
+ virtual void insertBlock(const Addr addr, const bool is_secure,
+ const int src_master_ID, const uint32_t task_ID,
+ CacheBlk *blk);
/**
* Regenerate the block address.
diff --git a/src/mem/cache/tags/base_set_assoc.hh b/src/mem/cache/tags/base_set_assoc.hh
index 8e4657fc1..dc0e04275 100644
--- a/src/mem/cache/tags/base_set_assoc.hh
+++ b/src/mem/cache/tags/base_set_assoc.hh
@@ -60,7 +60,6 @@
#include "mem/cache/replacement_policies/base.hh"
#include "mem/cache/tags/base.hh"
#include "mem/cache/tags/cacheset.hh"
-#include "mem/packet.hh"
#include "params/BaseSetAssoc.hh"
/**
@@ -245,13 +244,18 @@ class BaseSetAssoc : public BaseTags
/**
* Insert the new block into the cache and update replacement data.
*
- * @param pkt Packet holding the address to update
+ * @param addr Address of the block.
+ * @param is_secure Whether the block is in secure space or not.
+ * @param src_master_ID The source requestor ID.
+ * @param task_ID The new task ID.
* @param blk The block to update.
*/
- void insertBlock(const PacketPtr pkt, CacheBlk *blk) override
+ void insertBlock(const Addr addr, const bool is_secure,
+ const int src_master_ID, const uint32_t task_ID,
+ CacheBlk *blk) override
{
// Insert block
- BaseTags::insertBlock(pkt, blk);
+ BaseTags::insertBlock(addr, is_secure, src_master_ID, task_ID, blk);
// Increment tag counter
tagsInUse++;
diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc
index 51f360eb4..1b43e9892 100644
--- a/src/mem/cache/tags/fa_lru.cc
+++ b/src/mem/cache/tags/fa_lru.cc
@@ -208,7 +208,9 @@ FALRU::findVictim(Addr addr, const bool is_secure,
}
void
-FALRU::insertBlock(const PacketPtr pkt, CacheBlk *blk)
+FALRU::insertBlock(const Addr addr, const bool is_secure,
+ const int src_master_ID, const uint32_t task_ID,
+ CacheBlk *blk)
{
FALRUBlk* falruBlk = static_cast<FALRUBlk*>(blk);
@@ -216,7 +218,7 @@ FALRU::insertBlock(const PacketPtr pkt, CacheBlk *blk)
assert(falruBlk->inCachesMask == 0);
// Do common block insertion functionality
- BaseTags::insertBlock(pkt, blk);
+ BaseTags::insertBlock(addr, is_secure, src_master_ID, task_ID, blk);
// Increment tag counter
tagsInUse++;
diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh
index 43e58040f..c8ccc66f3 100644
--- a/src/mem/cache/tags/fa_lru.hh
+++ b/src/mem/cache/tags/fa_lru.hh
@@ -62,7 +62,6 @@
#include "base/types.hh"
#include "mem/cache/blk.hh"
#include "mem/cache/tags/base.hh"
-#include "mem/packet.hh"
#include "params/FALRU.hh"
// Uncomment to enable sanity checks for the FALRU cache and the
@@ -214,10 +213,15 @@ class FALRU : public BaseTags
/**
* Insert the new block into the cache and update replacement data.
*
- * @param pkt Packet holding the address to update
+ * @param addr Address of the block.
+ * @param is_secure Whether the block is in secure space or not.
+ * @param src_master_ID The source requestor ID.
+ * @param task_ID The new task ID.
* @param blk The block to update.
*/
- void insertBlock(const PacketPtr pkt, CacheBlk *blk) override;
+ void insertBlock(const Addr addr, const bool is_secure,
+ const int src_master_ID, const uint32_t task_ID,
+ CacheBlk *blk) override;
/**
* Generate the tag from the addres. For fully associative this is just the
diff --git a/src/mem/cache/tags/sector_tags.cc b/src/mem/cache/tags/sector_tags.cc
index 33269ecc9..76034e1ea 100644
--- a/src/mem/cache/tags/sector_tags.cc
+++ b/src/mem/cache/tags/sector_tags.cc
@@ -194,10 +194,12 @@ SectorTags::getPossibleLocations(Addr addr) const
}
void
-SectorTags::insertBlock(const PacketPtr pkt, CacheBlk *blk)
+SectorTags::insertBlock(const Addr addr, const bool is_secure,
+ const int src_master_ID, const uint32_t task_ID,
+ CacheBlk *blk)
{
- // Insert block
- BaseTags::insertBlock(pkt, blk);
+ // Do common block insertion functionality
+ BaseTags::insertBlock(addr, is_secure, src_master_ID, task_ID, blk);
// Get block's sector
SectorSubBlk* sub_blk = static_cast<SectorSubBlk*>(blk);
diff --git a/src/mem/cache/tags/sector_tags.hh b/src/mem/cache/tags/sector_tags.hh
index c0dae8dd4..109b9832b 100644
--- a/src/mem/cache/tags/sector_tags.hh
+++ b/src/mem/cache/tags/sector_tags.hh
@@ -41,7 +41,6 @@
#include "mem/cache/sector_blk.hh"
#include "mem/cache/tags/base.hh"
-#include "mem/packet.hh"
#include "params/SectorTags.hh"
class BaseReplacementPolicy;
@@ -150,10 +149,15 @@ class SectorTags : public BaseTags
/**
* Insert the new block into the cache and update replacement data.
*
- * @param pkt Packet holding the address to update
+ * @param addr Address of the block.
+ * @param is_secure Whether the block is in secure space or not.
+ * @param src_master_ID The source requestor ID.
+ * @param task_ID The new task ID.
* @param blk The block to update.
*/
- void insertBlock(const PacketPtr pkt, CacheBlk *blk) override;
+ void insertBlock(const Addr addr, const bool is_secure,
+ const int src_master_ID, const uint32_t task_ID,
+ CacheBlk *blk) override;
/**
* Finds the given address in the cache, do not update replacement data.