Ruby.py revision 7011
16892SBrad.Beckmann@amd.com# Copyright (c) 2006-2007 The Regents of The University of Michigan 26892SBrad.Beckmann@amd.com# Copyright (c) 2009 Advanced Micro Devices, Inc. 36892SBrad.Beckmann@amd.com# All rights reserved. 46892SBrad.Beckmann@amd.com# 56892SBrad.Beckmann@amd.com# Redistribution and use in source and binary forms, with or without 66892SBrad.Beckmann@amd.com# modification, are permitted provided that the following conditions are 76892SBrad.Beckmann@amd.com# met: redistributions of source code must retain the above copyright 86892SBrad.Beckmann@amd.com# notice, this list of conditions and the following disclaimer; 96892SBrad.Beckmann@amd.com# redistributions in binary form must reproduce the above copyright 106892SBrad.Beckmann@amd.com# notice, this list of conditions and the following disclaimer in the 116892SBrad.Beckmann@amd.com# documentation and/or other materials provided with the distribution; 126892SBrad.Beckmann@amd.com# neither the name of the copyright holders nor the names of its 136892SBrad.Beckmann@amd.com# contributors may be used to endorse or promote products derived from 146892SBrad.Beckmann@amd.com# this software without specific prior written permission. 156892SBrad.Beckmann@amd.com# 166892SBrad.Beckmann@amd.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176892SBrad.Beckmann@amd.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186892SBrad.Beckmann@amd.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196892SBrad.Beckmann@amd.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206892SBrad.Beckmann@amd.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216892SBrad.Beckmann@amd.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226892SBrad.Beckmann@amd.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236892SBrad.Beckmann@amd.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246892SBrad.Beckmann@amd.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256892SBrad.Beckmann@amd.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266892SBrad.Beckmann@amd.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276892SBrad.Beckmann@amd.com# 286892SBrad.Beckmann@amd.com# Authors: Brad Beckmann 296892SBrad.Beckmann@amd.com 306892SBrad.Beckmann@amd.comimport m5 316892SBrad.Beckmann@amd.comfrom m5.objects import * 326892SBrad.Beckmann@amd.comfrom m5.defines import buildEnv 336892SBrad.Beckmann@amd.comfrom m5.util import addToPath 347011SBrad.Beckmann@amd.comaddToPath('../ruby/networks') 357011SBrad.Beckmann@amd.comfrom MeshDirCorners import * 366892SBrad.Beckmann@amd.com 376923SBrad.Beckmann@amd.comprotocol = buildEnv['PROTOCOL'] 386923SBrad.Beckmann@amd.com 396923SBrad.Beckmann@amd.comexec "import %s" % protocol 406892SBrad.Beckmann@amd.com 416893SBrad.Beckmann@amd.comdef create_system(options, physmem, piobus = None, dma_devices = []): 426892SBrad.Beckmann@amd.com 436923SBrad.Beckmann@amd.com try: 446893SBrad.Beckmann@amd.com (cpu_sequencers, dir_cntrls, all_cntrls) = \ 456923SBrad.Beckmann@amd.com eval("%s.create_system(options, physmem, piobus, dma_devices)" \ 466923SBrad.Beckmann@amd.com % protocol) 476923SBrad.Beckmann@amd.com except: 486923SBrad.Beckmann@amd.com print "Error: could not create sytem for ruby protocol %s" % protocol 496923SBrad.Beckmann@amd.com sys.exit(1) 506923SBrad.Beckmann@amd.com 516892SBrad.Beckmann@amd.com # 526892SBrad.Beckmann@amd.com # Important: the topology constructor must be called before the network 536892SBrad.Beckmann@amd.com # constructor. 546892SBrad.Beckmann@amd.com # 556916SBrad.Beckmann@amd.com if options.topology == "crossbar": 566916SBrad.Beckmann@amd.com net_topology = makeCrossbar(all_cntrls) 576916SBrad.Beckmann@amd.com elif options.topology == "mesh": 586916SBrad.Beckmann@amd.com # 596916SBrad.Beckmann@amd.com # The uniform mesh topology assumes one router per cpu 606916SBrad.Beckmann@amd.com # 616916SBrad.Beckmann@amd.com net_topology = makeMesh(all_cntrls, 626916SBrad.Beckmann@amd.com len(cpu_sequencers), 636916SBrad.Beckmann@amd.com options.mesh_rows) 647011SBrad.Beckmann@amd.com 657011SBrad.Beckmann@amd.com elif options.topology == "mesh_dir_corner": 667011SBrad.Beckmann@amd.com # 677011SBrad.Beckmann@amd.com # The uniform mesh topology assumes one router per cpu 687011SBrad.Beckmann@amd.com # 697011SBrad.Beckmann@amd.com net_topology = makeMeshDirCorners(all_cntrls, 707011SBrad.Beckmann@amd.com len(cpu_sequencers), 717011SBrad.Beckmann@amd.com options.mesh_rows) 726916SBrad.Beckmann@amd.com 736918SBrad.Beckmann@amd.com if options.garnet_network == "fixed": 746918SBrad.Beckmann@amd.com network = GarnetNetwork_d(topology = net_topology) 756918SBrad.Beckmann@amd.com elif options.garnet_network == "flexible": 766918SBrad.Beckmann@amd.com network = GarnetNetwork(topology = net_topology) 776918SBrad.Beckmann@amd.com else: 786918SBrad.Beckmann@amd.com network = SimpleNetwork(topology = net_topology) 796892SBrad.Beckmann@amd.com 806903SBrad.Beckmann@amd.com # 816905SBrad.Beckmann@amd.com # determine the total memory size of the ruby system and verify it is equal 826905SBrad.Beckmann@amd.com # to physmem 836903SBrad.Beckmann@amd.com # 846903SBrad.Beckmann@amd.com total_mem_size = MemorySize('0B') 856903SBrad.Beckmann@amd.com for dir_cntrl in dir_cntrls: 866903SBrad.Beckmann@amd.com total_mem_size.value += dir_cntrl.directory.size.value 876905SBrad.Beckmann@amd.com physmem_size = long(physmem.range.second) - long(physmem.range.first) + 1 886905SBrad.Beckmann@amd.com assert(total_mem_size.value == physmem_size) 896892SBrad.Beckmann@amd.com 906897SBrad.Beckmann@amd.com ruby_profiler = RubyProfiler(num_of_sequencers = len(cpu_sequencers)) 916892SBrad.Beckmann@amd.com 926893SBrad.Beckmann@amd.com ruby = RubySystem(clock = options.clock, 936892SBrad.Beckmann@amd.com network = network, 946892SBrad.Beckmann@amd.com profiler = ruby_profiler, 956892SBrad.Beckmann@amd.com tracer = RubyTracer(), 966892SBrad.Beckmann@amd.com debug = RubyDebug(filter_string = 'none', 976892SBrad.Beckmann@amd.com verbosity_string = 'none', 986892SBrad.Beckmann@amd.com protocol_trace = False), 996903SBrad.Beckmann@amd.com mem_size = total_mem_size) 1006892SBrad.Beckmann@amd.com 1016893SBrad.Beckmann@amd.com ruby.cpu_ruby_ports = cpu_sequencers 1026892SBrad.Beckmann@amd.com 1036892SBrad.Beckmann@amd.com return ruby 104