Added a parameter to set memory to zero. This is to support Legion, and once we can...
authorGabe Black <gblack@eecs.umich.edu>
Thu, 23 Nov 2006 04:09:27 +0000 (23:09 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Thu, 23 Nov 2006 04:09:27 +0000 (23:09 -0500)
--HG--
extra : convert_revision : 168883e4a5d3760962cd9759a6f41c66f5a6402a

configs/common/FSConfig.py
src/mem/physical.cc
src/mem/physical.hh
src/python/m5/objects/PhysicalMemory.py

index 45077a838c8b9ba8006dc915d1101bb5f9f554b2..1c0a56362999fed07b4f11ac8f4e062c62ab584b 100644 (file)
@@ -89,7 +89,7 @@ def makeSparcSystem(mem_mode, mdesc = None):
     self.bridge = Bridge()
     self.t1000 = T1000()
     self.t1000.attachIO(self.iobus)
-    self.physmem = PhysicalMemory(range = AddrRange(mdesc.mem()))
+    self.physmem = PhysicalMemory(range = AddrRange(mdesc.mem()), zero = True)
     self.bridge.side_a = self.iobus.port
     self.bridge.side_b = self.membus.port
     self.physmem.port = self.membus.port
index 9b8ae1fc49b41f43cd47cde2ca4a0f6691e6cd1c..6610e547d648e3bc264e132d3eeed3243ca7397a 100644 (file)
@@ -65,6 +65,10 @@ PhysicalMemory::PhysicalMemory(Params *p)
         fatal("Could not mmap!\n");
     }
 
+    //If requested, initialize all the memory to 0
+    if(params()->zero)
+        memset(pmemAddr, 0, params()->addrRange.size());
+
     pagePtr = 0;
 }
 
@@ -432,6 +436,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(PhysicalMemory)
     Param<string> file;
     Param<Range<Addr> > range;
     Param<Tick> latency;
+    Param<bool> zero;
 
 END_DECLARE_SIM_OBJECT_PARAMS(PhysicalMemory)
 
@@ -439,7 +444,8 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(PhysicalMemory)
 
     INIT_PARAM_DFLT(file, "memory mapped file", ""),
     INIT_PARAM(range, "Device Address Range"),
-    INIT_PARAM(latency, "Memory access latency")
+    INIT_PARAM(latency, "Memory access latency"),
+    INIT_PARAM(zero, "Zero initialize memory")
 
 END_INIT_SIM_OBJECT_PARAMS(PhysicalMemory)
 
@@ -449,6 +455,7 @@ CREATE_SIM_OBJECT(PhysicalMemory)
     p->name = getInstanceName();
     p->addrRange = range;
     p->latency = latency;
+    p->zero = zero;
     return new PhysicalMemory(p);
 }
 
index 045e6161272013925d84ec780c702a5e4cb6f606..af88bcaa0fdccc8357e68509d5e69cce59810710 100644 (file)
@@ -154,6 +154,7 @@ class PhysicalMemory : public MemObject
         std::string name;
         Range<Addr> addrRange;
         Tick latency;
+        bool zero;
     };
 
   protected:
index 4e097543dcaa4f166fd30ee44fc27e855d660692..b8df6229eccf9a197bcface6287fde03950ea978 100644 (file)
@@ -9,6 +9,7 @@ class PhysicalMemory(MemObject):
     range = Param.AddrRange(AddrRange('128MB'), "Device Address")
     file = Param.String('', "memory mapped file")
     latency = Param.Latency(Parent.clock, "latency of an access")
+    zero = Param.Bool(False, "zero initialize memory")
 
 class DRAMMemory(PhysicalMemory):
     type = 'DRAMMemory'