Commit a027a138 authored by Anirudh Mohan Kaushik's avatar Anirudh Mohan Kaushik

initial commit

parents

Too many changes to show.

To preserve performance only 373 of 373+ files are displayed.

syntax: glob
build
parser.out
parsetab.py
cscope.files
cscope.out
*.pyc
*~
.*.swp
m5out
src/doxygen
ext/dramsim2/DRAMSim2
ext/mcpat/regression/*/*.out
6b99127531fd692ff0f202e327d0826ed2bfcf5f m5_1.0_beta1
1a40e60270c11ec24f11c783e70367e2740cdc56 m5_1.0_beta1
069849384988e553b6edae71ecaf1fb6e918d738 m5_1.0_beta2
4cfa92eca35d532b339507f1c631e1986d87b258 m5_1.0_tutorial
ffe1942d845c67fb3fd04692420c9433638eba13 m5_1.0_web
af8bf5e4e85ba1a773183cc3f6c43bcdf0ce146a m5_1.1
1c0eeb0dae9b6a2a5479faf3ab52fb1ed0ce703f m5_1.1
c486924ed90eb6805e8cf44ddee5ad5435c79051 m5_1.1
01e679b66ca9474f10f8f96d391693adf76fc73a m5_1.1
2608cd7def85c9fdc84251295c8023fab990d530 m5_1.1
cdd48642d9bf584bd445b40abec9e7f934a5900b m5_1.1
8d690c7c2efced99f7991b7ace56d769bae7cfdd m5_2.0_beta1
d83885ad2b41777c97b94882aa8f07e761e55ac1 m5_2.0_beta1_patch1
1906dcace7c27b2153bfb95ca1218660e1cc1f70 m5_2.0_beta2
b174ae14f007ba0c341f8df77d36f57f48369cc8 m5_2.0_beta2
91a9ac67662aa3a79315ade29b17a85961fecd88 m5_2.0_beta3
dce5a8655829b7d2e24ce40cafc9c8873a71671f m5_2.0_beta5
1ac44b6c87ec71a8410c9a9c219269eca71f8077 m5_2.0_beta4
60a931b03fb165807f02bcccc4f7d0fd705a67a9 copyright_update
d8b246a665c160a31751b4091f097022cde16dd7 m5_2.0_beta6
5de565c4b7bdf46670611858b709c1eb50ad7c5c Calvin_Submission
549b72de8f725bd411a9c73ee0d15ccbdf47bb0f stable_2012_02_02
f75ee4849c404a0c7d93413f443cec640b721f2f stable_2012_06_28
07352f119e489452b3c0bbf6d4f70e21e80e17e3 stable_2013_06_16
6a043adb1e8d67fbb03ac5cee58dd26f75663714 stable_2013_10_14
459491344fcf7f9e29250e71f33a7c7150f54d64 stable_2014_02_15
cb2e6950956d475da97b04c41f19769ce2e8541a stable_2014_08_26
bdb307e8be54a5808a9af2537e9261d88de6ed1b stable_2014_12_14
e1794974515011f81f8d0fda7543ba3360a12c9b stable_2015_04_15
Please see individual files for details of the license on each file.
The preferred license can be found in LICENSE.
All files in this distribution (other than in the ext directory) have
licenses based on the BSD or MIT licenses. Some files in the ext
directory are GNU LGPL. No other licenses are found in this
distribution.
Beyond the BSD license, some files include the following clarification
of the license as required by the copyright holder:
The license below extends only to copyright in the software and
shall not be construed as granting a license to any other
intellectual property including but not limited to intellectual
property relating to a hardware implementation of the
functionality of the software licensed hereunder. You may use the
software subject to the license terms below provided that you
ensure that this notice is replicated unmodified and in its
entirety in all distributions of the software, modified or
unmodified, in source code or in binary form.
The copyright holders include (not counting the ext directory):
Copyright (c) 2000-2011 The Regents of The University of Michigan
Copyright (c) 1990,1993-1995,2007-2010 The Hewlett-Packard Development Company
Copyright (c) 1999-2009,2011 Mark D. Hill and David A. Wood
Copyright (c) 2009-2011 ARM Limited
Copyright (c) 2008-2009 Princeton University
Copyright (c) 2007 MIPS Technologies, Inc.
Copyright (c) 2009-2011 Advanced Micro Devices, Inc.
Copyright (c) 2009 The University of Edinburgh
Copyright (c) 2007-2008 The Florida State University
Copyright (c) 2010 Massachusetts Institute of Technology
Copyright (c) 1990-1993 The Regents of the University of California
Copyright (c) 2006-2009 Nathan Binkert
Copyright (c) 2001 The NetBSD Foundation, Inc.
Copyright (c) 2010-2011 Gabe Black
Copyright (c) 1994 Adam Glass
Copyright (c) 1990-1992 MIPS Computer Systems, Inc.
Copyright (c) 2004 Richard J. Wagner
Copyright (c) 2000 Computer Engineering and Communication Networks Lab
Copyright (c) 2001 Eric Jackson
Copyright (c) 1990 Hewlett-Packard Development Company
Copyright (c) 1994-1996 Carnegie-Mellon University.
Copyright (c) 1993-1994 Christopher G. Demetriou
Copyright (c) 1997-2002 Makoto Matsumoto and Takuji Nishimura
Copyright (c) 1998,2001 Manuel Bouyer.
Copyright (c) <date> <copyright holder>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met: redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer;
redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution;
neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This is the gem5 simulator.
The main website can be found at http://www.gem5.org
A good starting point is http://www.gem5.org/Introduction, and for
more information about building the simulator and getting started
please see http://www.gem5.org/Documentation and
http://www.gem5.org/Tutorials.
To build gem5, you will need the following software: g++ or clang,
Python (gem5 links in the Python interpreter), SCons, SWIG, zlib, m4,
and lastly protobuf if you want trace capture and playback
support. Please see http://www.gem5.org/Dependencies for more details
concerning the minimum versions of the aforementioned tools.
Once you have all dependencies resolved, type 'scons
build/<ARCH>/gem5.opt' where ARCH is one of ALPHA, ARM, NULL, MIPS,
POWER, SPARC, or X86. This will build an optimized version of the gem5
binary (gem5.opt) for the the specified architecture. See
http://www.gem5.org/Build_System for more details and options.
With the simulator built, have a look at
http://www.gem5.org/Running_gem5 for more information on how to use
gem5.
The basic source release includes these subdirectories:
- configs: example simulation configuration scripts
- ext: less-common external packages needed to build gem5
- src: source code of the gem5 simulator
- system: source for some optional system software for simulated systems
- tests: regression tests
- util: useful utility programs and files
To run full-system simulations, you will need compiled system firmware
(console and PALcode for Alpha), kernel binaries and one or more disk
images. Please see the gem5 download page for these items at
http://www.gem5.org/Download
If you have questions, please send mail to gem5-users@gem5.org
Enjoy using gem5 and please share your modifications and extensions.
# -*- mode:python -*-
# Copyright (c) 2013, 2015 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality of the software
# licensed hereunder. You may use the software subject to the license
# terms below provided that you ensure that this notice is replicated
# unmodified and in its entirety in all distributions of the software,
# modified or unmodified, in source code or in binary form.
#
# Copyright (c) 2011 Advanced Micro Devices, Inc.
# Copyright (c) 2009 The Hewlett-Packard Development Company
# Copyright (c) 2004-2005 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Steve Reinhardt
# Nathan Binkert
###################################################
#
# SCons top-level build description (SConstruct) file.
#
# While in this directory ('gem5'), just type 'scons' to build the default
# configuration (see below), or type 'scons build/<CONFIG>/<binary>'
# to build some other configuration (e.g., 'build/ALPHA/gem5.opt' for
# the optimized full-system version).
#
# You can build gem5 in a different directory as long as there is a
# 'build/<CONFIG>' somewhere along the target path. The build system
# expects that all configs under the same build directory are being
# built for the same host system.
#
# Examples:
#
# The following two commands are equivalent. The '-u' option tells
# scons to search up the directory tree for this SConstruct file.
# % cd <path-to-src>/gem5 ; scons build/ALPHA/gem5.debug
# % cd <path-to-src>/gem5/build/ALPHA; scons -u gem5.debug
#
# The following two commands are equivalent and demonstrate building
# in a directory outside of the source tree. The '-C' option tells
# scons to chdir to the specified directory to find this SConstruct
# file.
# % cd <path-to-src>/gem5 ; scons /local/foo/build/ALPHA/gem5.debug
# % cd /local/foo/build/ALPHA; scons -C <path-to-src>/gem5 gem5.debug
#
# You can use 'scons -H' to print scons options. If you're in this
# 'gem5' directory (or use -u or -C to tell scons where to find this
# file), you can use 'scons -h' to print all the gem5-specific build
# options as well.
#
###################################################
# Check for recent-enough Python and SCons versions.
try:
# Really old versions of scons only take two options for the
# function, so check once without the revision and once with the
# revision, the first instance will fail for stuff other than
# 0.98, and the second will fail for 0.98.0
EnsureSConsVersion(0, 98)
EnsureSConsVersion(0, 98, 1)
except SystemExit, e:
print """
For more details, see:
http://gem5.org/Dependencies
"""
raise
# We ensure the python version early because because python-config
# requires python 2.5
try:
EnsurePythonVersion(2, 5)
except SystemExit, e:
print """
You can use a non-default installation of the Python interpreter by
rearranging your PATH so that scons finds the non-default 'python' and
'python-config' first.
For more details, see:
http://gem5.org/wiki/index.php/Using_a_non-default_Python_installation
"""
raise
# Global Python includes
import itertools
import os
import re
import subprocess
import sys
from os import mkdir, environ
from os.path import abspath, basename, dirname, expanduser, normpath
from os.path import exists, isdir, isfile
from os.path import join as joinpath, split as splitpath
# SCons includes
import SCons
import SCons.Node
extra_python_paths = [
Dir('src/python').srcnode().abspath, # gem5 includes
Dir('ext/ply').srcnode().abspath, # ply is used by several files
]
sys.path[1:1] = extra_python_paths
from m5.util import compareVersions, readCommand
from m5.util.terminal import get_termcap
help_texts = {
"options" : "",
"global_vars" : "",
"local_vars" : ""
}
Export("help_texts")
# There's a bug in scons in that (1) by default, the help texts from
# AddOption() are supposed to be displayed when you type 'scons -h'
# and (2) you can override the help displayed by 'scons -h' using the
# Help() function, but these two features are incompatible: once
# you've overridden the help text using Help(), there's no way to get
# at the help texts from AddOptions. See:
# http://scons.tigris.org/issues/show_bug.cgi?id=2356
# http://scons.tigris.org/issues/show_bug.cgi?id=2611
# This hack lets us extract the help text from AddOptions and
# re-inject it via Help(). Ideally someday this bug will be fixed and
# we can just use AddOption directly.
def AddLocalOption(*args, **kwargs):
col_width = 30
help = " " + ", ".join(args)
if "help" in kwargs:
length = len(help)
if length >= col_width:
help += "\n" + " " * col_width
else:
help += " " * (col_width - length)
help += kwargs["help"]
help_texts["options"] += help + "\n"
AddOption(*args, **kwargs)
AddLocalOption('--colors', dest='use_colors', action='store_true',
help="Add color to abbreviated scons output")
AddLocalOption('--no-colors', dest='use_colors', action='store_false',
help="Don't add color to abbreviated scons output")
AddLocalOption('--with-cxx-config', dest='with_cxx_config',
action='store_true',
help="Build with support for C++-based configuration")
AddLocalOption('--default', dest='default', type='string', action='store',
help='Override which build_opts file to use for defaults')
AddLocalOption('--ignore-style', dest='ignore_style', action='store_true',
help='Disable style checking hooks')
AddLocalOption('--no-lto', dest='no_lto', action='store_true',
help='Disable Link-Time Optimization for fast')
AddLocalOption('--update-ref', dest='update_ref', action='store_true',
help='Update test reference outputs')
AddLocalOption('--verbose', dest='verbose', action='store_true',
help='Print full tool command lines')
AddLocalOption('--without-python', dest='without_python',
action='store_true',
help='Build without Python configuration support')
AddLocalOption('--without-tcmalloc', dest='without_tcmalloc',
action='store_true',
help='Disable linking against tcmalloc')
AddLocalOption('--with-ubsan', dest='with_ubsan', action='store_true',
help='Build with Undefined Behavior Sanitizer if available')
termcap = get_termcap(GetOption('use_colors'))
########################################################################
#
# Set up the main build environment.
#
########################################################################
# export TERM so that clang reports errors in color
use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC',
'PYTHONPATH', 'RANLIB', 'SWIG', 'TERM' ])
use_prefixes = [
"M5", # M5 configuration (e.g., path to kernels)
"DISTCC_", # distcc (distributed compiler wrapper) configuration
"CCACHE_", # ccache (caching compiler wrapper) configuration
"CCC_", # clang static analyzer configuration
]
use_env = {}
for key,val in sorted(os.environ.iteritems()):
if key in use_vars or \
any([key.startswith(prefix) for prefix in use_prefixes]):
use_env[key] = val
# Tell scons to avoid implicit command dependencies to avoid issues
# with the param wrappes being compiled twice (see
# http://scons.tigris.org/issues/show_bug.cgi?id=2811)
main = Environment(ENV=use_env, IMPLICIT_COMMAND_DEPENDENCIES=0)
main.Decider('MD5-timestamp')
main.root = Dir(".") # The current directory (where this file lives).
main.srcdir = Dir("src") # The source directory
main_dict_keys = main.Dictionary().keys()
# Check that we have a C/C++ compiler
if not ('CC' in main_dict_keys and 'CXX' in main_dict_keys):
print "No C++ compiler installed (package g++ on Ubuntu and RedHat)"
Exit(1)
# Check that swig is present
if not 'SWIG' in main_dict_keys:
print "swig is not installed (package swig on Ubuntu and RedHat)"
Exit(1)
# add useful python code PYTHONPATH so it can be used by subprocesses
# as well
main.AppendENVPath('PYTHONPATH', extra_python_paths)
########################################################################
#
# Mercurial Stuff.
#
# If the gem5 directory is a mercurial repository, we should do some
# extra things.
#
########################################################################
hgdir = main.root.Dir(".hg")
mercurial_style_message = """
You're missing the gem5 style hook, which automatically checks your code
against the gem5 style rules on hg commit and qrefresh commands. This
script will now install the hook in your .hg/hgrc file.
Press enter to continue, or ctrl-c to abort: """
mercurial_style_hook = """
# The following lines were automatically added by gem5/SConstruct
# to provide the gem5 style-checking hooks
[extensions]
style = %s/util/style.py
[hooks]
pretxncommit.style = python:style.check_style
pre-qrefresh.style = python:style.check_style
# End of SConstruct additions
""" % (main.root.abspath)
mercurial_lib_not_found = """
Mercurial libraries cannot be found, ignoring style hook. If
you are a gem5 developer, please fix this and run the style
hook. It is important.
"""
# Check for style hook and prompt for installation if it's not there.
# Skip this if --ignore-style was specified, there's no .hg dir to
# install a hook in, or there's no interactive terminal to prompt.
if not GetOption('ignore_style') and hgdir.exists() and sys.stdin.isatty():
style_hook = True
try:
from mercurial import ui
ui = ui.ui()
ui.readconfig(hgdir.File('hgrc').abspath)
style_hook = ui.config('hooks', 'pretxncommit.style', None) and \
ui.config('hooks', 'pre-qrefresh.style', None)
except ImportError:
print mercurial_lib_not_found
if not style_hook:
print mercurial_style_message,
# continue unless user does ctrl-c/ctrl-d etc.
try:
raw_input()
except:
print "Input exception, exiting scons.\n"
sys.exit(1)
hgrc_path = '%s/.hg/hgrc' % main.root.abspath
print "Adding style hook to", hgrc_path, "\n"
try:
hgrc = open(hgrc_path, 'a')
hgrc.write(mercurial_style_hook)
hgrc.close()
except:
print "Error updating", hgrc_path
sys.exit(1)
###################################################
#
# Figure out which configurations to set up based on the path(s) of
# the target(s).
#
###################################################
# Find default configuration & binary.
Default(environ.get('M5_DEFAULT_BINARY', 'build/ALPHA/gem5.debug'))
# helper function: find last occurrence of element in list
def rfind(l, elt, offs = -1):
for i in range(len(l)+offs, 0, -1):
if l[i] == elt:
return i
raise ValueError, "element not found"
# Take a list of paths (or SCons Nodes) and return a list with all
# paths made absolute and ~-expanded. Paths will be interpreted
# relative to the launch directory unless a different root is provided
def makePathListAbsolute(path_list, root=GetLaunchDir()):
return [abspath(joinpath(root, expanduser(str(p))))
for p in path_list]
# Each target must have 'build' in the interior of the path; the
# directory below this will determine the build parameters. For
# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
# recognize that ALPHA_SE specifies the configuration because it
# follow 'build' in the build path.
# The funky assignment to "[:]" is needed to replace the list contents
# in place rather than reassign the symbol to a new list, which
# doesn't work (obviously!).
BUILD_TARGETS[:] = makePathListAbsolute(BUILD_TARGETS)
# Generate a list of the unique build roots and configs that the
# collected targets reference.
variant_paths = []
build_root = None
for t in BUILD_TARGETS:
path_dirs = t.split('/')
try:
build_top = rfind(path_dirs, 'build', -2)
except:
print "Error: no non-leaf 'build' dir found on target path", t
Exit(1)
this_build_root = joinpath('/',*path_dirs[:build_top+1])
if not build_root:
build_root = this_build_root
else:
if this_build_root != build_root:
print "Error: build targets not under same build root\n"\
" %s\n %s" % (build_root, this_build_root)
Exit(1)
variant_path = joinpath('/',*path_dirs[:build_top+2])
if variant_path not in variant_paths:
variant_paths.append(variant_path)
# Make sure build_root exists (might not if this is the first build there)
if not isdir(build_root):
mkdir(build_root)
main['BUILDROOT'] = build_root
Export('main')
main.SConsignFile(joinpath(build_root, "sconsign"))
# Default duplicate option is to use hard links, but this messes up
# when you use emacs to edit a file in the target dir, as emacs moves
# file to file~ then copies to file, breaking the link. Symbolic
# (soft) links work better.
main.SetOption('duplicate', 'soft-copy')
#
# Set up global sticky variables... these are common to an entire build
# tree (not specific to a particular build like ALPHA_SE)