From e73c442ad801804647a936058706bc8e35726ede Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Tue, 10 Sep 2024 16:36:07 +0100 Subject: [PATCH] mem-cache: Move size/entry_size params away from the template Change-Id: Iec7a79cd9f2fa60d97f4a430e047e286f50338c8 Signed-off-by: Giacomo Travaglini --- src/mem/cache/tags/Tags.py | 12 ++++++------ .../tags/indexing_policies/IndexingPolicies.py | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/mem/cache/tags/Tags.py b/src/mem/cache/tags/Tags.py index a5e3496d38..9102f4b065 100644 --- a/src/mem/cache/tags/Tags.py +++ b/src/mem/cache/tags/Tags.py @@ -46,12 +46,6 @@ class TaggedIndexingPolicy(SimObject): cxx_header = "mem/cache/tags/tagged_entry.hh" cxx_template_params = ["class Types"] - # Get the size from the parent (cache) - size = Param.MemorySize(Parent.size, "capacity in bytes") - - # Get the entry size from the parent (tags) - entry_size = Param.Int(Parent.entry_size, "entry size in bytes") - # Get the associativity assoc = Param.Int(Parent.assoc, "associativity") @@ -61,6 +55,12 @@ class TaggedSetAssociative(TaggedIndexingPolicy): cxx_class = "gem5::TaggedSetAssociative" cxx_header = "mem/cache/tags/tagged_entry.hh" + # Get the size from the parent (cache) + size = Param.MemorySize(Parent.size, "capacity in bytes") + + # Get the entry size from the parent (tags) + entry_size = Param.Int(Parent.entry_size, "entry size in bytes") + class BaseTags(ClockedObject): type = "BaseTags" diff --git a/src/mem/cache/tags/indexing_policies/IndexingPolicies.py b/src/mem/cache/tags/indexing_policies/IndexingPolicies.py index 437f903ca8..2aa777a1f8 100644 --- a/src/mem/cache/tags/indexing_policies/IndexingPolicies.py +++ b/src/mem/cache/tags/indexing_policies/IndexingPolicies.py @@ -49,12 +49,6 @@ class BaseIndexingPolicy(SimObject): cxx_header = "mem/cache/tags/indexing_policies/base.hh" cxx_template_params = ["class Types"] - # Get the size from the parent (cache) - size = Param.MemorySize(Parent.size, "capacity in bytes") - - # Get the entry size from the parent (tags) - entry_size = Param.Int(Parent.entry_size, "entry size in bytes") - # Get the associativity assoc = Param.Int(Parent.assoc, "associativity") @@ -64,8 +58,20 @@ class SetAssociative(BaseIndexingPolicy): cxx_class = "gem5::SetAssociative" cxx_header = "mem/cache/tags/indexing_policies/set_associative.hh" + # Get the size from the parent (cache) + size = Param.MemorySize(Parent.size, "capacity in bytes") + + # Get the entry size from the parent (tags) + entry_size = Param.Int(Parent.entry_size, "entry size in bytes") + class SkewedAssociative(BaseIndexingPolicy): type = "SkewedAssociative" cxx_class = "gem5::SkewedAssociative" cxx_header = "mem/cache/tags/indexing_policies/skewed_associative.hh" + + # Get the size from the parent (cache) + size = Param.MemorySize(Parent.size, "capacity in bytes") + + # Get the entry size from the parent (tags) + entry_size = Param.Int(Parent.entry_size, "entry size in bytes")