From 8fb361161443a5ace9513a558a2b9a75c06efe21 Mon Sep 17 00:00:00 2001 From: Pranith Kumar Date: Sat, 6 Jan 2024 19:23:23 -0500 Subject: [PATCH] mem-cache: prefetch: Implement DCPT tables using cache library The DCPT table is better built using the generic cache library since we do not need the secure bit. Change-Id: I8a4a8d3dab7fbc3bbc816107492978ac7f3f5934 --- .../delta_correlating_prediction_tables.cc | 14 +++++++------- .../delta_correlating_prediction_tables.hh | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc b/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc index ea59bea3c0..9df252c1a6 100644 --- a/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc +++ b/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc @@ -42,15 +42,16 @@ namespace prefetch DeltaCorrelatingPredictionTables::DeltaCorrelatingPredictionTables( const DeltaCorrelatingPredictionTablesParams &p) : SimObject(p), deltaBits(p.delta_bits), deltaMaskBits(p.delta_mask_bits), - table(p.table_assoc, p.table_entries, p.table_indexing_policy, - p.table_replacement_policy, DCPTEntry(p.deltas_per_entry)) + table((name() + "DCPT").c_str(), p.table_entries, + p.table_assoc, p.table_replacement_policy, + p.table_indexing_policy, DCPTEntry(p.deltas_per_entry)) { } void DeltaCorrelatingPredictionTables::DCPTEntry::invalidate() { - TaggedEntry::invalidate(); + CacheEntry::invalidate(); deltas.flush(); while (!deltas.full()) { @@ -134,9 +135,8 @@ DeltaCorrelatingPredictionTables::calculatePrefetch( } Addr address = pfi.getAddr(); Addr pc = pfi.getPC(); - // Look up table entry, is_secure is unused in findEntry because we - // index using the pc - DCPTEntry *entry = table.findEntry(pc, false /* unused */); + // Look up table entry + DCPTEntry *entry = table.findEntry(pc); if (entry != nullptr) { entry->addAddress(address, deltaBits); //Delta correlating @@ -144,7 +144,7 @@ DeltaCorrelatingPredictionTables::calculatePrefetch( } else { entry = table.findVictim(pc); - table.insertEntry(pc, false /* unused */, entry); + table.insertEntry(pc, entry); entry->lastAddress = address; } diff --git a/src/mem/cache/prefetch/delta_correlating_prediction_tables.hh b/src/mem/cache/prefetch/delta_correlating_prediction_tables.hh index 7280c96733..482a8807e6 100644 --- a/src/mem/cache/prefetch/delta_correlating_prediction_tables.hh +++ b/src/mem/cache/prefetch/delta_correlating_prediction_tables.hh @@ -29,8 +29,8 @@ #ifndef __MEM_CACHE_PREFETCH_DELTA_CORRELATING_PREDICTION_TABLES_HH_ #define __MEM_CACHE_PREFETCH_DELTA_CORRELATING_PREDICTION_TABLES_HH_ +#include "base/cache/associative_cache.hh" #include "base/circular_queue.hh" -#include "mem/cache/prefetch/associative_set.hh" #include "mem/cache/prefetch/queued.hh" namespace gem5 @@ -65,7 +65,7 @@ class DeltaCorrelatingPredictionTables : public SimObject const unsigned int deltaMaskBits; /** DCPT Table entry datatype */ - struct DCPTEntry : public TaggedEntry + struct DCPTEntry : public CacheEntry { /** Last accessed address */ Addr lastAddress; @@ -77,7 +77,7 @@ class DeltaCorrelatingPredictionTables : public SimObject * @param num_deltas number of deltas stored in the entry */ DCPTEntry(unsigned int num_deltas) - : TaggedEntry(), lastAddress(0), deltas(num_deltas) + : CacheEntry(), lastAddress(0), deltas(num_deltas) { } @@ -103,7 +103,7 @@ class DeltaCorrelatingPredictionTables : public SimObject }; /** The main table */ - AssociativeSet table; + AssociativeCache table; public: DeltaCorrelatingPredictionTables(