gem5 v24.0.0.0
Loading...
Searching...
No Matches
cache_entry.hh
Go to the documentation of this file.
1
30#ifndef __BASE_CACHE_CACHE_ENTRY_HH__
31#define __BASE_CACHE_CACHE_ENTRY_HH__
32
33#include <cassert>
34
35#include "base/cprintf.hh"
36#include "base/types.hh"
38
39namespace gem5
40{
41
47{
48 public:
49 CacheEntry() = default;
50 ~CacheEntry() = default;
51
57 virtual bool isValid() const { return valid; }
58
64 virtual Addr getTag() const { return tag; }
65
72 virtual bool
73 matchTag(const Addr tag) const
74 {
75 return isValid() && (getTag() == tag);
76 }
77
84 virtual void
86 {
87 setValid();
88 setTag(tag);
89 }
90
92 virtual void
94 {
95 valid = false;
97 }
98
99 std::string
100 print() const override
101 {
102 return csprintf("tag: %#x valid: %d | %s", getTag(),
104 }
105
106 protected:
112 virtual void setTag(Addr _tag) { tag = _tag; }
113
115 virtual void
117 {
118 assert(!isValid());
119 valid = true;
120 }
121
122 private:
128 bool valid{false};
129
132};
133
134} // namespace gem5
135
136#endif //__CACHE_ENTRY_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
A CacheEntry is an entry containing a tag.
CacheEntry()=default
virtual void invalidate()
Invalidate the block.
virtual Addr getTag() const
Get tag associated to this block.
virtual void setValid()
Set valid bit.
~CacheEntry()=default
std::string print() const override
Prints relevant information about this entry.
bool valid
Valid bit.
virtual bool matchTag(const Addr tag) const
Checks if the given tag information corresponds to this entry's.
Addr tag
The entry's tag.
virtual bool isValid() const
Checks if the entry is valid.
virtual void insert(const Addr tag)
Insert the block by assigning it a tag and marking it valid.
virtual void setTag(Addr _tag)
Set tag associated to this block.
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
virtual std::string print() const
Prints relevant information about this entry.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
std::string csprintf(const char *format, const Args &...args)
Definition cprintf.hh:161
const Addr MaxAddr
Definition types.hh:171

Generated on Tue Jun 18 2024 16:24:00 for gem5 by doxygen 1.11.0