gem5 v24.1.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
random_rp.hh
Go to the documentation of this file.
1
35#ifndef __MEM_CACHE_REPLACEMENT_POLICIES_RANDOM_RP_HH__
36#define __MEM_CACHE_REPLACEMENT_POLICIES_RANDOM_RP_HH__
37
38#include "base/random.hh"
40
41namespace gem5
42{
43
44struct RandomRPParams;
45
46namespace replacement_policy
47{
48
49class Random : public Base
50{
51 protected:
53
56 {
61 bool valid;
62
66 RandomReplData() : valid(false) {}
67 };
68
69 public:
70 typedef RandomRPParams Params;
71 Random(const Params &p);
72 ~Random() = default;
73
80 void invalidate(const std::shared_ptr<ReplacementData>& replacement_data)
81 override;
82
89 void touch(const std::shared_ptr<ReplacementData>& replacement_data) const
90 override;
91
98 void reset(const std::shared_ptr<ReplacementData>& replacement_data) const
99 override;
100
107 ReplaceableEntry* getVictim(const ReplacementCandidates& candidates) const
108 override;
109
115 std::shared_ptr<ReplacementData> instantiateEntry() override;
116};
117
118} // namespace replacement_policy
119} // namespace gem5
120
121#endif // __MEM_CACHE_REPLACEMENT_POLICIES_RANDOM_RP_HH__
std::shared_ptr< Random > RandomPtr
Definition random.hh:65
static RandomPtr genRandom()
Definition random.hh:68
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
A common base class of cache replacement policy objects.
Definition base.hh:55
std::shared_ptr< ReplacementData > instantiateEntry() override
Instantiate a replacement data entry.
Definition random_rp.cc:92
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::Random::RandomPtr rng
Definition random_rp.hh:52
void touch(const std::shared_ptr< ReplacementData > &replacement_data) const override
Touch an entry to update its replacement data.
Definition random_rp.cc:56
ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const override
Find replacement victim at random.
Definition random_rp.cc:69
STL vector class.
Definition stl.hh:37
Bitfield< 0 > p
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
Random-specific implementation of replacement data.
Definition random_rp.hh:56
bool valid
Flag informing if the replacement data is valid or not.
Definition random_rp.hh:61
The replacement data needed by replacement policies.

Generated on Mon Jan 13 2025 04:28:38 for gem5 by doxygen 1.9.8