50 #include "debug/RiscvTLB.hh" 51 #include "debug/TLB.hh" 53 #include "params/RiscvTLB.hh" 66 :
BaseTLB(p), size(p->size), nlu(0)
84 PTE *retval =
nullptr;
87 while (i->first == vpn) {
88 int index = i->second;
95 if (((vpn & InvMask) == (VPN & InvMask)) &&
96 (pte->
G || (asn == pte->
asid))) {
105 DPRINTF(
TLB,
"lookup %#x, asn %#x -> %s ppn %#x\n", vpn, (
int)asn,
106 retval ?
"hit" :
"miss", retval ? retval->
PFN1 : 0);
115 return &
table[Index];
125 while (i->first == vpn) {
126 int index = i->second;
131 Addr InvMask = ~Mask;
133 if (((vpn & InvMask) == (VPN & InvMask)) &&
134 (pte->
G || (asn == pte->
asid))) {
142 DPRINTF(RiscvTLB,
"VPN: %x, asid: %d, Result of TLBP: %d\n",vpn,asn,Ind);
149 Addr VAddrUncacheable = 0xA0000000;
152 if ((req->getVaddr() & VAddrUncacheable) == VAddrUncacheable) {
164 warn(
"Attempted to write at index (%d) beyond TLB size (%d)",
169 Index, pte.
Mask << 11,
171 ((pte.
PFN0 << 6) | (pte.
C0 << 3) |
172 (pte.
D0 << 2) | (pte.
V0 <<1) | pte.
G),
173 ((pte.
PFN1 <<6) | (pte.
C1 << 3) |
174 (pte.
D1 << 2) | (pte.
V1 <<1) | pte.
G));
190 fatal(
"TLB Insert not yet implemented\n");
208 for (
int i = 0;
i <
size;
i++) {
220 for (
int i = 0;
i <
size;
i++) {
236 .
desc(
"DTB read hits")
241 .
desc(
"DTB read misses")
247 .
desc(
"DTB read accesses")
252 .
desc(
"DTB write hits")
257 .
desc(
"DTB write misses")
263 .
desc(
"DTB write accesses")
278 .
desc(
"DTB accesses")
294 if (static_cast<RiscvSystem *>(tc->
getSystemPtr())->isBareMetal())
301 req->setPaddr(req->getVaddr());
308 panic(
"translateInst not implemented in RISC-V.\n");
329 if (static_cast<RiscvSystem *>(tc->
getSystemPtr())->isBareMetal())
336 req->setPaddr(req->getVaddr());
343 panic(
"translateData not implemented in RISC-V.\n");
353 assert(req->getSize() > 0);
354 if (req->getVaddr() + req->getSize() - 1 < req->getVaddr())
355 return make_shared<GenericPageTableFault>(req->getVaddr());
404 RiscvTLBParams::create()
406 return new TLB(
this);
#define panic(...)
This implements a cprintf based panic() function.
void unserialize(CheckpointIn &cp)
Stats::Scalar write_accesses
The request is to an uncacheable address.
virtual System * getSystemPtr()=0
decltype(nullptr) constexpr NoFault
void insert(Addr vaddr, RiscvISA::PTE &pte)
#define fatal(...)
This implements a cprintf based fatal() function.
void insertAt(RiscvISA::PTE &pte, unsigned Index, int _smallPages)
static Fault checkCacheability(const RequestPtr &req)
std::shared_ptr< Request > RequestPtr
void serialize(CheckpointOut &cp) const
The request is required to be strictly ordered by CPU models and is non-speculative.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
virtual Process * getProcessPtr()=0
virtual void regStats()
Callback to set stat parameters.
Overload hash function for BasicBlockRange type.
RiscvISA::PTE * lookup(Addr vpn, uint8_t asn) const
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)
Fault translateInst(const RequestPtr &req, ThreadContext *tc)
std::string csprintf(const char *format, const Args &...args)
void flushAll() override
Remove all entries from the TLB.
bool translate(Addr vaddr, Addr &paddr)
Translate function.
void regStats() override
Callback to set stat parameters.
Stats::Scalar read_accesses
RiscvISA::PTE & index(bool advance=true)
virtual void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, Mode mode)=0
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of IniFile object.
virtual const std::string name() const
#define SERIALIZE_SCALAR(scalar)
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
void translateTiming(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode) override
Stats::Scalar read_misses
EmulationPageTable * pTable
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Declarations of a non-full system Page Table.
int probeEntry(Addr vpn, uint8_t) const
Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode) override
std::ostream CheckpointOut
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
The virtual address is also the physical address.
Scoped checkpoint section helper class.
RiscvISA::PTE * getEntry(unsigned) const
Fault translateData(const RequestPtr &req, ThreadContext *tc, bool write)
std::shared_ptr< FaultBase > Fault
Stats::Scalar write_misses
Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, Mode mode) const override
Do post-translation physical address finalization.