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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user