gem5
v24.1.0.1
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
o
p
q
r
s
t
v
x
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Symbols
:
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
s
t
v
w
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Typedefs
a
b
c
d
g
h
i
l
m
r
s
t
u
w
Enumerations
b
h
i
o
p
Enumerator
h
i
o
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
mem
cache
replacement_policies
random_rp.cc
Go to the documentation of this file.
1
29
#include "
mem/cache/replacement_policies/random_rp.hh
"
30
31
#include <cassert>
32
#include <memory>
33
34
#include "params/RandomRP.hh"
35
36
namespace
gem5
37
{
38
39
namespace
replacement_policy
40
{
41
42
Random::Random
(
const
Params
&
p
)
43
:
Base
(
p
)
44
{
45
}
42
Random::Random
(
const
Params
&
p
) {
…
}
46
47
void
48
Random::invalidate
(
const
std::shared_ptr<ReplacementData>& replacement_data)
49
{
50
// Unprioritize replacement data victimization
51
std::static_pointer_cast<RandomReplData>(
52
replacement_data)->valid =
false
;
53
}
48
Random::invalidate
(
const
std::shared_ptr<ReplacementData>& replacement_data) {
…
}
54
55
void
56
Random::touch
(
const
std::shared_ptr<ReplacementData>& replacement_data)
const
57
{
58
}
56
Random::touch
(
const
std::shared_ptr<ReplacementData>& replacement_data)
const
{
…
}
59
60
void
61
Random::reset
(
const
std::shared_ptr<ReplacementData>& replacement_data)
const
62
{
63
// Unprioritize replacement data victimization
64
std::static_pointer_cast<RandomReplData>(
65
replacement_data)->valid =
true
;
66
}
61
Random::reset
(
const
std::shared_ptr<ReplacementData>& replacement_data)
const
{
…
}
67
68
ReplaceableEntry
*
69
Random::getVictim
(
const
ReplacementCandidates
& candidates)
const
70
{
71
// There must be at least one replacement candidate
72
assert(candidates.size() > 0);
73
74
// Choose one candidate at random
75
ReplaceableEntry
* victim = candidates[
rng
->random<
unsigned
>(0,
76
candidates.size() - 1)];
77
78
// Visit all candidates to search for an invalid entry. If one is found,
79
// its eviction is prioritized
80
for
(
const
auto
& candidate : candidates) {
81
if
(!std::static_pointer_cast<RandomReplData>(
82
candidate->replacementData)->valid) {
83
victim = candidate;
84
break
;
85
}
86
}
87
88
return
victim;
89
}
69
Random::getVictim
(
const
ReplacementCandidates
& candidates)
const
{
…
}
90
91
std::shared_ptr<ReplacementData>
92
Random::instantiateEntry
()
93
{
94
return
std::shared_ptr<ReplacementData>(
new
RandomReplData
());
95
}
92
Random::instantiateEntry
() {
…
}
96
97
}
// namespace replacement_policy
98
}
// namespace gem5
gem5::ReplaceableEntry
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
Definition
replaceable_entry.hh:63
gem5::replacement_policy::Base
A common base class of cache replacement policy objects.
Definition
base.hh:55
gem5::replacement_policy::Random::instantiateEntry
std::shared_ptr< ReplacementData > instantiateEntry() override
Instantiate a replacement data entry.
Definition
random_rp.cc:92
gem5::replacement_policy::Random::invalidate
void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) override
Invalidate replacement data to set it as the next probable victim.
Definition
random_rp.cc:48
gem5::replacement_policy::Random::rng
gem5::Random::RandomPtr rng
Definition
random_rp.hh:52
gem5::replacement_policy::Random::touch
void touch(const std::shared_ptr< ReplacementData > &replacement_data) const override
Touch an entry to update its replacement data.
Definition
random_rp.cc:56
gem5::replacement_policy::Random::reset
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data.
Definition
random_rp.cc:61
gem5::replacement_policy::Random::Params
RandomRPParams Params
Definition
random_rp.hh:70
gem5::replacement_policy::Random::getVictim
ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const override
Find replacement victim at random.
Definition
random_rp.cc:69
std::vector
STL vector class.
Definition
stl.hh:37
gem5::Random::Random
Random()=delete
gem5::MipsISA::p
Bitfield< 0 > p
Definition
pra_constants.hh:326
gem5
Copyright (c) 2024 Arm Limited All rights reserved.
Definition
binary32.hh:36
random_rp.hh
Copyright (c) 2018-2020 Inria All rights reserved.
gem5::replacement_policy::Random::RandomReplData
Random-specific implementation of replacement data.
Definition
random_rp.hh:56
Generated on Mon Jan 13 2025 04:28:38 for gem5 by
doxygen
1.9.8