gem5  v20.1.0.0
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 }
BaseReplacementPolicy::Params
BaseReplacementPolicyParams Params
Convenience typedef.
Definition: base.hh:52
bip_rp.hh
Copyright (c) 2018 Inria All rights reserved.
random.hh
BIPRP
Definition: bip_rp.hh:49
random_mt
Random random_mt
Definition: random.cc:96
core.hh
BIPRP::btp
const unsigned btp
Bimodal throtle parameter.
Definition: bip_rp.hh:56
BIPRP::reset
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data for an entry.
Definition: bip_rp.cc:43
BIPRP::BIPRP
BIPRP(const Params *p)
Construct and initiliaze this replacement policy.
Definition: bip_rp.cc:37
LRURP
Definition: lru_rp.hh:42
Random::random
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:86
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
curTick
Tick curTick()
The current simulated tick.
Definition: core.hh:45

Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17