diff options
Diffstat (limited to 'src/mem/cache/replacement_policies')
-rw-r--r-- | src/mem/cache/replacement_policies/base.hh | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/mem/cache/replacement_policies/base.hh b/src/mem/cache/replacement_policies/base.hh index 0ce86d091..6ac7dca85 100644 --- a/src/mem/cache/replacement_policies/base.hh +++ b/src/mem/cache/replacement_policies/base.hh @@ -50,12 +50,48 @@ struct ReplacementData {}; */ class ReplaceableEntry { - public: + private: + /** + * Set to which this entry belongs. + */ + uint32_t _set; + + /** + * Way (relative position within the set) to which this entry belongs. + */ + uint32_t _way; + + public: + /** + * Replacement data associated to this entry. + * It is instantiated by the replacement policy. + */ + std::shared_ptr<ReplacementData> replacementData; + /** - * Replacement data associated to this entry. - * It is instantiated by the replacement policy. + * Set both the set and way. Should be called only once. + * + * @param set The set of this entry. + * @param way The way of this entry. + */ + void setPosition(const uint32_t set, const uint32_t way) { + _set = set; + _way = way; + } + + /** + * Get set number. + * + * @return The set to which this entry belongs. + */ + uint32_t getSet() const { return _set; } + + /** + * Get way number. + * + * @return The way to which this entry belongs. */ - std::shared_ptr<ReplacementData> replacementData; + uint32_t getWay() const { return _way; } }; /** |