Memory: Cache the physical memory start and size so we don't need a dynamic cast...
authorAli Saidi <saidi@eecs.umich.edu>
Mon, 19 Nov 2007 23:23:43 +0000 (18:23 -0500)
committerAli Saidi <saidi@eecs.umich.edu>
Mon, 19 Nov 2007 23:23:43 +0000 (18:23 -0500)
--HG--
extra : convert_revision : d6c3e93718991e7b68248242c80d8e6ac637ac51

src/mem/physical.cc
src/mem/physical.hh

index 8c56d340f88e6888b699dcc91afe69164a2a63ee..a3a9df64e8906059a74052fd4c11563f27405846 100644 (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
index b06cc90f83c1611b3ff0e76c7bb4da305174c781..c3749bd5bc6481e50a744c7d0498ea0b43914d6e 100644 (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;