gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fifo_rp.cc
Go to the documentation of this file.
1 
30 
31 #include <cassert>
32 #include <memory>
33 
34 #include "params/FIFORP.hh"
35 #include "sim/cur_tick.hh"
36 
37 namespace gem5
38 {
39 
40 namespace replacement_policy
41 {
42 
44  : Base(p)
45 {
46 }
47 
48 void
49 FIFO::invalidate(const std::shared_ptr<ReplacementData>& replacement_data)
50 {
51  // Reset insertion tick
52  std::static_pointer_cast<FIFOReplData>(
53  replacement_data)->tickInserted = ++timeTicks;
54 }
55 
56 void
57 FIFO::touch(const std::shared_ptr<ReplacementData>& replacement_data) const
58 {
59  // A touch does not modify the insertion tick
60 }
61 
62 void
63 FIFO::reset(const std::shared_ptr<ReplacementData>& replacement_data) const
64 {
65  // Set insertion tick
66  std::static_pointer_cast<FIFOReplData>(
67  replacement_data)->tickInserted = ++timeTicks;
68 }
69 
71 FIFO::getVictim(const ReplacementCandidates& candidates) const
72 {
73  // There must be at least one replacement candidate
74  assert(candidates.size() > 0);
75 
76  // Visit all candidates to find victim
77  ReplaceableEntry* victim = candidates[0];
78  for (const auto& candidate : candidates) {
79  // Update victim entry if necessary
80  if (std::static_pointer_cast<FIFOReplData>(
81  candidate->replacementData)->tickInserted <
82  std::static_pointer_cast<FIFOReplData>(
83  victim->replacementData)->tickInserted) {
84  victim = candidate;
85  }
86  }
87 
88  return victim;
89 }
90 
91 std::shared_ptr<ReplacementData>
93 {
94  return std::shared_ptr<ReplacementData>(new FIFOReplData());
95 }
96 
97 } // namespace replacement_policy
98 } // namespace gem5
gem5::replacement_policy::FIFO::getVictim
ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const override
Find replacement victim using insertion timestamps.
Definition: fifo_rp.cc:71
fifo_rp.hh
Copyright (c) 2018-2020 Inria All rights reserved.
gem5::replacement_policy::Base::Params
BaseReplacementPolicyParams Params
Definition: base.hh:57
cur_tick.hh
gem5::replacement_policy::FIFO::invalidate
void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) override
Invalidate replacement data to set it as the next probable victim.
Definition: fifo_rp.cc:49
std::vector
STL vector class.
Definition: stl.hh:37
gem5::replacement_policy::FIFO::timeTicks
Tick timeTicks
A counter that tracks the number of ticks since being created to avoid a tie.
Definition: fifo_rp.hh:69
gem5::replacement_policy::FIFO::reset
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data.
Definition: fifo_rp.cc:63
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::replacement_policy::Base
A common base class of cache replacement policy objects.
Definition: base.hh:54
gem5::replacement_policy::FIFO::touch
void touch(const std::shared_ptr< ReplacementData > &replacement_data) const override
Touch an entry to update its replacement data.
Definition: fifo_rp.cc:57
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::FIFO::instantiateEntry
std::shared_ptr< ReplacementData > instantiateEntry() override
Instantiate a replacement data entry.
Definition: fifo_rp.cc:92
gem5::replacement_policy::FIFO::FIFOReplData
FIFO-specific implementation of replacement data.
Definition: fifo_rp.hh:54
gem5::ReplaceableEntry::replacementData
std::shared_ptr< replacement_policy::ReplacementData > replacementData
Replacement data associated to this entry.
Definition: replaceable_entry.hh:83
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::replacement_policy::FIFO::FIFO
FIFO(const Params &p)
Definition: fifo_rp.cc:43

Generated on Sun Jul 30 2023 01:56:57 for gem5 by doxygen 1.8.17