diff --git a/configs/example/ruby_direct_test.py b/configs/example/ruby_direct_test.py index 60defb9f59..163b38fede 100644 --- a/configs/example/ruby_direct_test.py +++ b/configs/example/ruby_direct_test.py @@ -97,7 +97,13 @@ system.clk_domain = SrcClockDomain(clock = options.sys_clock, system.cpu = RubyDirectedTester(requests_to_complete = options.requests, generator = generator) -Ruby.create_system(options, False, system) +# the ruby tester reuses num_cpus to specify the +# number of cpu ports connected to the tester object, which +# is stored in system.cpu. because there is only ever one +# tester object, num_cpus is not necessarily equal to the +# size of system.cpu +cpu_list = [ system.cpu ] * options.num_cpus +Ruby.create_system(options, False, system, cpus=cpu_list) # Since Ruby runs at an independent frequency, create a seperate clock system.ruby.clk_domain = SrcClockDomain(clock = options.ruby_clock, diff --git a/configs/example/ruby_gpu_random_test.py b/configs/example/ruby_gpu_random_test.py index 133c13a4bb..745ad0298b 100644 --- a/configs/example/ruby_gpu_random_test.py +++ b/configs/example/ruby_gpu_random_test.py @@ -249,8 +249,15 @@ system.dma_devices = dma_devices # # Create the Ruby system # +# the ruby tester reuses num_cpus to specify the +# number of cpu ports connected to the tester object, which +# is stored in system.cpu. because there is only ever one +# tester object, num_cpus is not necessarily equal to the +# size of system.cpu +cpu_list = [ system.cpu ] * options.num_cpus Ruby.create_system(options = options, full_system = False, - system = system, dma_ports = system.dma_devices) + system = system, dma_ports = system.dma_devices, + cpus = cpu_list) # # The tester is most effective when randomization is turned on and diff --git a/configs/example/ruby_random_test.py b/configs/example/ruby_random_test.py index dc768270a1..da824295dc 100644 --- a/configs/example/ruby_random_test.py +++ b/configs/example/ruby_random_test.py @@ -103,7 +103,13 @@ system.voltage_domain = VoltageDomain(voltage = options.sys_voltage) system.clk_domain = SrcClockDomain(clock = options.sys_clock, voltage_domain = system.voltage_domain) -Ruby.create_system(options, False, system) +# the ruby tester reuses num_cpus to specify the +# number of cpu ports connected to the tester object, which +# is stored in system.cpu. because there is only ever one +# tester object, num_cpus is not necessarily equal to the +# size of system.cpu +cpu_list = [ system.cpu ] * options.num_cpus +Ruby.create_system(options, False, system, cpus=cpu_list) # Create a seperate clock domain for Ruby system.ruby.clk_domain = SrcClockDomain(clock = options.ruby_clock, diff --git a/configs/ruby/CHI.py b/configs/ruby/CHI.py index 0a49371d84..db686eddad 100644 --- a/configs/ruby/CHI.py +++ b/configs/ruby/CHI.py @@ -646,7 +646,7 @@ def noc_params_from_config(config, noc_params): def create_system(options, full_system, system, dma_ports, bootmem, - ruby_system): + ruby_system, cpus): if buildEnv['PROTOCOL'] != 'CHI': m5.panic("This script requires the CHI build") @@ -721,10 +721,10 @@ def create_system(options, full_system, system, dma_ports, bootmem, all_cntrls = [] # Creates on RNF per cpu with priv l2 caches - assert(len(system.cpu) == options.num_cpus) + assert(len(cpus) == options.num_cpus) ruby_system.rnf = [ CHI_RNF([cpu], ruby_system, L1ICache, L1DCache, system.cache_line_size.value) - for cpu in system.cpu ] + for cpu in cpus ] for rnf in ruby_system.rnf: rnf.addPrivL2Cache(L2Cache) cpu_sequencers.extend(rnf.getSequencers()) diff --git a/configs/ruby/MESI_Three_Level.py b/configs/ruby/MESI_Three_Level.py index 91ccb58963..bd0e97ea73 100644 --- a/configs/ruby/MESI_Three_Level.py +++ b/configs/ruby/MESI_Three_Level.py @@ -58,7 +58,7 @@ def define_options(parser): return def create_system(options, full_system, system, dma_ports, bootmem, - ruby_system): + ruby_system, cpus): if buildEnv['PROTOCOL'] != 'MESI_Three_Level': fatal("This script requires the MESI_Three_Level protocol to be\ @@ -108,17 +108,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, start_index_bit = block_size_bits, replacement_policy = LRURP()) - # the ruby random tester reuses num_cpus to specify the - # number of cpu ports connected to the tester object, which - # is stored in system.cpu. because there is only ever one - # tester object, num_cpus is not necessarily equal to the - # size of system.cpu; therefore if len(system.cpu) == 1 - # we use system.cpu[0] to set the clk_domain, thereby ensuring - # we don't index off the end of the cpu list. - if len(system.cpu) == 1: - clk_domain = system.cpu[0].clk_domain - else: - clk_domain = system.cpu[i].clk_domain + clk_domain = cpus[i].clk_domain # Ruby prefetcher prefetcher = RubyPrefetcher( diff --git a/configs/ruby/MESI_Three_Level_HTM.py b/configs/ruby/MESI_Three_Level_HTM.py index f39e457af3..946b6412b1 100644 --- a/configs/ruby/MESI_Three_Level_HTM.py +++ b/configs/ruby/MESI_Three_Level_HTM.py @@ -58,7 +58,7 @@ def define_options(parser): return def create_system(options, full_system, system, dma_ports, bootmem, - ruby_system): + ruby_system, cpus): if buildEnv['PROTOCOL'] != 'MESI_Three_Level_HTM': fatal("This script requires the MESI_Three_Level protocol to be\ @@ -108,17 +108,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, start_index_bit = block_size_bits, replacement_policy = LRURP()) - # the ruby random tester reuses num_cpus to specify the - # number of cpu ports connected to the tester object, which - # is stored in system.cpu. because there is only ever one - # tester object, num_cpus is not necessarily equal to the - # size of system.cpu; therefore if len(system.cpu) == 1 - # we use system.cpu[0] to set the clk_domain, thereby ensuring - # we don't index off the end of the cpu list. - if len(system.cpu) == 1: - clk_domain = system.cpu[0].clk_domain - else: - clk_domain = system.cpu[i].clk_domain + clk_domain = cpus[i].clk_domain # Ruby prefetcher prefetcher = RubyPrefetcher( diff --git a/configs/ruby/MESI_Two_Level.py b/configs/ruby/MESI_Two_Level.py index 96650e0106..e6d91cea33 100644 --- a/configs/ruby/MESI_Two_Level.py +++ b/configs/ruby/MESI_Two_Level.py @@ -42,7 +42,7 @@ def define_options(parser): return def create_system(options, full_system, system, dma_ports, bootmem, - ruby_system): + ruby_system, cpus): if buildEnv['PROTOCOL'] != 'MESI_Two_Level': fatal("This script requires the MESI_Two_Level protocol to be built.") @@ -80,17 +80,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, prefetcher = RubyPrefetcher() - # the ruby random tester reuses num_cpus to specify the - # number of cpu ports connected to the tester object, which - # is stored in system.cpu. because there is only ever one - # tester object, num_cpus is not necessarily equal to the - # size of system.cpu; therefore if len(system.cpu) == 1 - # we use system.cpu[0] to set the clk_domain, thereby ensuring - # we don't index off the end of the cpu list. - if len(system.cpu) == 1: - clk_domain = system.cpu[0].clk_domain - else: - clk_domain = system.cpu[i].clk_domain + clk_domain = cpus[i].clk_domain l1_cntrl = L1Cache_Controller(version = i, L1Icache = l1i_cache, L1Dcache = l1d_cache, diff --git a/configs/ruby/MI_example.py b/configs/ruby/MI_example.py index 6e5c8b4e27..79259d9339 100644 --- a/configs/ruby/MI_example.py +++ b/configs/ruby/MI_example.py @@ -41,7 +41,7 @@ def define_options(parser): return def create_system(options, full_system, system, dma_ports, bootmem, - ruby_system): + ruby_system, cpus): if buildEnv['PROTOCOL'] != 'MI_example': panic("This script requires the MI_example protocol to be built.") @@ -73,17 +73,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, start_index_bit = block_size_bits) - # the ruby random tester reuses num_cpus to specify the - # number of cpu ports connected to the tester object, which - # is stored in system.cpu. because there is only ever one - # tester object, num_cpus is not necessarily equal to the - # size of system.cpu; therefore if len(system.cpu) == 1 - # we use system.cpu[0] to set the clk_domain, thereby ensuring - # we don't index off the end of the cpu list. - if len(system.cpu) == 1: - clk_domain = system.cpu[0].clk_domain - else: - clk_domain = system.cpu[i].clk_domain + clk_domain = cpus[i].clk_domain # Only one unified L1 cache exists. Can cache instructions and data. l1_cntrl = L1Cache_Controller(version=i, cacheMemory=cache, diff --git a/configs/ruby/MOESI_CMP_directory.py b/configs/ruby/MOESI_CMP_directory.py index 5366fe7ab1..1257f6de67 100644 --- a/configs/ruby/MOESI_CMP_directory.py +++ b/configs/ruby/MOESI_CMP_directory.py @@ -59,7 +59,7 @@ def define_options(parser): return def create_system(options, full_system, system, dma_ports, bootmem, - ruby_system): + ruby_system, cpus): if buildEnv['PROTOCOL'] != 'MOESI_CMP_directory': panic("This script requires the MOESI_CMP_directory protocol to be built.") @@ -94,17 +94,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, start_index_bit = block_size_bits, is_icache = False) - # the ruby random tester reuses num_cpus to specify the - # number of cpu ports connected to the tester object, which - # is stored in system.cpu. because there is only ever one - # tester object, num_cpus is not necessarily equal to the - # size of system.cpu; therefore if len(system.cpu) == 1 - # we use system.cpu[0] to set the clk_domain, thereby ensuring - # we don't index off the end of the cpu list. - if len(system.cpu) == 1: - clk_domain = system.cpu[0].clk_domain - else: - clk_domain = system.cpu[i].clk_domain + clk_domain = cpus[i].clk_domain l1_cntrl = L1Cache_Controller(version=i, L1Icache=l1i_cache, L1Dcache=l1d_cache, diff --git a/configs/ruby/MOESI_CMP_token.py b/configs/ruby/MOESI_CMP_token.py index 28ec52f3dd..91d02a0147 100644 --- a/configs/ruby/MOESI_CMP_token.py +++ b/configs/ruby/MOESI_CMP_token.py @@ -49,7 +49,7 @@ def define_options(parser): help="allow migratory sharing for atomic only accessed blocks") def create_system(options, full_system, system, dma_ports, bootmem, - ruby_system): + ruby_system, cpus): if buildEnv['PROTOCOL'] != 'MOESI_CMP_token': panic("This script requires the MOESI_CMP_token protocol to be built.") @@ -89,17 +89,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, assoc = options.l1d_assoc, start_index_bit = block_size_bits) - # the ruby random tester reuses num_cpus to specify the - # number of cpu ports connected to the tester object, which - # is stored in system.cpu. because there is only ever one - # tester object, num_cpus is not necessarily equal to the - # size of system.cpu; therefore if len(system.cpu) == 1 - # we use system.cpu[0] to set the clk_domain, thereby ensuring - # we don't index off the end of the cpu list. - if len(system.cpu) == 1: - clk_domain = system.cpu[0].clk_domain - else: - clk_domain = system.cpu[i].clk_domain + clk_domain = cpus[i].clk_domain l1_cntrl = L1Cache_Controller(version=i, L1Icache=l1i_cache, L1Dcache=l1d_cache, diff --git a/configs/ruby/MOESI_hammer.py b/configs/ruby/MOESI_hammer.py index 1e00f0f479..adff1c9a38 100644 --- a/configs/ruby/MOESI_hammer.py +++ b/configs/ruby/MOESI_hammer.py @@ -52,7 +52,7 @@ def define_options(parser): help="Hammer: enable Full-bit Directory") def create_system(options, full_system, system, dma_ports, bootmem, - ruby_system): + ruby_system, cpus): if buildEnv['PROTOCOL'] != 'MOESI_hammer': panic("This script requires the MOESI_hammer protocol to be built.") @@ -88,17 +88,7 @@ def create_system(options, full_system, system, dma_ports, bootmem, assoc = options.l2_assoc, start_index_bit = block_size_bits) - # the ruby random tester reuses num_cpus to specify the - # number of cpu ports connected to the tester object, which - # is stored in system.cpu. because there is only ever one - # tester object, num_cpus is not necessarily equal to the - # size of system.cpu; therefore if len(system.cpu) == 1 - # we use system.cpu[0] to set the clk_domain, thereby ensuring - # we don't index off the end of the cpu list. - if len(system.cpu) == 1: - clk_domain = system.cpu[0].clk_domain - else: - clk_domain = system.cpu[i].clk_domain + clk_domain = cpus[i].clk_domain l1_cntrl = L1Cache_Controller(version=i, L1Icache=l1i_cache, L1Dcache=l1d_cache, L2cache=l2_cache, diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py index 2bed3419cf..e7609f42d4 100644 --- a/configs/ruby/Ruby.py +++ b/configs/ruby/Ruby.py @@ -172,7 +172,7 @@ def create_topology(controllers, options): return topology def create_system(options, full_system, system, piobus = None, dma_ports = [], - bootmem=None): + bootmem=None, cpus=None): system.ruby = RubySystem() ruby = system.ruby @@ -185,12 +185,15 @@ def create_system(options, full_system, system, piobus = None, dma_ports = [], Network.create_network(options, ruby) ruby.network = network + if cpus is None: + cpus = system.cpu + protocol = buildEnv['PROTOCOL'] exec("from . import %s" % protocol) try: (cpu_sequencers, dir_cntrls, topology) = \ eval("%s.create_system(options, full_system, system, dma_ports,\ - bootmem, ruby)" + bootmem, ruby, cpus)" % protocol) except: print("Error: could not create sytem for ruby protocol %s" % protocol) diff --git a/tests/configs/gpu-randomtest-ruby.py b/tests/configs/gpu-randomtest-ruby.py index 3d088f4ecc..246affa7eb 100644 --- a/tests/configs/gpu-randomtest-ruby.py +++ b/tests/configs/gpu-randomtest-ruby.py @@ -100,7 +100,13 @@ system.clk_domain = SrcClockDomain(clock = '1GHz', system.mem_ranges = AddrRange('256MB') -Ruby.create_system(options, False, system) +# the ruby tester reuses num_cpus to specify the +# number of cpu ports connected to the tester object, which +# is stored in system.cpu. because there is only ever one +# tester object, num_cpus is not necessarily equal to the +# size of system.cpu +cpu_list = [ system.cpu ] * options.num_cpus +Ruby.create_system(options, False, system, cpus=cpu_list) # Create a separate clock domain for Ruby system.ruby.clk_domain = SrcClockDomain(clock = '1GHz', diff --git a/tests/configs/rubytest-ruby.py b/tests/configs/rubytest-ruby.py index 5c01cffee9..0db7e38060 100644 --- a/tests/configs/rubytest-ruby.py +++ b/tests/configs/rubytest-ruby.py @@ -80,7 +80,13 @@ system.clk_domain = SrcClockDomain(clock = '1GHz', system.mem_ranges = AddrRange('256MB') -Ruby.create_system(options, False, system) +# the ruby tester reuses num_cpus to specify the +# number of cpu ports connected to the tester object, which +# is stored in system.cpu. because there is only ever one +# tester object, num_cpus is not necessarily equal to the +# size of system.cpu +cpu_list = [ system.cpu ] * options.num_cpus +Ruby.create_system(options, False, system, cpus=cpu_list) # Create a separate clock domain for Ruby system.ruby.clk_domain = SrcClockDomain(clock = '1GHz',