gem5
v21.0.1.0
mem
cache
replacement_policies
bip_rp.cc
Go to the documentation of this file.
1
29
#include "
mem/cache/replacement_policies/bip_rp.hh
"
30
31
#include <memory>
32
33
#include "
base/random.hh
"
34
#include "params/BIPRP.hh"
35
#include "
sim/core.hh
"
36
37
namespace
ReplacementPolicy
{
38
39
BIP::BIP
(
const
Params
&
p
)
40
:
LRU
(
p
), btp(
p
.btp)
41
{
42
}
43
44
void
45
BIP::reset
(
const
std::shared_ptr<ReplacementData>& replacement_data)
const
46
{
47
std::shared_ptr<LRUReplData> casted_replacement_data =
48
std::static_pointer_cast<LRUReplData>(replacement_data);
49
50
// Entries are inserted as MRU if lower than btp, LRU otherwise
51
if
(
random_mt
.
random
<
unsigned
>(1, 100) <=
btp
) {
52
casted_replacement_data->lastTouchTick =
curTick
();
53
}
else
{
54
// Make their timestamps as old as possible, so that they become LRU
55
casted_replacement_data->lastTouchTick = 1;
56
}
57
}
58
59
}
// namespace ReplacementPolicy
ReplacementPolicy::BIP::reset
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data for an entry.
Definition:
bip_rp.cc:45
bip_rp.hh
Copyright (c) 2018-2020 Inria All rights reserved.
random.hh
Random::random
std::enable_if_t< std::is_integral< T >::value, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
Definition:
random.hh:86
random_mt
Random random_mt
Definition:
random.cc:96
ReplacementPolicy::BIP::BIP
BIP(const Params &p)
Definition:
bip_rp.cc:39
ReplacementPolicy
Copyright (c) 2018-2020 Inria All rights reserved.
Definition:
stride.hh:64
ReplacementPolicy::Base::Params
BaseReplacementPolicyParams Params
Definition:
base.hh:51
ReplacementPolicy::BIP::btp
const unsigned btp
Bimodal throtle parameter.
Definition:
bip_rp.hh:58
core.hh
ReplacementPolicy::LRU
Definition:
lru_rp.hh:44
curTick
Tick curTick()
The universal simulation clock.
Definition:
cur_tick.hh:43
MipsISA::p
Bitfield< 0 > p
Definition:
pra_constants.hh:323
Generated on Tue Jun 22 2021 15:28:29 for gem5 by
doxygen
1.8.17