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
This commit is contained in:
Pranith Kumar
2024-01-06 19:23:23 -05:00
parent 2c7d4bed66
commit 8fb3611614
2 changed files with 11 additions and 11 deletions

View File

@@ -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;
}

View File

@@ -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<DCPTEntry> table;
AssociativeCache<DCPTEntry> table;
public:
DeltaCorrelatingPredictionTables(