49 #include "debug/RiscvTLB.hh"
50 #include "debug/TLB.hh"
52 #include "params/RiscvTLB.hh"
57 using namespace RiscvISA;
83 PTE *retval =
nullptr;
86 while (i->first == vpn) {
87 int index = i->second;
94 if (((vpn & InvMask) == (VPN & InvMask)) &&
95 (pte->
G || (asn == pte->
asid))) {
104 DPRINTF(
TLB,
"lookup %#x, asn %#x -> %s ppn %#x\n", vpn, (
int)asn,
105 retval ?
"hit" :
"miss", retval ? retval->
PFN1 : 0);
114 return &
table[Index];
124 while (i->first == vpn) {
125 int index = i->second;
130 Addr InvMask = ~Mask;
132 if (((vpn & InvMask) == (VPN & InvMask)) &&
133 (pte->
G || (asn == pte->
asid))) {
141 DPRINTF(RiscvTLB,
"VPN: %x, asid: %d, Result of TLBP: %d\n",vpn,asn,Ind);
148 Addr VAddrUncacheable = 0xA0000000;
151 if ((req->
getVaddr() & VAddrUncacheable) == VAddrUncacheable) {
163 warn(
"Attempted to write at index (%d) beyond TLB size (%d)",
168 Index, pte.
Mask << 11,
170 ((pte.
PFN0 << 6) | (pte.
C0 << 3) |
171 (pte.
D0 << 2) | (pte.
V0 <<1) | pte.
G),
172 ((pte.
PFN1 <<6) | (pte.
C1 << 3) |
173 (pte.
D1 << 2) | (pte.
V1 <<1) | pte.
G));
189 fatal(
"TLB Insert not yet implemented\n");
207 for (
int i = 0;
i <
size;
i++) {
219 for (
int i = 0;
i <
size;
i++) {
235 .
desc(
"DTB read hits")
240 .
desc(
"DTB read misses")
246 .
desc(
"DTB read accesses")
251 .
desc(
"DTB write hits")
256 .
desc(
"DTB write misses")
262 .
desc(
"DTB write accesses")
277 .
desc(
"DTB accesses")
289 panic(
"translateInst not implemented in RISC-V.\n");
304 panic(
"translateData not implemented in RISC-V.\n");
315 return make_shared<GenericPageTableFault>(req->
getVaddr());
346 panic(
"Not implemented\n");
369 RiscvTLBParams::create()
371 return new TLB(
this);
void unserialize(CheckpointIn &cp)
Stats::Scalar write_accesses
decltype(nullptr) constexpr NoFault
void insert(Addr vaddr, RiscvISA::PTE &pte)
void insertAt(RiscvISA::PTE &pte, unsigned Index, int _smallPages)
Fault translateData(RequestPtr req, ThreadContext *tc, bool write)
RiscvISA::PTE * lookup(Addr vpn, uint8_t asn) const
int probeEntry(Addr vpn, uint8_t) const
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
virtual Process * getProcessPtr()=0
virtual void regStats()
Register statistics for this object.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
void serialize(CheckpointOut &cp) const override
Serialize an object.
#define UNSERIALIZE_SCALAR(scalar)
void serialize(CheckpointOut &cp) const
std::string csprintf(const char *format, const Args &...args)
void flushAll() override
Remove all entries from the TLB.
Fault finalizePhysical(RequestPtr req, ThreadContext *tc, Mode mode) const
bool translate(Addr vaddr, Addr &paddr)
Translate function.
The request is to an uncacheable address.
void regStats() override
Register statistics for this object.
Stats::Scalar read_accesses
RiscvISA::PTE & index(bool advance=true)
static Fault checkCacheability(RequestPtr &req)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of IniFile object.
Fault translateFunctional(RequestPtr req, ThreadContext *tc, Mode mode)
Function stub for CheckerCPU compilation issues.
#define SERIALIZE_SCALAR(scalar)
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Stats::Scalar read_misses
virtual const std::string name() const
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void translateTiming(RequestPtr req, ThreadContext *tc, Translation *translation, Mode mode)
Declarations of a non-full system Page Table.
std::ostream CheckpointOut
Fault translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode)
Fault translateInst(RequestPtr req, ThreadContext *tc)
The request is required to be strictly ordered by CPU models and is non-speculative.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Scoped checkpoint section helper class.
virtual void finish(const Fault &fault, RequestPtr req, ThreadContext *tc, Mode mode)=0
void setFlags(Flags flags)
Note that unlike other accessors, this function sets specific flags (ORs them in); it does not assign...
std::shared_ptr< FaultBase > Fault
Stats::Scalar write_misses
RiscvISA::PTE * getEntry(unsigned) const