gem5
[DEVELOP-FOR-23.0]
Main Page
Related Pages
Modules
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 Functions
:
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
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
mem
cache
replacement_policies
lru_rp.cc
Go to the documentation of this file.
1
29
#include "
mem/cache/replacement_policies/lru_rp.hh
"
30
31
#include <cassert>
32
#include <memory>
33
34
#include "params/LRURP.hh"
35
#include "
sim/cur_tick.hh
"
36
37
namespace
gem5
38
{
39
40
namespace
replacement_policy
41
{
42
43
LRU::LRU
(
const
Params
&
p
)
44
:
Base
(
p
)
45
{
46
}
47
48
void
49
LRU::invalidate
(
const
std::shared_ptr<ReplacementData>& replacement_data)
50
{
51
// Reset last touch timestamp
52
std::static_pointer_cast<LRUReplData>(
53
replacement_data)->lastTouchTick =
Tick
(0);
54
}
55
56
void
57
LRU::touch
(
const
std::shared_ptr<ReplacementData>& replacement_data)
const
58
{
59
// Update last touch timestamp
60
std::static_pointer_cast<LRUReplData>(
61
replacement_data)->lastTouchTick =
curTick
();
62
}
63
64
void
65
LRU::reset
(
const
std::shared_ptr<ReplacementData>& replacement_data)
const
66
{
67
// Set last touch timestamp
68
std::static_pointer_cast<LRUReplData>(
69
replacement_data)->lastTouchTick =
curTick
();
70
}
71
72
ReplaceableEntry
*
73
LRU::getVictim
(
const
ReplacementCandidates
& candidates)
const
74
{
75
// There must be at least one replacement candidate
76
assert(candidates.size() > 0);
77
78
// Visit all candidates to find victim
79
ReplaceableEntry
* victim = candidates[0];
80
for
(
const
auto
& candidate : candidates) {
81
// Update victim entry if necessary
82
if
(std::static_pointer_cast<LRUReplData>(
83
candidate->replacementData)->lastTouchTick <
84
std::static_pointer_cast<LRUReplData>(
85
victim->
replacementData
)->lastTouchTick) {
86
victim = candidate;
87
}
88
}
89
90
return
victim;
91
}
92
93
std::shared_ptr<ReplacementData>
94
LRU::instantiateEntry
()
95
{
96
return
std::shared_ptr<ReplacementData>(
new
LRUReplData
());
97
}
98
99
}
// namespace replacement_policy
100
}
// namespace gem5
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition:
cur_tick.hh:46
gem5::replacement_policy::LRU::instantiateEntry
std::shared_ptr< ReplacementData > instantiateEntry() override
Instantiate a replacement data entry.
Definition:
lru_rp.cc:94
gem5::replacement_policy::LRU::LRU
LRU(const Params &p)
Definition:
lru_rp.cc:43
gem5::replacement_policy::Base::Params
BaseReplacementPolicyParams Params
Definition:
base.hh:57
cur_tick.hh
std::vector
STL vector class.
Definition:
stl.hh:37
gem5::VegaISA::p
Bitfield< 54 > p
Definition:
pagetable.hh:70
gem5::replacement_policy::LRU::LRUReplData
LRU-specific implementation of replacement data.
Definition:
lru_rp.hh:52
gem5::Tick
uint64_t Tick
Tick count type.
Definition:
types.hh:58
lru_rp.hh
Copyright (c) 2018-2020 Inria All rights reserved.
gem5::replacement_policy::Base
A common base class of cache replacement policy objects.
Definition:
base.hh:54
gem5::replacement_policy::LRU::touch
void touch(const std::shared_ptr< ReplacementData > &replacement_data) const override
Touch an entry to update its replacement data.
Definition:
lru_rp.cc:57
gem5::replacement_policy::LRU::reset
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data.
Definition:
lru_rp.cc:65
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:62
gem5::replacement_policy::LRU::getVictim
ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const override
Find replacement victim using LRU timestamps.
Definition:
lru_rp.cc:73
gem5::ReplaceableEntry::replacementData
std::shared_ptr< replacement_policy::ReplacementData > replacementData
Replacement data associated to this entry.
Definition:
replaceable_entry.hh:83
gem5::replacement_policy::LRU::invalidate
void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) override
Invalidate replacement data to set it as the next probable victim.
Definition:
lru_rp.cc:49
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition:
gpu_translation_state.hh:37
Generated on Sun Jul 30 2023 01:56:57 for gem5 by
doxygen
1.8.17