ruby: Memory size consistency check
authorBrad Beckmann <Brad.Beckmann@amd.com>
Sat, 30 Jan 2010 04:29:24 +0000 (20:29 -0800)
committerBrad Beckmann <Brad.Beckmann@amd.com>
Sat, 30 Jan 2010 04:29:24 +0000 (20:29 -0800)
Ruby's memory is now sized according to the size of M5 physical memory.

configs/ruby/MOESI_hammer.py
configs/ruby/Ruby.py

index dba31b8b76b88197ea3efa96a86de0bf6a59f0fc..62d86a1e226695e59cc04046355397d40e45f2e3 100644 (file)
@@ -96,6 +96,9 @@ def create_system(options, phys_mem, piobus, dma_devices):
         cpu_sequencers.append(cpu_seq)
         l1_cntrl_nodes.append(l1_cntrl)
 
+    phys_mem_size = long(phys_mem.range.second) - long(phys_mem.range.first) + 1
+    mem_module_size = phys_mem_size / options.num_dirs
+
     for i in xrange(options.num_dirs):
         #
         # Create the Ruby objects associated with the directory controller
@@ -103,9 +106,13 @@ def create_system(options, phys_mem, piobus, dma_devices):
 
         mem_cntrl = RubyMemoryControl(version = i)
 
+        dir_size = MemorySize('0B')
+        dir_size.value = mem_module_size
+
         dir_cntrl = Directory_Controller(version = i,
                                          directory = \
-                                           RubyDirectoryMemory(version = i),
+                                         RubyDirectoryMemory(version = i,
+                                                             size = dir_size),
                                          memBuffer = mem_cntrl)
 
         dir_cntrl_nodes.append(dir_cntrl)
index 7003e6266ff5426d55206cb68503aad4000e65e6..735adda27becbe22550e317ee4b610f29943317c 100644 (file)
@@ -55,11 +55,14 @@ def create_system(options, physmem, piobus = None, dma_devices = []):
     network = SimpleNetwork(topology = makeCrossbar(all_cntrls))
 
     #
-    # determine the total memory size of the ruby system
+    # determine the total memory size of the ruby system and verify it is equal
+    # to physmem
     #
     total_mem_size = MemorySize('0B')
     for dir_cntrl in dir_cntrls:
         total_mem_size.value += dir_cntrl.directory.size.value
+    physmem_size = long(physmem.range.second) - long(physmem.range.first) + 1
+    assert(total_mem_size.value == physmem_size)
 
     ruby_profiler = RubyProfiler(num_of_sequencers = len(cpu_sequencers))