simple-timing-mp-ruby.py revision 13618:47a709f53226
12381SN/A# Copyright (c) 2006-2007 The Regents of The University of Michigan
22592SN/A# All rights reserved.
32381SN/A#
42381SN/A# Redistribution and use in source and binary forms, with or without
52381SN/A# modification, are permitted provided that the following conditions are
62381SN/A# met: redistributions of source code must retain the above copyright
72381SN/A# notice, this list of conditions and the following disclaimer;
82381SN/A# redistributions in binary form must reproduce the above copyright
92381SN/A# notice, this list of conditions and the following disclaimer in the
102381SN/A# documentation and/or other materials provided with the distribution;
112381SN/A# neither the name of the copyright holders nor the names of its
122381SN/A# contributors may be used to endorse or promote products derived from
132381SN/A# this software without specific prior written permission.
142381SN/A#
152381SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
162381SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
172381SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
182381SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
192381SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
202381SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
212381SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
222381SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
232381SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
242381SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
252381SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262381SN/A#
272665Ssaidi@eecs.umich.edu# Authors: Ron Dreslinski
282665Ssaidi@eecs.umich.edu
292665Ssaidi@eecs.umich.eduimport m5
302665Ssaidi@eecs.umich.edufrom m5.objects import *
312381SN/Afrom m5.defines import buildEnv
322381SN/Afrom m5.util import addToPath
332381SN/Aimport os, optparse, sys
342381SN/A
352662Sstever@eecs.umich.edum5.util.addToPath('../configs/')
362381SN/A
372381SN/Afrom common import Options
382381SN/Afrom ruby import Ruby
392381SN/A
402381SN/Aparser = optparse.OptionParser()
413348Sbinkertn@umich.eduOptions.addCommonOptions(parser)
423348Sbinkertn@umich.edu
433348Sbinkertn@umich.edu# Add the ruby specific and protocol specific options
442392SN/ARuby.define_options(parser)
452980Sgblack@eecs.umich.edu
462394SN/A(options, args) = parser.parse_args()
472394SN/A
482394SN/A#
492394SN/A# Set the default cache size and associativity to be very small to encourage
502394SN/A# races between requests and writebacks.
512812Srdreslin@umich.edu#
522812Srdreslin@umich.eduoptions.l1d_size="256B"
532812Srdreslin@umich.eduoptions.l1i_size="256B"
542812Srdreslin@umich.eduoptions.l2_size="512B"
552812Srdreslin@umich.eduoptions.l3_size="1kB"
562812Srdreslin@umich.eduoptions.l1d_assoc=2
572813Srdreslin@umich.eduoptions.l1i_assoc=2
582813Srdreslin@umich.eduoptions.l2_assoc=2
592813Srdreslin@umich.eduoptions.l3_assoc=2
603074Srdreslin@umich.edu
612382SN/Anb_cores = 4
623208Srdreslin@umich.educpus = [ TimingSimpleCPU(cpu_id=i) for i in xrange(nb_cores) ]
633214Srdreslin@umich.edu
642381SN/A# overwrite the num_cpus to equal nb_cores
652662Sstever@eecs.umich.eduoptions.num_cpus = nb_cores
662662Sstever@eecs.umich.edu
672662Sstever@eecs.umich.edu# system simulated
682662Sstever@eecs.umich.edusystem = System(cpu = cpus, clk_domain = SrcClockDomain(clock = '1GHz'))
692662Sstever@eecs.umich.edu
702381SN/A# Create a seperate clock domain for components that should run at
712641Sstever@eecs.umich.edu# CPUs frequency
722381SN/Asystem.cpu.clk_domain = SrcClockDomain(clock = '2GHz')
732813Srdreslin@umich.edu
742813Srdreslin@umich.eduRuby.create_system(options, False, system)
752813Srdreslin@umich.edu
762813Srdreslin@umich.edu# Create a separate clock domain for Ruby
772566SN/Asystem.ruby.clk_domain = SrcClockDomain(clock = options.ruby_clock)
782662Sstever@eecs.umich.edu
792662Sstever@eecs.umich.eduassert(options.num_cpus == len(system.ruby._cpu_ports))
802662Sstever@eecs.umich.edu
812662Sstever@eecs.umich.edufor (i, cpu) in enumerate(system.cpu):
822662Sstever@eecs.umich.edu    # create the interrupt controller
832566SN/A    cpu.createInterruptController()
842566SN/A
852566SN/A    #
862662Sstever@eecs.umich.edu    # Tie the cpu ports to the ruby cpu ports
872662Sstever@eecs.umich.edu    #
882566SN/A    cpu.connectAllPorts(system.ruby._cpu_ports[i])
892662Sstever@eecs.umich.edu
902662Sstever@eecs.umich.edu# -----------------------
912566SN/A# run simulation
922662Sstever@eecs.umich.edu# -----------------------
932662Sstever@eecs.umich.edu
942566SN/Aroot = Root( full_system=False, system = system )
952566SN/Aroot.system.mem_mode = 'timing'
962662Sstever@eecs.umich.edu