From fccbf8bb45723adb07ebadd52e548e1bcd2cc44a Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Wed, 19 Sep 2012 06:15:41 -0400 Subject: AddrRange: Simplify AddrRange params Python hierarchy This patch simplifies the Range object hierarchy in preparation for an address range class that also allows striping (e.g. selecting a few bits as matching in addition to the range). To extend the AddrRange class to an AddrRegion, the first step is to simplify the hierarchy such that we can make it as lean as possible before adding the new functionality. The only class using Range and MetaRange is AddrRange, and the three classes are now collapsed into one. --- configs/ruby/MESI_CMP_directory.py | 7 +++---- configs/ruby/MI_example.py | 5 ++--- configs/ruby/MOESI_CMP_directory.py | 7 +++---- configs/ruby/MOESI_CMP_token.py | 7 +++---- configs/ruby/MOESI_hammer.py | 5 ++--- configs/ruby/Network_test.py | 5 ++--- configs/ruby/Ruby.py | 5 ++--- 7 files changed, 17 insertions(+), 24 deletions(-) (limited to 'configs/ruby') diff --git a/configs/ruby/MESI_CMP_directory.py b/configs/ruby/MESI_CMP_directory.py index 017fe3a4a..35f857534 100644 --- a/configs/ruby/MESI_CMP_directory.py +++ b/configs/ruby/MESI_CMP_directory.py @@ -133,10 +133,9 @@ def create_system(options, system, piobus, dma_ports, ruby_system): l2_cntrl_nodes.append(l2_cntrl) cntrl_count += 1 - - phys_mem_size = 0 - for mem in system.memories.unproxy(system): - phys_mem_size += long(mem.range.second) - long(mem.range.first) + 1 + + phys_mem_size = sum(map(lambda mem: mem.range.size(), + system.memories.unproxy(system))) mem_module_size = phys_mem_size / options.num_dirs for i in xrange(options.num_dirs): diff --git a/configs/ruby/MI_example.py b/configs/ruby/MI_example.py index 85544837d..316251ff0 100644 --- a/configs/ruby/MI_example.py +++ b/configs/ruby/MI_example.py @@ -105,9 +105,8 @@ def create_system(options, system, piobus, dma_ports, ruby_system): cntrl_count += 1 - phys_mem_size = 0 - for mem in system.memories.unproxy(system): - phys_mem_size += long(mem.range.second) - long(mem.range.first) + 1 + phys_mem_size = sum(map(lambda mem: mem.range.size(), + system.memories.unproxy(system))) mem_module_size = phys_mem_size / options.num_dirs for i in xrange(options.num_dirs): diff --git a/configs/ruby/MOESI_CMP_directory.py b/configs/ruby/MOESI_CMP_directory.py index b238b7675..dbe814977 100644 --- a/configs/ruby/MOESI_CMP_directory.py +++ b/configs/ruby/MOESI_CMP_directory.py @@ -132,10 +132,9 @@ def create_system(options, system, piobus, dma_ports, ruby_system): l2_cntrl_nodes.append(l2_cntrl) cntrl_count += 1 - - phys_mem_size = 0 - for mem in system.memories.unproxy(system): - phys_mem_size += long(mem.range.second) - long(mem.range.first) + 1 + + phys_mem_size = sum(map(lambda mem: mem.range.size(), + system.memories.unproxy(system))) mem_module_size = phys_mem_size / options.num_dirs for i in xrange(options.num_dirs): diff --git a/configs/ruby/MOESI_CMP_token.py b/configs/ruby/MOESI_CMP_token.py index 466f9bb8c..5036a5bb2 100644 --- a/configs/ruby/MOESI_CMP_token.py +++ b/configs/ruby/MOESI_CMP_token.py @@ -155,10 +155,9 @@ def create_system(options, system, piobus, dma_ports, ruby_system): l2_cntrl_nodes.append(l2_cntrl) cntrl_count += 1 - - phys_mem_size = 0 - for mem in system.memories.unproxy(system): - phys_mem_size += long(mem.range.second) - long(mem.range.first) + 1 + + phys_mem_size = sum(map(lambda mem: mem.range.size(), + system.memories.unproxy(system))) mem_module_size = phys_mem_size / options.num_dirs for i in xrange(options.num_dirs): diff --git a/configs/ruby/MOESI_hammer.py b/configs/ruby/MOESI_hammer.py index 56fe05298..434f5c8db 100644 --- a/configs/ruby/MOESI_hammer.py +++ b/configs/ruby/MOESI_hammer.py @@ -131,9 +131,8 @@ def create_system(options, system, piobus, dma_ports, ruby_system): cntrl_count += 1 - phys_mem_size = 0 - for mem in system.memories.unproxy(system): - phys_mem_size += long(mem.range.second) - long(mem.range.first) + 1 + phys_mem_size = sum(map(lambda mem: mem.range.size(), + system.memories.unproxy(system))) mem_module_size = phys_mem_size / options.num_dirs # diff --git a/configs/ruby/Network_test.py b/configs/ruby/Network_test.py index c4dd97e8d..df2631cd4 100644 --- a/configs/ruby/Network_test.py +++ b/configs/ruby/Network_test.py @@ -106,9 +106,8 @@ def create_system(options, system, piobus, dma_ports, ruby_system): cntrl_count += 1 - phys_mem_size = 0 - for mem in system.memories.unproxy(system): - phys_mem_size += long(mem.range.second) - long(mem.range.first) + 1 + phys_mem_size = sum(map(lambda mem: mem.range.size(), + system.memories.unproxy(system))) mem_module_size = phys_mem_size / options.num_dirs for i in xrange(options.num_dirs): diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py index ba6f3e7fa..a8fc94d3d 100644 --- a/configs/ruby/Ruby.py +++ b/configs/ruby/Ruby.py @@ -188,9 +188,8 @@ def create_system(options, system, piobus = None, dma_ports = []): total_mem_size.value += dir_cntrl.directory.size.value dir_cntrl.directory.numa_high_bit = numa_bit - phys_mem_size = 0 - for mem in system.memories.unproxy(system): - phys_mem_size += long(mem.range.second) - long(mem.range.first) + 1 + phys_mem_size = sum(map(lambda mem: mem.range.size(), + system.memories.unproxy(system))) assert(total_mem_size.value == phys_mem_size) ruby_profiler = RubyProfiler(ruby_system = ruby, -- cgit v1.2.3