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; --- 17 unchanged lines hidden (view full) --- 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Daniel Carvalho 29 */ 30 31/** 32 * @file 33 * Declaration of a Bimodal Interval Prediction replacement policy. |
34 * Has a probability of when placing new entries, placing them as MRU. |
35 * 36 * Although both LRU and LIP can be seen as specific cases of BIP 37 * where the bimodal throtle parameter are 1 and 0, respectively, we 38 * decide not to inherit from it, and do the other way around (inherit 39 * from LRU) for efficiency reasons. 40 * 41 * In the original paper they use btp = 1/32 ~= 3%. 42 */ 43 |
44#ifndef __MEM_CACHE_REPLACEMENT_POLICIES_BIP_RP_HH__ 45#define __MEM_CACHE_REPLACEMENT_POLICIES_BIP_RP_HH__ |
46 47#include "mem/cache/replacement_policies/lru_rp.hh" 48#include "params/BIPRP.hh" 49 50class BIPRP : public LRURP 51{ 52 protected: 53 /** 54 * Bimodal throtle parameter. Value in the range [0,100] used to decide |
55 * if a new entry is inserted at the MRU or LRU position. |
56 */ 57 const unsigned btp; 58 59 public: 60 /** Convenience typedef. */ 61 typedef BIPRPParams Params; 62 63 /** 64 * Construct and initiliaze this replacement policy. 65 */ 66 BIPRP(const Params *p); 67 68 /** 69 * Destructor. 70 */ 71 ~BIPRP() {} 72 73 /** |
74 * Reset replacement data for an entry. Used when an entry is inserted. 75 * Uses the bimodal throtle parameter to decide whether the new entry |
76 * should be inserted as MRU, or LRU. 77 * |
78 * @param replacement_data Replacement data to be reset. |
79 */ |
80 void reset(const std::shared_ptr<ReplacementData>& replacement_data) const 81 override; |
82}; 83 |
84#endif // __MEM_CACHE_REPLACEMENT_POLICIES_BIP_RP_HH__ |