gem5  v21.2.1.1
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 GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
41 namespace replacement_policy
42 {
43 
45  : Base(p)
46 {
47 }
48 
49 void
50 FIFO::invalidate(const std::shared_ptr<ReplacementData>& replacement_data)
51 {
52  // Reset insertion tick
53  std::static_pointer_cast<FIFOReplData>(
54  replacement_data)->tickInserted = Tick(0);
55 }
56 
57 void
58 FIFO::touch(const std::shared_ptr<ReplacementData>& replacement_data) const
59 {
60  // A touch does not modify the insertion tick
61 }
62 
63 void
64 FIFO::reset(const std::shared_ptr<ReplacementData>& replacement_data) const
65 {
66  // Set insertion tick
67  std::static_pointer_cast<FIFOReplData>(
68  replacement_data)->tickInserted = curTick();
69 }
70 
72 FIFO::getVictim(const ReplacementCandidates& candidates) const
73 {
74  // There must be at least one replacement candidate
75  assert(candidates.size() > 0);
76 
77  // Visit all candidates to find victim
78  ReplaceableEntry* victim = candidates[0];
79  for (const auto& candidate : candidates) {
80  // Update victim entry if necessary
81  if (std::static_pointer_cast<FIFOReplData>(
82  candidate->replacementData)->tickInserted <
83  std::static_pointer_cast<FIFOReplData>(
84  victim->replacementData)->tickInserted) {
85  victim = candidate;
86  }
87  }
88 
89  return victim;
90 }
91 
92 std::shared_ptr<ReplacementData>
94 {
95  return std::shared_ptr<ReplacementData>(new FIFOReplData());
96 }
97 
98 } // namespace replacement_policy
99 } // namespace gem5
gem5::replacement_policy::FIFO::getVictim
ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const override
Find replacement victim using insertion timestamps.
Definition: fifo_rp.cc:72
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
fifo_rp.hh
Copyright (c) 2018-2020 Inria All rights reserved.
gem5::replacement_policy::Base::Params
BaseReplacementPolicyParams Params
Definition: base.hh:58
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:50
std::vector
STL vector class.
Definition: stl.hh:37
gem5::replacement_policy::FIFO::reset
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data.
Definition: fifo_rp.cc:64
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::replacement_policy::Base
A common base class of cache replacement policy objects.
Definition: base.hh:55
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:58
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
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::FIFO::instantiateEntry
std::shared_ptr< ReplacementData > instantiateEntry() override
Instantiate a replacement data entry.
Definition: fifo_rp.cc:93
gem5::replacement_policy::FIFO::FIFOReplData
FIFO-specific implementation of replacement data.
Definition: fifo_rp.hh:55
gem5::ReplaceableEntry::replacementData
std::shared_ptr< replacement_policy::ReplacementData > replacementData
Replacement data associated to this entry.
Definition: replaceable_entry.hh:84
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: tlb.cc:60
gem5::replacement_policy::FIFO::FIFO
FIFO(const Params &p)
Definition: fifo_rp.cc:44

Generated on Wed May 4 2022 12:13:59 for gem5 by doxygen 1.8.17