alpha: Quick fix for things related to TLB MRU cache.

simple-timing test for ALPHA_FS breaks.

--HG--
extra : convert_revision : 5a1b05cddd480849913da81a3b3931fec16485a8
This commit is contained in:
Vincentius Robby 2007-08-08 18:38:19 -04:00
parent 9493501fdb
commit 1caed14654
2 changed files with 14 additions and 11 deletions

View file

@ -75,7 +75,7 @@ TLB::~TLB()
// look up an entry in the TLB // look up an entry in the TLB
PTE * PTE *
TLB::lookup(Addr vpn, uint8_t asn) const TLB::lookup(Addr vpn, uint8_t asn)
{ {
// assume not found... // assume not found...
PTE *retval = NULL; PTE *retval = NULL;
@ -94,7 +94,7 @@ TLB::lookup(Addr vpn, uint8_t asn) const
} }
} }
if (retval == NULL) if (retval == NULL) {
PageTable::const_iterator i = lookupTable.find(vpn); PageTable::const_iterator i = lookupTable.find(vpn);
if (i != lookupTable.end()) { if (i != lookupTable.end()) {
while (i->first == vpn) { while (i->first == vpn) {
@ -102,10 +102,7 @@ TLB::lookup(Addr vpn, uint8_t asn) const
PTE *pte = &table[index]; PTE *pte = &table[index];
assert(pte->valid); assert(pte->valid);
if (vpn == pte->tag && (pte->asma || pte->asn == asn)) { if (vpn == pte->tag && (pte->asma || pte->asn == asn)) {
retval = pte; retval = updateCache(pte);
PTECache[2] = PTECache[1];
PTECache[1] = PTECache[0];
PTECache[0] = pte;
break; break;
} }
@ -315,7 +312,7 @@ ITB::regStats()
Fault Fault
ITB::translate(RequestPtr &req, ThreadContext *tc) const ITB::translate(RequestPtr &req, ThreadContext *tc)
{ {
//If this is a pal pc, then set PHYSICAL //If this is a pal pc, then set PHYSICAL
if(FULL_SYSTEM && PcPAL(req->getPC())) if(FULL_SYSTEM && PcPAL(req->getPC()))
@ -477,7 +474,7 @@ DTB::regStats()
} }
Fault Fault
DTB::translate(RequestPtr &req, ThreadContext *tc, bool write) const DTB::translate(RequestPtr &req, ThreadContext *tc, bool write)
{ {
Addr pc = tc->readPC(); Addr pc = tc->readPC();

View file

@ -61,7 +61,7 @@ namespace AlphaISA
int nlu; // not last used entry (for replacement) int nlu; // not last used entry (for replacement)
void nextnlu() { if (++nlu >= size) nlu = 0; } void nextnlu() { if (++nlu >= size) nlu = 0; }
PTE *lookup(Addr vpn, uint8_t asn) const; PTE *lookup(Addr vpn, uint8_t asn);
public: public:
TLB(const std::string &name, int size); TLB(const std::string &name, int size);
@ -92,6 +92,12 @@ namespace AlphaISA
// Most recently used page table entries // Most recently used page table entries
PTE *PTECache[3]; PTE *PTECache[3];
inline void flushCache() { memset(PTECache, 0, 3 * sizeof(PTE*)); } inline void flushCache() { memset(PTECache, 0, 3 * sizeof(PTE*)); }
inline PTE* updateCache(PTE *pte) {
PTECache[2] = PTECache[1];
PTECache[1] = PTECache[0];
PTECache[0] = pte;
return pte;
}
}; };
class ITB : public TLB class ITB : public TLB
@ -106,7 +112,7 @@ namespace AlphaISA
ITB(const std::string &name, int size); ITB(const std::string &name, int size);
virtual void regStats(); virtual void regStats();
Fault translate(RequestPtr &req, ThreadContext *tc) const; Fault translate(RequestPtr &req, ThreadContext *tc);
}; };
class DTB : public TLB class DTB : public TLB
@ -129,7 +135,7 @@ namespace AlphaISA
DTB(const std::string &name, int size); DTB(const std::string &name, int size);
virtual void regStats(); virtual void regStats();
Fault translate(RequestPtr &req, ThreadContext *tc, bool write) const; Fault translate(RequestPtr &req, ThreadContext *tc, bool write);
}; };
} }