fs.py revision 3444
13005Sstever@eecs.umich.edu# Copyright (c) 2006 The Regents of The University of Michigan 23005Sstever@eecs.umich.edu# All rights reserved. 33005Sstever@eecs.umich.edu# 43005Sstever@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 53005Sstever@eecs.umich.edu# modification, are permitted provided that the following conditions are 63005Sstever@eecs.umich.edu# met: redistributions of source code must retain the above copyright 73005Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 83005Sstever@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 93005Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 103005Sstever@eecs.umich.edu# documentation and/or other materials provided with the distribution; 113005Sstever@eecs.umich.edu# neither the name of the copyright holders nor the names of its 123005Sstever@eecs.umich.edu# contributors may be used to endorse or promote products derived from 133005Sstever@eecs.umich.edu# this software without specific prior written permission. 143005Sstever@eecs.umich.edu# 153005Sstever@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 163005Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 173005Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 183005Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 193005Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 203005Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 213005Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 223005Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 233005Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 243005Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 253005Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 263005Sstever@eecs.umich.edu# 273005Sstever@eecs.umich.edu# Authors: Ali Saidi 283005Sstever@eecs.umich.edu 292889SN/Aimport optparse, os, sys 302889SN/A 312710SN/Aimport m5 322710SN/Afrom m5.objects import * 332934SN/Am5.AddToPath('../common') 342934SN/Afrom FSConfig import * 352549SN/Afrom SysPaths import * 362995SN/Afrom Benchmarks import * 373395Shsul@eecs.umich.eduimport Simulation 382549SN/A 393088Sstever@eecs.umich.eduif not m5.build_env['FULL_SYSTEM']: 403088Sstever@eecs.umich.edu m5.panic("This script requires full-system mode (ALPHA_FS).") 413088Sstever@eecs.umich.edu 423444Sktlim@umich.edu# Get paths we might need. It's expected this file is in m5/configs/example. 433444Sktlim@umich.educonfig_path = os.path.dirname(os.path.abspath(__file__)) 443444Sktlim@umich.educonfig_root = os.path.dirname(config_path) 453444Sktlim@umich.edu 462889SN/Aparser = optparse.OptionParser() 472710SN/A 483322Shsul@eecs.umich.edu# Benchmark options 492995SN/Aparser.add_option("--dual", action="store_true", 502995SN/A help="Simulate two systems attached with an ethernet link") 512995SN/Aparser.add_option("-b", "--benchmark", action="store", type="string", 522995SN/A dest="benchmark", 532995SN/A help="Specify the benchmark to run. Available benchmarks: %s"\ 543143Shsul@eecs.umich.edu % DefinedBenchmarks) 553322Shsul@eecs.umich.edu 563322Shsul@eecs.umich.edu# Metafile options 573025Ssaidi@eecs.umich.eduparser.add_option("--etherdump", action="store", type="string", dest="etherdump", 583143Shsul@eecs.umich.edu help="Specify the filename to dump a pcap capture of the" \ 593143Shsul@eecs.umich.edu "ethernet traffic") 603322Shsul@eecs.umich.edu 613444Sktlim@umich.eduexecfile(os.path.join(config_root, "common", "Options.py")) 623322Shsul@eecs.umich.edu 632710SN/A(options, args) = parser.parse_args() 642710SN/A 652710SN/Aif args: 662710SN/A print "Error: script doesn't take any positional arguments" 672710SN/A sys.exit(1) 682710SN/A 693322Shsul@eecs.umich.edu# driver system CPU is always simple... note this is an assignment of 703304Sstever@eecs.umich.edu# a class, not an instance. 713322Shsul@eecs.umich.eduDriveCPUClass = AtomicSimpleCPU 723322Shsul@eecs.umich.edudrive_mem_mode = 'atomic' 733304Sstever@eecs.umich.edu 743322Shsul@eecs.umich.edu# system under test can be any of these CPUs 752934SN/Aif options.detailed: 763322Shsul@eecs.umich.edu TestCPUClass = DerivO3CPU 773322Shsul@eecs.umich.edu test_mem_mode = 'timing' 782934SN/Aelif options.timing: 793322Shsul@eecs.umich.edu TestCPUClass = TimingSimpleCPU 803322Shsul@eecs.umich.edu test_mem_mode = 'timing' 812934SN/Aelse: 823322Shsul@eecs.umich.edu TestCPUClass = AtomicSimpleCPU 833322Shsul@eecs.umich.edu test_mem_mode = 'atomic' 842566SN/A 853322Shsul@eecs.umich.eduTestCPUClass.clock = '2GHz' 863322Shsul@eecs.umich.eduDriveCPUClass.clock = '2GHz' 872995SN/A 882995SN/Aif options.benchmark: 893304Sstever@eecs.umich.edu try: 903304Sstever@eecs.umich.edu bm = Benchmarks[options.benchmark] 913304Sstever@eecs.umich.edu except KeyError: 922995SN/A print "Error benchmark %s has not been defined." % options.benchmark 932995SN/A print "Valid benchmarks are: %s" % DefinedBenchmarks 942995SN/A sys.exit(1) 952917SN/Aelse: 962995SN/A if options.dual: 973304Sstever@eecs.umich.edu bm = [SysConfig(), SysConfig()] 982995SN/A else: 993304Sstever@eecs.umich.edu bm = [SysConfig()] 1003304Sstever@eecs.umich.edu 1013322Shsul@eecs.umich.edutest_sys = makeLinuxAlphaSystem(test_mem_mode, bm[0]) 1023312Sstever@eecs.umich.edunp = options.num_cpus 1033322Shsul@eecs.umich.edutest_sys.cpu = [TestCPUClass(cpu_id=i) for i in xrange(np)] 1043312Sstever@eecs.umich.edufor i in xrange(np): 1053322Shsul@eecs.umich.edu if options.caches and not options.standard_switch: 1063395Shsul@eecs.umich.edu test_sys.cpu[i].addPrivateSplitL1Caches(L1Cache(size = '32kB'), 1073395Shsul@eecs.umich.edu L2Cache(size = '64kB')) 1083322Shsul@eecs.umich.edu test_sys.cpu[i].connectMemPorts(test_sys.membus) 1093322Shsul@eecs.umich.edu test_sys.cpu[i].mem = test_sys.physmem 1103005Sstever@eecs.umich.edu 1113005Sstever@eecs.umich.eduif len(bm) == 2: 1123322Shsul@eecs.umich.edu drive_sys = makeLinuxAlphaSystem(drive_mem_mode, bm[1]) 1133322Shsul@eecs.umich.edu drive_sys.cpu = DriveCPUClass(cpu_id=0) 1143322Shsul@eecs.umich.edu drive_sys.cpu.connectMemPorts(drive_sys.membus) 1153322Shsul@eecs.umich.edu drive_sys.cpu.mem = drive_sys.physmem 1163322Shsul@eecs.umich.edu root = makeDualRoot(test_sys, drive_sys, options.etherdump) 1173005Sstever@eecs.umich.eduelif len(bm) == 1: 1183322Shsul@eecs.umich.edu root = Root(clock = '1THz', system = test_sys) 1193005Sstever@eecs.umich.eduelse: 1203005Sstever@eecs.umich.edu print "Error I don't know how to create more than 2 systems." 1213005Sstever@eecs.umich.edu sys.exit(1) 1222566SN/A 1233395Shsul@eecs.umich.eduSimulation.run(options, root, test_sys) 124