ruby: numa bit fix for sparse memory
authorBrad Beckmann <Brad.Beckmann@amd.com>
Mon, 7 Feb 2011 06:14:19 +0000 (22:14 -0800)
committerBrad Beckmann <Brad.Beckmann@amd.com>
Mon, 7 Feb 2011 06:14:19 +0000 (22:14 -0800)
configs/ruby/MOESI_hammer.py
configs/ruby/Ruby.py
src/mem/ruby/system/DirectoryMemory.cc
src/mem/ruby/system/DirectoryMemory.py
src/mem/ruby/system/SparseMemory.cc
src/mem/ruby/system/SparseMemory.hh

index df1c1d3e758d1ae8c145bc65c157e176dc864fdf..d0552263ea143402bd6454d5b52ac8812dec1fbb 100644 (file)
@@ -164,7 +164,9 @@ def create_system(options, system, piobus, dma_devices):
                                                     size = dir_size,
                                                     use_map = options.use_map,
                                                     map_levels = \
-                                                    options.map_levels),
+                                                    options.map_levels,
+                                                    numa_high_bit = \
+                                                      options.numa_high_bit),
                                          probeFilter = pf,
                                          memBuffer = mem_cntrl,
                                          probe_filter_enabled = options.pf_on,
index 398a18844bc786cef8b787cae1730db2258d233d..e5d3c4a7c4671d9126132c6d318ebb578be5840e 100644 (file)
@@ -42,7 +42,7 @@ def define_options(parser):
                       help="'fixed'|'flexible'")
 
     # ruby mapping options
-    parser.add_option("--numa-high-bit", type="int", default=None,
+    parser.add_option("--numa-high-bit", type="int", default=0,
                       help="high order address bit to use for numa mapping. " \
                            "0 = highest bit, not specified = lowest bit")
 
index 4a72dce33a36756deddcfd8f4a0acdfaec7c74ae..c9d072c382d5fd26841417388ce9d55f5ca50c4b 100644 (file)
@@ -56,9 +56,7 @@ DirectoryMemory::init()
     m_num_entries = m_size_bytes / RubySystem::getBlockSizeBytes();
 
     if (m_use_map) {
-        int entry_bits = floorLog2(m_num_entries);
-        assert(entry_bits >= m_map_levels);
-        m_sparseMemory = new SparseMemory(entry_bits, m_map_levels);
+        m_sparseMemory = new SparseMemory(m_map_levels);
     } else {
         m_entries = new Directory_Entry*[m_num_entries];
         for (int i = 0; i < m_num_entries; i++)
index 784ed628fe4bc44da9dac3bcd4476616675e984e..d3b6bc5917f1f4f3d51d9afc9dde2fedc5e724dc 100644 (file)
@@ -38,4 +38,6 @@ class RubyDirectoryMemory(SimObject):
     size = Param.MemorySize("1GB", "capacity in bytes")
     use_map = Param.Bool(False, "enable sparse memory")
     map_levels = Param.Int(4, "sparse memory map levels")
-    numa_high_bit = Param.Int(0, "numa high bit")
+    # the default value of the numa high bit is specified in the command line
+    # option and must be passed into the directory memory sim object
+    numa_high_bit = Param.Int("numa high bit")
index 376852826dd565f77c61d61e6a9d7877965d2337..51d33798dce1ab0a45a30c918fbb96c4c9bdc6af 100644 (file)
  */
 
 #include "mem/ruby/system/SparseMemory.hh"
+#include "mem/ruby/system/System.hh"
 
 using namespace std;
 
-SparseMemory::SparseMemory(int number_of_bits, int number_of_levels)
+SparseMemory::SparseMemory(int number_of_levels)
 {
     int even_level_bits;
     int extra;
-    m_total_number_of_bits = number_of_bits;
+    m_total_number_of_bits = RubySystem::getMemorySizeBits() 
+        - RubySystem::getBlockSizeBits();;
+
     m_number_of_levels = number_of_levels;
 
     //
index 0601a8ca554d5762c8ffb6146b80a8201ecfe13b..78a3080a17ac6ab30d490a5beb9800f3ae0967ab 100644 (file)
@@ -54,7 +54,7 @@ struct CurNextInfo
 class SparseMemory
 {
   public:
-    SparseMemory(int number_of_bits, int number_of_levels);
+    SparseMemory(int number_of_levels);
     ~SparseMemory();
 
     void printConfig(std::ostream& out) { }