Skip to content

Commit

Permalink
fix: use PAGEMASK for perfect TLB (#76)
Browse files Browse the repository at this point in the history
The perfect TLB access are set to a 0xFFF.. Addresses, but this requires a page number instead, therefore a shift
  • Loading branch information
xusine authored Oct 30, 2024
1 parent 42e8ae1 commit dc265e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/MMU/MMUImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// - June'18: msutherl - basic TLB definition, no real timing info

#include "MMUUtil.hpp"
#include "core/types.hpp"
#include "pageWalk.hpp"

#include <boost/archive/binary_iarchive.hpp>
Expand Down Expand Up @@ -226,7 +227,7 @@ class FLEXUS_COMPONENT(MMU)
theMMU->setupAddressSpaceSizesAndGranules();
DBG_Assert(theMMU->Gran0->getlogKBSize() == 12, (<< "TG0 has non-4KB size - unsupported"));
DBG_Assert(theMMU->Gran1->getlogKBSize() == 12, (<< "TG1 has non-4KB size - unsupported"));
PAGEMASK = ~((1 << theMMU->Gran0->getlogKBSize()) - 1);
PAGEMASK = ~((1ULL << theMMU->Gran0->getlogKBSize()) - 1);
ret = true;
}

Expand Down Expand Up @@ -300,6 +301,10 @@ class FLEXUS_COMPONENT(MMU)
mmu_is_init = false;
theInstrTLB.resize(cfg.iTLBSize);
theDataTLB.resize(cfg.dTLBSize);

if (cfg.PerfectTLB) {
PAGEMASK = ~((1ULL << 12) - 1);
}
}

void finalize() {}
Expand Down

0 comments on commit dc265e2

Please sign in to comment.