Ruby.py revision 7032
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 346892SBrad.Beckmann@amd.com 356893SBrad.Beckmann@amd.comdef create_system(options, physmem, piobus = None, dma_devices = []): 366892SBrad.Beckmann@amd.com 377032SBrad.Beckmann@amd.com protocol = buildEnv['PROTOCOL'] 387032SBrad.Beckmann@amd.com exec "import %s" % protocol 396923SBrad.Beckmann@amd.com try: 406893SBrad.Beckmann@amd.com (cpu_sequencers, dir_cntrls, all_cntrls) = \ 416923SBrad.Beckmann@amd.com eval("%s.create_system(options, physmem, piobus, dma_devices)" \ 426923SBrad.Beckmann@amd.com % protocol) 436923SBrad.Beckmann@amd.com except: 446923SBrad.Beckmann@amd.com print "Error: could not create sytem for ruby protocol %s" % protocol 456923SBrad.Beckmann@amd.com sys.exit(1) 466923SBrad.Beckmann@amd.com 476892SBrad.Beckmann@amd.com # 487032SBrad.Beckmann@amd.com # Important: the topology must be created before the network and after the 497032SBrad.Beckmann@amd.com # controllers. 506892SBrad.Beckmann@amd.com # 517032SBrad.Beckmann@amd.com exec "import %s" % options.topology 527032SBrad.Beckmann@amd.com try: 537032SBrad.Beckmann@amd.com net_topology = eval("%s.makeTopology(all_cntrls, options)" % options.topology) 547032SBrad.Beckmann@amd.com except: 557032SBrad.Beckmann@amd.com print "Error: could not create topology %s" % options.topology 567032SBrad.Beckmann@amd.com sys.exit(1) 577011SBrad.Beckmann@amd.com 586918SBrad.Beckmann@amd.com if options.garnet_network == "fixed": 596918SBrad.Beckmann@amd.com network = GarnetNetwork_d(topology = net_topology) 606918SBrad.Beckmann@amd.com elif options.garnet_network == "flexible": 616918SBrad.Beckmann@amd.com network = GarnetNetwork(topology = net_topology) 626918SBrad.Beckmann@amd.com else: 636918SBrad.Beckmann@amd.com network = SimpleNetwork(topology = net_topology) 646892SBrad.Beckmann@amd.com 656903SBrad.Beckmann@amd.com # 667025SBrad.Beckmann@amd.com # Determine the total memory size of the ruby system and verify it is equal 677025SBrad.Beckmann@amd.com # to physmem. However, if Ruby memory is using sparse memory in SE 687025SBrad.Beckmann@amd.com # mode, then the system should not back-up the memory state with 697025SBrad.Beckmann@amd.com # the Memory Vector and thus the memory size bytes should stay at 0. 706903SBrad.Beckmann@amd.com # 716903SBrad.Beckmann@amd.com total_mem_size = MemorySize('0B') 726903SBrad.Beckmann@amd.com for dir_cntrl in dir_cntrls: 736903SBrad.Beckmann@amd.com total_mem_size.value += dir_cntrl.directory.size.value 746905SBrad.Beckmann@amd.com physmem_size = long(physmem.range.second) - long(physmem.range.first) + 1 756905SBrad.Beckmann@amd.com assert(total_mem_size.value == physmem_size) 766892SBrad.Beckmann@amd.com 776897SBrad.Beckmann@amd.com ruby_profiler = RubyProfiler(num_of_sequencers = len(cpu_sequencers)) 786892SBrad.Beckmann@amd.com 796893SBrad.Beckmann@amd.com ruby = RubySystem(clock = options.clock, 806892SBrad.Beckmann@amd.com network = network, 816892SBrad.Beckmann@amd.com profiler = ruby_profiler, 826892SBrad.Beckmann@amd.com tracer = RubyTracer(), 836892SBrad.Beckmann@amd.com debug = RubyDebug(filter_string = 'none', 846892SBrad.Beckmann@amd.com verbosity_string = 'none', 856892SBrad.Beckmann@amd.com protocol_trace = False), 866903SBrad.Beckmann@amd.com mem_size = total_mem_size) 876892SBrad.Beckmann@amd.com 886893SBrad.Beckmann@amd.com ruby.cpu_ruby_ports = cpu_sequencers 896892SBrad.Beckmann@amd.com 906892SBrad.Beckmann@amd.com return ruby 91