113540Sandrea.mondelli@ucf.edu#!/usr/bin/env python2.7 21310SN/A# Copyright (c) 2005 The Regents of The University of Michigan 31310SN/A# All rights reserved. 41310SN/A# 51310SN/A# Redistribution and use in source and binary forms, with or without 61310SN/A# modification, are permitted provided that the following conditions are 71310SN/A# met: redistributions of source code must retain the above copyright 81310SN/A# notice, this list of conditions and the following disclaimer; 91310SN/A# redistributions in binary form must reproduce the above copyright 101310SN/A# notice, this list of conditions and the following disclaimer in the 111310SN/A# documentation and/or other materials provided with the distribution; 121310SN/A# neither the name of the copyright holders nor the names of its 131310SN/A# contributors may be used to endorse or promote products derived from 141310SN/A# this software without specific prior written permission. 151310SN/A# 161310SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 171310SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 181310SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 191310SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 201310SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 211310SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 221310SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 231310SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 241310SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 251310SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 261310SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu# 282665Ssaidi@eecs.umich.edu# Authors: Nathan Binkert 291310SN/A 3012563Sgabeblack@google.comfrom __future__ import print_function 3112563Sgabeblack@google.com 321320SN/Aimport getopt, os, os.path, sys 331377SN/Afrom os.path import join as joinpath, realpath 341310SN/A 351377SN/Amypath = sys.path[0] 361377SN/Asys.path.append(joinpath(mypath, '..')) 371511SN/Asys.path.append(joinpath(mypath, '../python')) 381385SN/Asys.path.append(joinpath(mypath, '../util/pbs')) 391310SN/A 401511SN/Apathlist = [ '.' ] 411403SN/A 421530SN/Am5_build_env = {} 431530SN/A 441310SN/Atry: 451385SN/A opts, args = getopt.getopt(sys.argv[1:], '-E:I:') 461385SN/A for opt,arg in opts: 471385SN/A if opt == '-E': 481385SN/A offset = arg.find('=') 491310SN/A if offset == -1: 501385SN/A name = arg 511641SN/A value = 'True' 521310SN/A else: 531385SN/A name = arg[:offset] 541385SN/A value = arg[offset+1:] 551455SN/A os.environ[name] = value 561530SN/A m5_build_env[name] = value 571385SN/A if opt == '-I': 581511SN/A pathlist.append(arg) 591310SN/Aexcept getopt.GetoptError: 601310SN/A sys.exit('Improper Usage') 611310SN/A 621692SN/Aimport __main__ 631692SN/A__main__.m5_build_env = m5_build_env 641692SN/A 651511SN/Afrom m5 import * 661511SN/A 671511SN/Afor path in pathlist: 681511SN/A AddToPath(path) 691455SN/A 701310SN/Afor arg in args: 711943SN/A m5execfile(arg, globals()) 721310SN/A 7313675Sandreas.sandberg@arm.comif 'root' in globals() and isinstance(root, Root): 741310SN/A instantiate(root) 751692SN/Aelse: 7612563Sgabeblack@google.com print("Instantiation skipped: no root object found.") 77