Memory: Cache the physical memory start and size so we don't need a dynamic cast on every access.

--HG--
extra : convert_revision : d6c3e93718991e7b68248242c80d8e6ac637ac51
This commit is contained in:
Ali Saidi
2007-11-19 18:23:43 -05:00
parent fed9ee52fc
commit 8026ecbb8e
2 changed files with 8 additions and 2 deletions

View File

@@ -70,6 +70,10 @@ PhysicalMemory::PhysicalMemory(const Params *p)
memset(pmemAddr, 0, p->range.size());
pagePtr = 0;
cachedSize = params()->range.size();
cachedStart = params()->range.start;
}
void

View File

@@ -149,10 +149,12 @@ class PhysicalMemory : public MemObject
std::vector<MemoryPort*> ports;
typedef std::vector<MemoryPort*>::iterator PortIterator;
uint64_t cachedSize;
uint64_t cachedStart;
public:
Addr new_page();
uint64_t size() { return params()->range.size(); }
uint64_t start() { return params()->range.start; }
uint64_t size() { return cachedSize; }
uint64_t start() { return cachedStart; }
public:
typedef PhysicalMemoryParams Params;