gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bip_rp.cc
Go to the documentation of this file.
1 
30 
31 #include <memory>
32 
33 #include "base/random.hh"
34 #include "params/BIPRP.hh"
35 #include "sim/core.hh"
36 
38  : LRURP(p), btp(p->btp)
39 {
40 }
41 
42 void
43 BIPRP::reset(const std::shared_ptr<ReplacementData>& replacement_data) const
44 {
45  std::shared_ptr<LRUReplData> casted_replacement_data =
46  std::static_pointer_cast<LRUReplData>(replacement_data);
47 
48  // Entries are inserted as MRU if lower than btp, LRU otherwise
49  if (random_mt.random<unsigned>(1, 100) <= btp) {
50  casted_replacement_data->lastTouchTick = curTick();
51  } else {
52  // Make their timestamps as old as possible, so that they become LRU
53  casted_replacement_data->lastTouchTick = 1;
54  }
55 }
56 
57 BIPRP*
58 BIPRPParams::create()
59 {
60  return new BIPRP(this);
61 }
BaseReplacementPolicyParams Params
Convenience typedef.
Definition: base.hh:52
std::enable_if< std::is_integral< T >::value, T >::type random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
Definition: random.hh:79
LRU-specific implementation of replacement data.
Definition: lru_rp.hh:46
Tick curTick()
The current simulated tick.
Definition: core.hh:44
Definition: lru_rp.hh:42
Definition: bip_rp.hh:49
const unsigned btp
Bimodal throtle parameter.
Definition: bip_rp.hh:56
Random random_mt
Definition: random.cc:96
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data for an entry.
Definition: bip_rp.cc:43
BIPRP(const Params *p)
Construct and initiliaze this replacement policy.
Definition: bip_rp.cc:37
Tick lastTouchTick
Tick on which the entry was last touched.
Definition: lru_rp.hh:49
Bitfield< 0 > p
Copyright (c) 2018 Inria All rights reserved.

Generated on Mon Jun 8 2020 15:45:11 for gem5 by doxygen 1.8.13