1/**
2 * Copyright (c) 2018 Inria
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 40 unchanged lines hidden (view full) ---

49 *
50 * From the original paper, this implementation of RRIP is also called
51 * Static RRIP (SRRIP), as it always inserts entries with the same RRPV.
52 */
53
54#ifndef __MEM_CACHE_REPLACEMENT_POLICIES_BRRIP_RP_HH__
55#define __MEM_CACHE_REPLACEMENT_POLICIES_BRRIP_RP_HH__
56
57#include "base/sat_counter.hh"
58#include "mem/cache/replacement_policies/base.hh"
59
60struct BRRIPRPParams;
61
62class BRRIPRP : public BaseReplacementPolicy
63{
64 protected:
65 /** BRRIP-specific implementation of replacement data. */
66 struct BRRIPReplData : ReplacementData
67 {
68 /**
69 * Re-Reference Interval Prediction Value.
70 * Some values have specific names (according to the paper):
71 * 0 -> near-immediate re-rereference interval
72 * max_RRPV-1 -> long re-rereference interval
73 * max_RRPV -> distant re-rereference interval
73 * A value equal to max_RRPV + 1 indicates an invalid entry.
74 */
75 int rrpv;
75 SatCounter rrpv;
76
77 /** Whether the entry is valid. */
78 bool valid;
79
80 /**
81 * Default constructor. Invalidate data.
82 */
80 BRRIPReplData(const int max_RRPV) : rrpv(max_RRPV + 1) {}
83 BRRIPReplData(const int num_bits)
84 : rrpv(num_bits), valid(false)
85 {
86 }
87 };
88
89 /**
84 * Maximum Re-Reference Prediction Value possible. An entry with this
85 * value as the rrpv has the longest possible re-reference interval,
86 * that is, it is likely not to be used in the near future, and is
87 * among the best eviction candidates.
88 * A maxRRPV of 1 implies in a NRU.
90 * Number of RRPV bits. An entry that saturates its RRPV has the longest
91 * possible re-reference interval, that is, it is likely not to be used
92 * in the near future, and is among the best eviction candidates.
93 * A maximum RRPV of 1 implies in a NRU.
94 */
90 const int maxRRPV;
95 const unsigned numRRPVBits;
96
97 /**
98 * The hit priority (HP) policy replaces entries that do not receive cache
99 * hits over any cache entry that receives a hit, while the frequency
100 * priority (FP) policy replaces infrequently re-referenced entries.
101 */
102 const bool hitPriority;
103

--- 64 unchanged lines hidden ---