diff options
author | David Guillen-Fandos <david.guillen@arm.com> | 2015-07-30 03:41:42 -0400 |
---|---|---|
committer | David Guillen-Fandos <david.guillen@arm.com> | 2015-07-30 03:41:42 -0400 |
commit | 0c89c15b23d4db50eb08f8ebf2a40b569f41dd29 (patch) | |
tree | 9f5e2bcf48d88e940b9fea6b2fa9f37d05ea2741 /src/mem/cache/tags/base.hh | |
parent | 5a18e181ffb8fbef5f4aca8fb9a63ee6a7c9e0d6 (diff) | |
download | gem5-0c89c15b23d4db50eb08f8ebf2a40b569f41dd29.tar.xz |
mem: Make caches way aware
This patch makes cache sets aware of the way number. This enables
some nice features such as the ablity to restrict way allocation. The
implemented mechanism allows to set a maximum way number to be
allocated 'k' which must fulfill 0 < k <= N (where N is the number of
ways). In the future more sophisticated mechasims can be implemented.
Diffstat (limited to 'src/mem/cache/tags/base.hh')
-rw-r--r-- | src/mem/cache/tags/base.hh | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh index e4c0f68d8..05f51167e 100644 --- a/src/mem/cache/tags/base.hh +++ b/src/mem/cache/tags/base.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 ARM Limited + * Copyright (c) 2012-2014 ARM Limited * All rights reserved. * * The license below extends only to copyright in the software and shall @@ -196,6 +196,37 @@ class BaseTags : public ClockedObject return (addr & (Addr)(blkSize-1)); } + /** + * Find the cache block given set and way + * @param set The set of the block. + * @param way The way of the block. + * @return The cache block. + */ + virtual CacheBlk *findBlockBySetAndWay(int set, int way) const = 0; + + /** + * Limit the allocation for the cache ways. + * @param ways The maximum number of ways available for replacement. + */ + virtual void setWayAllocationMax(int ways) + { + panic("This tag class does not implement way allocation limit!\n"); + } + + /** + * Get the way allocation mask limit. + * @return The maximum number of ways available for replacement. + */ + virtual int getWayAllocationMax() const + { + panic("This tag class does not implement way allocation limit!\n"); + return -1; + } + + virtual unsigned getNumSets() const = 0; + + virtual unsigned getNumWays() const = 0; + virtual void invalidate(CacheBlk *blk) = 0; virtual CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat, |