Ruby.py revision 7011
112863Sgabeblack@google.com# Copyright (c) 2006-2007 The Regents of The University of Michigan 212863Sgabeblack@google.com# Copyright (c) 2009 Advanced Micro Devices, Inc. 312863Sgabeblack@google.com# All rights reserved. 412863Sgabeblack@google.com# 512863Sgabeblack@google.com# Redistribution and use in source and binary forms, with or without 612863Sgabeblack@google.com# modification, are permitted provided that the following conditions are 712863Sgabeblack@google.com# met: redistributions of source code must retain the above copyright 812863Sgabeblack@google.com# notice, this list of conditions and the following disclaimer; 912863Sgabeblack@google.com# redistributions in binary form must reproduce the above copyright 1012863Sgabeblack@google.com# notice, this list of conditions and the following disclaimer in the 1112863Sgabeblack@google.com# documentation and/or other materials provided with the distribution; 1212863Sgabeblack@google.com# neither the name of the copyright holders nor the names of its 1312863Sgabeblack@google.com# contributors may be used to endorse or promote products derived from 1412863Sgabeblack@google.com# this software without specific prior written permission. 1512863Sgabeblack@google.com# 1612863Sgabeblack@google.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712863Sgabeblack@google.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812863Sgabeblack@google.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912863Sgabeblack@google.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012863Sgabeblack@google.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112863Sgabeblack@google.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212863Sgabeblack@google.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312863Sgabeblack@google.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412863Sgabeblack@google.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512863Sgabeblack@google.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612863Sgabeblack@google.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712863Sgabeblack@google.com# 2812863Sgabeblack@google.com# Authors: Brad Beckmann 2912863Sgabeblack@google.com 3012863Sgabeblack@google.comimport m5 3112863Sgabeblack@google.comfrom m5.objects import * 3212950Sgabeblack@google.comfrom m5.defines import buildEnv 3312863Sgabeblack@google.comfrom m5.util import addToPath 3412863Sgabeblack@google.comaddToPath('../ruby/networks') 3513317Sgabeblack@google.comfrom MeshDirCorners import * 3613191Sgabeblack@google.com 3713091Sgabeblack@google.comprotocol = buildEnv['PROTOCOL'] 3813079Sgabeblack@google.com 3912863Sgabeblack@google.comexec "import %s" % protocol 4012950Sgabeblack@google.com 4112863Sgabeblack@google.comdef create_system(options, physmem, piobus = None, dma_devices = []): 4212863Sgabeblack@google.com 4312863Sgabeblack@google.com try: 4412863Sgabeblack@google.com (cpu_sequencers, dir_cntrls, all_cntrls) = \ 4512863Sgabeblack@google.com eval("%s.create_system(options, physmem, piobus, dma_devices)" \ 4612863Sgabeblack@google.com % protocol) 4712950Sgabeblack@google.com except: 4812863Sgabeblack@google.com print "Error: could not create sytem for ruby protocol %s" % protocol 4912863Sgabeblack@google.com sys.exit(1) 5012863Sgabeblack@google.com 5113303Sgabeblack@google.com # 5213303Sgabeblack@google.com # Important: the topology constructor must be called before the network 5313191Sgabeblack@google.com # constructor. 5413191Sgabeblack@google.com # 5513291Sgabeblack@google.com if options.topology == "crossbar": 5612950Sgabeblack@google.com net_topology = makeCrossbar(all_cntrls) 5712950Sgabeblack@google.com elif options.topology == "mesh": 5812950Sgabeblack@google.com # 5912950Sgabeblack@google.com # The uniform mesh topology assumes one router per cpu 6012950Sgabeblack@google.com # 6113079Sgabeblack@google.com net_topology = makeMesh(all_cntrls, 6213079Sgabeblack@google.com len(cpu_sequencers), 6313268Sgabeblack@google.com options.mesh_rows) 6413268Sgabeblack@google.com 6513079Sgabeblack@google.com elif options.topology == "mesh_dir_corner": 6613268Sgabeblack@google.com # 6713268Sgabeblack@google.com # The uniform mesh topology assumes one router per cpu 6813268Sgabeblack@google.com # 6913268Sgabeblack@google.com net_topology = makeMeshDirCorners(all_cntrls, 7013268Sgabeblack@google.com len(cpu_sequencers), 7113268Sgabeblack@google.com options.mesh_rows) 7213079Sgabeblack@google.com 7313079Sgabeblack@google.com if options.garnet_network == "fixed": 7412982Sgabeblack@google.com network = GarnetNetwork_d(topology = net_topology) 7512863Sgabeblack@google.com elif options.garnet_network == "flexible": 7612950Sgabeblack@google.com network = GarnetNetwork(topology = net_topology) 7712863Sgabeblack@google.com else: 7812950Sgabeblack@google.com network = SimpleNetwork(topology = net_topology) 7912950Sgabeblack@google.com 8012863Sgabeblack@google.com # 8113268Sgabeblack@google.com # determine the total memory size of the ruby system and verify it is equal 8213268Sgabeblack@google.com # to physmem 8313268Sgabeblack@google.com # 8413268Sgabeblack@google.com total_mem_size = MemorySize('0B') 8513268Sgabeblack@google.com for dir_cntrl in dir_cntrls: 8613268Sgabeblack@google.com total_mem_size.value += dir_cntrl.directory.size.value 8713268Sgabeblack@google.com physmem_size = long(physmem.range.second) - long(physmem.range.first) + 1 8813268Sgabeblack@google.com assert(total_mem_size.value == physmem_size) 8913268Sgabeblack@google.com 9013268Sgabeblack@google.com ruby_profiler = RubyProfiler(num_of_sequencers = len(cpu_sequencers)) 9113268Sgabeblack@google.com 9212863Sgabeblack@google.com ruby = RubySystem(clock = options.clock, 9312863Sgabeblack@google.com network = network, 9412863Sgabeblack@google.com profiler = ruby_profiler, 9512863Sgabeblack@google.com tracer = RubyTracer(), 9612863Sgabeblack@google.com debug = RubyDebug(filter_string = 'none', 9713268Sgabeblack@google.com verbosity_string = 'none', 9813268Sgabeblack@google.com protocol_trace = False), 9913268Sgabeblack@google.com mem_size = total_mem_size) 10012950Sgabeblack@google.com 10113268Sgabeblack@google.com ruby.cpu_ruby_ports = cpu_sequencers 10212950Sgabeblack@google.com 10313268Sgabeblack@google.com return ruby 10412863Sgabeblack@google.com