bip_rp.hh (12634:e69074a3c9b9) bip_rp.hh (12684:44ebd2bc020f)
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.
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 blocks, placing them as MRU.
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
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_LIP_RP_HH__
45#define __MEM_CACHE_REPLACEMENT_POLICIES_LIP_RP_HH__
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
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 block is inserted at the MRU or LRU position.
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 /**
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 a block. Used when a block is inserted.
75 * Sets the insertion tick, and update correspondent replacement data.
76 * Uses the bimodal throtle parameter to decide whether the new block
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
77 * should be inserted as MRU, or LRU.
78 *
76 * should be inserted as MRU, or LRU.
77 *
79 * @param blk Cache block to be reset.
78 * @param replacement_data Replacement data to be reset.
80 */
79 */
81 void reset(CacheBlk *blk) override;
80 void reset(const std::shared_ptr<ReplacementData>& replacement_data) const
81 override;
82};
83
82};
83
84#endif // __MEM_CACHE_REPLACEMENT_POLICIES_LIP_RP_HH__
84#endif // __MEM_CACHE_REPLACEMENT_POLICIES_BIP_RP_HH__