# HG changeset patch
# User Brad Beckmann <[email protected]>
# Date 1263536246 28800
# Node ID 4bda800b744ff1460dd98c97c5426ebe9170c1e8
# Parent  4bacc747d0a2af5b86d133610118264837282987
ruby: convert to M5 MemorySize
Converted both ruby caches and directory memory to use the M5 MemorySize python
type.

diff -r 4bacc747d0a2 -r 4bda800b744f configs/example/ruby_fs.py
--- a/configs/example/ruby_fs.py        Thu Jan 14 22:17:26 2010 -0800
+++ b/configs/example/ruby_fs.py        Thu Jan 14 22:17:26 2010 -0800
@@ -77,10 +77,15 @@
 parser.add_option("--ruby-debug-file", default="", help="Ruby debug out file 
(stdout if blank)")
 parser.add_option("--protocol", default="", help="Ruby protocol compiled into 
binary")
 
+# cache parameters
+parser.add_option("--l1d_size", type="string", default="32kB")
+parser.add_option("--l1i_size", type="string", default="32kB")
+parser.add_option("--l2_size", type="string", default="1MB")
+parser.add_option("--l1d_assoc", type="int", default=2)
+parser.add_option("--l1i_assoc", type="int", default=2)
+parser.add_option("--l2_assoc", type="int", default=16)
 
 # ruby host memory experimentation
-parser.add_option("--cache_size", type="int")
-parser.add_option("--cache_assoc", type="int")
 parser.add_option("--map_levels", type="int")
 
 execfile(os.path.join(config_root, "common", "Options.py"))
diff -r 4bacc747d0a2 -r 4bda800b744f configs/ruby/MOESI_hammer.py
--- a/configs/ruby/MOESI_hammer.py      Thu Jan 14 22:17:26 2010 -0800
+++ b/configs/ruby/MOESI_hammer.py      Thu Jan 14 22:17:26 2010 -0800
@@ -37,17 +37,13 @@
 # Note: the L1 Cache latency is only used by the sequencer on fast path hits
 #
 class L1Cache(RubyCache):
-    assoc = 2
     latency = 3
-    size = 32768
 
 #
 # Note: the L2 Cache latency is not currently used
 #
 class L2Cache(RubyCache):
-    assoc = 16
     latency = 15
-    size = 1048576
 
 def create_system(options, phys_mem, piobus, dma_devices):
     
@@ -74,9 +70,12 @@
         #
         # First create the Ruby objects associated with this cpu
         #
-        l1i_cache = L1Cache()
-        l1d_cache = L1Cache()
-        l2_cache = L2Cache()
+        l1i_cache = L1Cache(size = options.l1i_size,
+                            assoc = options.l1i_assoc)
+        l1d_cache = L1Cache(size = options.l1d_size,
+                            assoc = options.l1d_assoc)
+        l2_cache = L2Cache(size = options.l2_size,
+                           assoc = options.l2_assoc)
 
         cpu_seq = RubySequencer(icache = l1i_cache,
                                 dcache = l1d_cache,
diff -r 4bacc747d0a2 -r 4bda800b744f configs/ruby/Ruby.py
--- a/configs/ruby/Ruby.py      Thu Jan 14 22:17:26 2010 -0800
+++ b/configs/ruby/Ruby.py      Thu Jan 14 22:17:26 2010 -0800
@@ -54,8 +54,12 @@
     #
     network = SimpleNetwork(topology = makeCrossbar(all_cntrls))
 
-    mem_size_mb = sum([int(dir_cntrl.directory.size_mb) \
-                       for dir_cntrl in dir_cntrls])
+    #
+    # determine the total memory size of the ruby system
+    #
+    total_mem_size = MemorySize('0B')
+    for dir_cntrl in dir_cntrls:
+        total_mem_size.value += dir_cntrl.directory.size.value
 
     ruby_profiler = RubyProfiler(num_of_sequencers = len(cpu_sequencers))
     
@@ -66,7 +70,7 @@
                       debug = RubyDebug(filter_string = 'none',
                                         verbosity_string = 'none',
                                         protocol_trace = False),
-                      mem_size_mb = mem_size_mb)
+                      mem_size = total_mem_size)
 
     ruby.cpu_ruby_ports = cpu_sequencers
 
diff -r 4bacc747d0a2 -r 4bda800b744f src/mem/ruby/system/Cache.py
--- a/src/mem/ruby/system/Cache.py      Thu Jan 14 22:17:26 2010 -0800
+++ b/src/mem/ruby/system/Cache.py      Thu Jan 14 22:17:26 2010 -0800
@@ -5,7 +5,7 @@
 class RubyCache(SimObject):
     type = 'RubyCache'
     cxx_class = 'CacheMemory'
-    size = Param.Int("");
+    size = Param.MemorySize("capacity in bytes");
     latency = Param.Int("");
     assoc = Param.Int("");
     replacement_policy = Param.String("PSEUDO_LRU", "");
diff -r 4bacc747d0a2 -r 4bda800b744f src/mem/ruby/system/DirectoryMemory.cc
--- a/src/mem/ruby/system/DirectoryMemory.cc    Thu Jan 14 22:17:26 2010 -0800
+++ b/src/mem/ruby/system/DirectoryMemory.cc    Thu Jan 14 22:17:26 2010 -0800
@@ -49,7 +49,7 @@
     : SimObject(p)
 {
     m_version = p->version;
-    m_size_bytes = p->size_mb * static_cast<uint64>(1<<20);
+    m_size_bytes = p->size;
     m_size_bits = log_int(m_size_bytes);
 }
 
diff -r 4bacc747d0a2 -r 4bda800b744f src/mem/ruby/system/DirectoryMemory.py
--- a/src/mem/ruby/system/DirectoryMemory.py    Thu Jan 14 22:17:26 2010 -0800
+++ b/src/mem/ruby/system/DirectoryMemory.py    Thu Jan 14 22:17:26 2010 -0800
@@ -6,4 +6,4 @@
     type = 'RubyDirectoryMemory'
     cxx_class = 'DirectoryMemory'
     version = Param.Int(0, "")
-    size_mb = Param.Int(1024, "")
+    size = Param.MemorySize("1GB", "capacity in bytes")
diff -r 4bacc747d0a2 -r 4bda800b744f src/mem/ruby/system/RubySystem.py
--- a/src/mem/ruby/system/RubySystem.py Thu Jan 14 22:17:26 2010 -0800
+++ b/src/mem/ruby/system/RubySystem.py Thu Jan 14 22:17:26 2010 -0800
@@ -11,7 +11,7 @@
     clock = Param.Clock('1GHz', "")
     block_size_bytes = Param.Int(64,
         "default cache block size; must be a power of two");
-    mem_size_mb = Param.Int("");
+    mem_size = Param.MemorySize("total memory size of the system");
     network = Param.RubyNetwork("")
     debug = Param.RubyDebug("the default debug object")
     profiler = Param.RubyProfiler("");
diff -r 4bacc747d0a2 -r 4bda800b744f src/mem/ruby/system/System.cc
--- a/src/mem/ruby/system/System.cc     Thu Jan 14 22:17:26 2010 -0800
+++ b/src/mem/ruby/system/System.cc     Thu Jan 14 22:17:26 2010 -0800
@@ -100,7 +100,7 @@
     assert(is_power_of_2(m_block_size_bytes));
     m_block_size_bits = log_int(m_block_size_bytes);
 
-    m_memory_size_bytes = (uint64_t)p->mem_size_mb * 1024 * 1024;
+    m_memory_size_bytes = p->mem_size;
     m_memory_size_bits = log_int(m_memory_size_bytes);
 
     m_network_ptr = p->network;

_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to