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

Generated on Fri Feb 28 2020 16:27:01 for gem5 by doxygen 1.8.13