gem5  v22.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/cur_tick.hh"
36 
37 namespace gem5
38 {
39 
40 GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
41 namespace replacement_policy
42 {
43 
44 BIP::BIP(const Params &p)
45  : LRU(p), btp(p.btp)
46 {
47 }
48 
49 void
50 BIP::reset(const std::shared_ptr<ReplacementData>& replacement_data) const
51 {
52  std::shared_ptr<LRUReplData> casted_replacement_data =
53  std::static_pointer_cast<LRUReplData>(replacement_data);
54 
55  // Entries are inserted as MRU if lower than btp, LRU otherwise
56  if (random_mt.random<unsigned>(1, 100) <= btp) {
57  casted_replacement_data->lastTouchTick = curTick();
58  } else {
59  // Make their timestamps as old as possible, so that they become LRU
60  casted_replacement_data->lastTouchTick = 1;
61  }
62 }
63 
64 } // namespace replacement_policy
65 } // namespace gem5
Copyright (c) 2018-2020 Inria All rights reserved.
const unsigned btp
Bimodal throtle parameter.
Definition: bip_rp.hh:63
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data for an entry.
Definition: bip_rp.cc:50
BIP(const Params &p)
Definition: bip_rp.cc:44
BaseReplacementPolicyParams Params
Definition: base.hh:58
Random random_mt
Definition: random.cc:99
std::enable_if_t< std::is_integral_v< T >, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
Definition: random.hh:90
Bitfield< 54 > p
Definition: pagetable.hh:70
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)

Generated on Wed Dec 21 2022 10:22:36 for gem5 by doxygen 1.9.1