simple-timing-mp-ruby.py revision 9067
111106Spower.jg@gmail.com# Copyright (c) 2006-2007 The Regents of The University of Michigan 211106Spower.jg@gmail.com# All rights reserved. 311106Spower.jg@gmail.com# 411106Spower.jg@gmail.com# Redistribution and use in source and binary forms, with or without 511106Spower.jg@gmail.com# modification, are permitted provided that the following conditions are 611106Spower.jg@gmail.com# met: redistributions of source code must retain the above copyright 711106Spower.jg@gmail.com# notice, this list of conditions and the following disclaimer; 811106Spower.jg@gmail.com# redistributions in binary form must reproduce the above copyright 911106Spower.jg@gmail.com# notice, this list of conditions and the following disclaimer in the 1011106Spower.jg@gmail.com# documentation and/or other materials provided with the distribution; 1111106Spower.jg@gmail.com# neither the name of the copyright holders nor the names of its 1211106Spower.jg@gmail.com# contributors may be used to endorse or promote products derived from 1311106Spower.jg@gmail.com# this software without specific prior written permission. 1411106Spower.jg@gmail.com# 1511106Spower.jg@gmail.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1611106Spower.jg@gmail.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1711570SCurtis.Dunham@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1811106Spower.jg@gmail.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1911312Santhony.gutierrez@amd.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2011106Spower.jg@gmail.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2111106Spower.jg@gmail.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2211106Spower.jg@gmail.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2311106Spower.jg@gmail.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2411106Spower.jg@gmail.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2511106Spower.jg@gmail.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2611680SCurtis.Dunham@arm.com# 2711106Spower.jg@gmail.com# Authors: Ron Dreslinski 2811106Spower.jg@gmail.com 2911219Snilay@cs.wisc.eduimport m5 3011106Spower.jg@gmail.comfrom m5.objects import * 3111570SCurtis.Dunham@arm.comfrom m5.defines import buildEnv 3211570SCurtis.Dunham@arm.comfrom m5.util import addToPath 3311570SCurtis.Dunham@arm.comimport os, optparse, sys 3411570SCurtis.Dunham@arm.com 3511106Spower.jg@gmail.com# Get paths we might need 3611106Spower.jg@gmail.comconfig_path = os.path.dirname(os.path.abspath(__file__)) 3711440SCurtis.Dunham@arm.comconfig_root = os.path.dirname(config_path) 3811440SCurtis.Dunham@arm.comm5_root = os.path.dirname(config_root) 3911106Spower.jg@gmail.comaddToPath(config_root+'/configs/common') 4011106Spower.jg@gmail.comaddToPath(config_root+'/configs/ruby') 4111106Spower.jg@gmail.com 4211106Spower.jg@gmail.comimport Options 4311106Spower.jg@gmail.comimport Ruby 4411106Spower.jg@gmail.com 4511106Spower.jg@gmail.comparser = optparse.OptionParser() 4611106Spower.jg@gmail.comOptions.addCommonOptions(parser) 4711106Spower.jg@gmail.com 4811106Spower.jg@gmail.com# Add the ruby specific and protocol specific options 4911106Spower.jg@gmail.comRuby.define_options(parser) 5011106Spower.jg@gmail.com 5111106Spower.jg@gmail.com(options, args) = parser.parse_args() 5211106Spower.jg@gmail.com 5311106Spower.jg@gmail.com# 5411106Spower.jg@gmail.com# Set the default cache size and associativity to be very small to encourage 5511106Spower.jg@gmail.com# races between requests and writebacks. 5611106Spower.jg@gmail.com# 5711106Spower.jg@gmail.comoptions.l1d_size="256B" 5811106Spower.jg@gmail.comoptions.l1i_size="256B" 5911106Spower.jg@gmail.comoptions.l2_size="512B" 6011106Spower.jg@gmail.comoptions.l3_size="1kB" 6111106Spower.jg@gmail.comoptions.l1d_assoc=2 6211106Spower.jg@gmail.comoptions.l1i_assoc=2 6311106Spower.jg@gmail.comoptions.l2_assoc=2 6411106Spower.jg@gmail.comoptions.l3_assoc=2 6511106Spower.jg@gmail.com 6611106Spower.jg@gmail.comnb_cores = 4 6711106Spower.jg@gmail.comcpus = [ TimingSimpleCPU(cpu_id=i) for i in xrange(nb_cores) ] 6811106Spower.jg@gmail.com 6911570SCurtis.Dunham@arm.com# overwrite the num_cpus to equal nb_cores 7011106Spower.jg@gmail.comoptions.num_cpus = nb_cores 7111106Spower.jg@gmail.com 7211106Spower.jg@gmail.com# system simulated 7311106Spower.jg@gmail.comsystem = System(cpu = cpus, physmem = SimpleMemory()) 7411106Spower.jg@gmail.com 7511106Spower.jg@gmail.comRuby.create_system(options, system) 7611106Spower.jg@gmail.com 7711106Spower.jg@gmail.comassert(options.num_cpus == len(system.ruby._cpu_ruby_ports)) 7811106Spower.jg@gmail.com 7911106Spower.jg@gmail.comfor (i, cpu) in enumerate(system.cpu): 8011106Spower.jg@gmail.com # create the interrupt controller 8111106Spower.jg@gmail.com cpu.createInterruptController() 8211106Spower.jg@gmail.com 8311106Spower.jg@gmail.com # 8411106Spower.jg@gmail.com # Tie the cpu ports to the ruby cpu ports 8511570SCurtis.Dunham@arm.com # 8611570SCurtis.Dunham@arm.com cpu.connectAllPorts(system.ruby._cpu_ruby_ports[i]) 8711570SCurtis.Dunham@arm.com 8811570SCurtis.Dunham@arm.com# ----------------------- 8911106Spower.jg@gmail.com# run simulation 9011106Spower.jg@gmail.com# ----------------------- 9111106Spower.jg@gmail.com 9211106Spower.jg@gmail.comroot = Root( full_system=False, system = system ) 9311106Spower.jg@gmail.comroot.system.mem_mode = 'timing' 9411106Spower.jg@gmail.com 9511106Spower.jg@gmail.com# Not much point in this being higher than the L1 latency 9611106Spower.jg@gmail.comm5.ticks.setGlobalFrequency('1ns') 9711106Spower.jg@gmail.com