Ruby: Use block size in configuring directory bits in address
authorJason Power ext:(%2C%20Joel%20Hestness%20%3Chestness%40cs.wisc.edu%3E) <power.jg@gmail.com>
Sat, 27 Oct 2012 21:01:09 +0000 (16:01 -0500)
committerJason Power ext:(%2C%20Joel%20Hestness%20%3Chestness%40cs.wisc.edu%3E) <power.jg@gmail.com>
Sat, 27 Oct 2012 21:01:09 +0000 (16:01 -0500)
This patch replaces hard coded values used in Ruby's configuration files
for setting directory bits with values based on the block size in use.

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

index 434f5c8db8c71776c00e61c126b38e59af4524e7..d0f38d9229dc27bf9afd818da6005bf153151644 100644 (file)
@@ -145,18 +145,18 @@ def create_system(options, system, piobus, dma_ports, ruby_system):
     dir_bits = int(math.log(options.num_dirs, 2))
     pf_bits = int(math.log(pf_size.value, 2))
     if options.numa_high_bit:
-        if options.numa_high_bit > 0:
+        if options.pf_on or options.dir_on:
             # if numa high bit explicitly set, make sure it does not overlap
             # with the probe filter index
             assert(options.numa_high_bit - dir_bits > pf_bits)
 
         # set the probe filter start bit to just above the block offset
-        pf_start_bit = 6
+        pf_start_bit = block_size_bits
     else:
         if dir_bits > 0:
-            pf_start_bit = dir_bits + 5
+            pf_start_bit = dir_bits + block_size_bits - 1
         else:
-            pf_start_bit = 6
+            pf_start_bit = block_size_bits
 
     for i in xrange(options.num_dirs):
         #
index bcb939165f15ed1cc841d1b44c856a5c36c6a3e1..40ee6319579051b8be85d3b8e1ee2b3dbad67044 100644 (file)
@@ -173,16 +173,16 @@ def create_system(options, system, piobus = None, dma_ports = []):
     total_mem_size = MemorySize('0B')
 
     dir_bits = int(math.log(options.num_dirs, 2))
+    ruby.block_size_bytes = options.cacheline_size
+    block_size_bits = int(math.log(options.cacheline_size, 2))
 
     if options.numa_high_bit:
         numa_bit = options.numa_high_bit
     else:
-        # if not specified, use the lowest bits above the block offest
-        if dir_bits > 0:
-            # add 5 because bits 0-5 are the block offset
-            numa_bit = dir_bits + 5
-        else:
-            numa_bit = 6
+        # if the numa_bit is not specified, set the directory bits as the
+        # lowest bits above the block offset bits, and the numa_bit as the
+        # highest of those directory bits
+        numa_bit = block_size_bits + dir_bits - 1
 
     for dir_cntrl in dir_cntrls:
         total_mem_size.value += dir_cntrl.directory.size.value