config: Make configs/common a Python package

Continue along the same line as the recent patch that made the
Ruby-related config scripts Python packages and make also the
configs/common directory a package.

All affected config scripts are updated (hopefully).

Note that this change makes it apparent that the current organisation
and naming of the config directory and its subdirectories is rather
chaotic. We mix scripts that are directly invoked with scripts that
merely contain convenience functions. While it is not addressed in
this patch we should follow up with a re-organisation of the
config structure, and renaming of some of the packages.
This commit is contained in:
Andreas Hansson 2016-10-14 10:37:38 -04:00
parent 824c87634d
commit 2f5262eb67
49 changed files with 138 additions and 119 deletions

View File

@ -0,0 +1,36 @@
# Copyright (c) 2016 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.
#
# 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: Andreas Hansson

6
configs/dist/sw.py vendored
View File

@ -37,10 +37,10 @@ from m5.defines import buildEnv
from m5.objects import *
from m5.util import addToPath, fatal
addToPath('../common')
addToPath('../')
import Simulation
import Options
from common import Simulation
from common import Options
def build_switch(options):
# instantiate an EtherSwitch

View File

@ -44,8 +44,8 @@ from m5.objects import *
from m5.util import addToPath
from m5.internal.stats import periodicStatDump
addToPath('../common')
import MemConfig
addToPath('../')
from common import MemConfig
addToPath('../../util')
import protolib
@ -258,7 +258,7 @@ system.tgen.port = system.monitor.slave
# create the actual cache hierarchy, for now just go with something
# basic to explore some of the options
from Caches import *
from common.Caches import *
# a starting point for an L3 cache
class L3Cache(Cache):

View File

@ -42,9 +42,9 @@ from m5.objects import *
from m5.util import addToPath
from m5.internal.stats import periodicStatDump
addToPath('../common')
addToPath('../')
import MemConfig
from common import MemConfig
# this script is helpful to sweep the efficiency of a specific memory
# controller configuration, by varying the number of banks accessed,

View File

@ -43,13 +43,12 @@ from m5.objects import *
from m5.util import addToPath
addToPath('../')
addToPath('../common')
from ruby import Ruby
import Options
import Simulation
import GPUTLBOptions, GPUTLBConfig
from common import Options
from common import Simulation
from common import GPUTLBOptions, GPUTLBConfig
########################## Script Options ########################
def setOption(parser, opt_str, value = 1):

View File

@ -40,9 +40,9 @@
import m5
from m5.objects import *
m5.util.addToPath('../../common')
from Caches import *
import CpuConfig
m5.util.addToPath('../../')
from common.Caches import *
from common import CpuConfig
class L1I(L1_ICache):
hit_latency = 1

View File

@ -46,9 +46,10 @@ import sys
import m5
from m5.objects import *
m5.util.addToPath("../../common")
import SysPaths
import CpuConfig
m5.util.addToPath("../../")
from common import SysPaths
from common import CpuConfig
import devices

View File

@ -41,13 +41,13 @@ import optparse
from m5.util import addToPath, fatal
addToPath('../common')
addToPath('../')
import Options
import Simulation
import CacheConfig
import MemConfig
from Caches import *
from common import Options
from common import Simulation
from common import CacheConfig
from common import MemConfig
from common.Caches import *
parser = optparse.OptionParser()
Options.addCommonOptions(parser)

View File

@ -50,18 +50,17 @@ from m5.objects import *
from m5.util import addToPath, fatal
addToPath('../')
addToPath('../common')
from ruby import Ruby
from FSConfig import *
from SysPaths import *
from Benchmarks import *
import Simulation
import CacheConfig
import MemConfig
from Caches import *
import Options
from common.FSConfig import *
from common.SysPaths import *
from common.Benchmarks import *
from common import Simulation
from common import CacheConfig
from common import MemConfig
from common.Caches import *
from common import Options
# Check if KVM support has been enabled, we might need to do VM

View File

@ -31,10 +31,10 @@ from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
addToPath('../')
import Options
from common import Options
from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.

View File

@ -6,9 +6,10 @@ import m5
from m5.objects import *
from m5.util import addToPath
addToPath('../common')
import MemConfig
import HMC
addToPath('../')
from common import MemConfig
from common import HMC
parser = optparse.OptionParser()

View File

@ -33,10 +33,10 @@ from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
addToPath('../')
import Options
from common import Options
from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.

View File

@ -38,10 +38,10 @@ from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
addToPath('../')
import Options
from common import Options
from ruby import Ruby
# Get paths we might need.

View File

@ -33,10 +33,10 @@ from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
addToPath('../')
import Options
from common import Options
from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.

View File

@ -33,10 +33,10 @@ from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
addToPath('../')
import Options
from common import Options
from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.

View File

@ -52,17 +52,16 @@ from m5.objects import *
from m5.util import addToPath, fatal
addToPath('../')
addToPath('../common')
from ruby import Ruby
import Options
import Simulation
import CacheConfig
import CpuConfig
import MemConfig
from Caches import *
from cpu2000 import *
from common import Options
from common import Simulation
from common import CacheConfig
from common import CpuConfig
from common import MemConfig
from common.Caches import *
from common.cpu2000 import *
# Check if KVM support has been enabled, we might need to do VM
# configuration if that's the case.

View File

@ -36,7 +36,7 @@ line options from each individual class.
from m5.objects import Cache
import SimpleOpts
from common import SimpleOpts
# Some specific options for caches
# For all options see src/mem/cache/BaseCache.py

View File

@ -46,13 +46,13 @@ import m5
from m5.objects import *
# Add the common scripts to our path
m5.util.addToPath('../../common')
m5.util.addToPath('../../')
# import the caches which we made
from caches import *
# import the SimpleOpts module
import SimpleOpts
from common import SimpleOpts
# Set the usage message to display
SimpleOpts.set_usage("usage: %prog [options] <binary to execute>")

View File

@ -45,7 +45,7 @@ from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath, fatal
import MemConfig
from common import MemConfig
from topologies import *
from network import Network

View File

@ -37,8 +37,6 @@ import sys
import m5
from m5.objects import *
m5.util.addToPath('../common')
# --------------------
# Define Command Line Options
# ====================

View File

@ -36,8 +36,6 @@ import sys
import m5
from m5.objects import *
m5.util.addToPath('../common')
# --------------------
# Define Command Line Options
# ====================

View File

@ -39,9 +39,9 @@ from abc import ABCMeta, abstractmethod
import m5
from m5.objects import *
from m5.proxy import *
m5.util.addToPath('../configs/common')
import FSConfig
from Caches import *
m5.util.addToPath('../configs/')
from common import FSConfig
from common.Caches import *
from base_config import *
class LinuxAlphaSystemBuilder(object):

View File

@ -39,12 +39,12 @@ from abc import ABCMeta, abstractmethod
import m5
from m5.objects import *
from m5.proxy import *
m5.util.addToPath('../configs/common')
import FSConfig
from Caches import *
m5.util.addToPath('../configs/')
from common import FSConfig
from common.Caches import *
from base_config import *
from O3_ARM_v7a import *
from Benchmarks import SysConfig
from common.O3_ARM_v7a import *
from common.Benchmarks import SysConfig
class ArmSESystemUniprocessor(BaseSESystemUniprocessor):
"""Syscall-emulation builder for ARM uniprocessor systems.

View File

@ -40,9 +40,9 @@ from abc import ABCMeta, abstractmethod
import m5
from m5.objects import *
from m5.proxy import *
m5.util.addToPath('../configs/common')
import FSConfig
from Caches import *
m5.util.addToPath('../configs/')
from common import FSConfig
from common.Caches import *
_have_kvm_support = 'BaseKvmCPU' in globals()

View File

@ -40,7 +40,6 @@ import sys
import os
import m5
m5.util.addToPath('../configs/common')
_exit_normal = (
"target called exit()",

View File

@ -39,11 +39,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
m5.util.addToPath('../configs/common')
m5.util.addToPath('../configs/')
from ruby import Ruby
import Options
from common import Options
parser = optparse.OptionParser()
Options.addCommonOptions(parser)

View File

@ -39,12 +39,11 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys, math, glob
m5.util.addToPath('../configs/common')
m5.util.addToPath('../configs/')
from ruby import Ruby
import Options
import GPUTLBOptions, GPUTLBConfig
from common import Options
from common import GPUTLBOptions, GPUTLBConfig
########################## Script Options ########################
def setOption(parser, opt_str, value = 1):

View File

@ -45,7 +45,7 @@ def run_test(root):
# Add paths that we need
m5.util.addToPath('../configs/learning_gem5/part1')
m5.util.addToPath('../configs/common')
m5.util.addToPath('../configs/')
# The path to this script is the only parameter. Delete it so we can
# execute the script that we want to execute.

View File

@ -28,8 +28,8 @@
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
from Caches import *
m5.util.addToPath('../configs/')
from common.Caches import *
#MAX CORES IS 8 with the fals sharing method
nb_cores = 8

View File

@ -33,11 +33,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
m5.util.addToPath('../configs/common')
m5.util.addToPath('../configs/')
from ruby import Ruby
import Options
from common import Options
parser = optparse.OptionParser()
Options.addCommonOptions(parser)

View File

@ -28,8 +28,8 @@
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
from Caches import *
m5.util.addToPath('../configs/')
from common.Caches import *
#MAX CORES IS 8 with the fals sharing method
nb_cores = 8

View File

@ -28,7 +28,6 @@
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
nb_cores = 4
cpus = [ DerivO3CPU(cpu_id=i) for i in xrange(nb_cores) ]

View File

@ -42,7 +42,7 @@ from m5.objects import *
from m5.defines import buildEnv
from base_config import *
from arm_generic import *
from O3_ARM_v7a import O3_ARM_v7a_3
from common.O3_ARM_v7a import O3_ARM_v7a_3
# If we are running ARM regressions, use a more sensible CPU
# configuration. This makes the results more meaningful, and also

View File

@ -28,8 +28,6 @@
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
import ruby_config
ruby_memory = ruby_config.generate("TwoLevel_SplitL1UnifiedL2.rb", 1)

View File

@ -42,7 +42,7 @@ from m5.objects import *
from m5.defines import buildEnv
from base_config import *
from arm_generic import *
from O3_ARM_v7a import O3_ARM_v7a_3
from common.O3_ARM_v7a import O3_ARM_v7a_3
# If we are running ARM regressions, use a more sensible CPU
# configuration. This makes the results more meaningful, and also

View File

@ -28,13 +28,11 @@
import m5, os, optparse, sys
from m5.objects import *
m5.util.addToPath('../configs/common')
from Benchmarks import SysConfig
import FSConfig
m5.util.addToPath('../configs/')
from common.Benchmarks import SysConfig
from common import FSConfig
from ruby import Ruby
import Options
from common import Options
# Add the ruby specific and protocol specific options
parser = optparse.OptionParser()

View File

@ -37,7 +37,7 @@
from m5.objects import *
from arm_generic import *
from O3_ARM_v7a import O3_ARM_v7a_3
from common.O3_ARM_v7a import O3_ARM_v7a_3
root = LinuxArmFSSystemUniprocessor(mem_mode='timing',
mem_class=DDR3_1600_x64,

View File

@ -37,7 +37,7 @@
from m5.objects import *
from arm_generic import *
from O3_ARM_v7a import O3_ARM_v7a_3
from common.O3_ARM_v7a import O3_ARM_v7a_3
root = LinuxArmFSSystem(mem_mode='timing',
mem_class=DDR3_1600_x64,

View File

@ -37,7 +37,7 @@
from m5.objects import *
from arm_generic import *
from O3_ARM_v7a import O3_ARM_v7a_3
from common.O3_ARM_v7a import O3_ARM_v7a_3
root = LinuxArmFSSystemUniprocessor(mem_mode='timing',
mem_class=DDR3_1600_x64,

View File

@ -37,7 +37,7 @@
from m5.objects import *
from arm_generic import *
from O3_ARM_v7a import O3_ARM_v7a_3
from common.O3_ARM_v7a import O3_ARM_v7a_3
root = LinuxArmFSSystemUniprocessor(machine_type='VExpress_EMM64',
mem_mode='timing',

View File

@ -37,7 +37,7 @@
from m5.objects import *
from arm_generic import *
from O3_ARM_v7a import O3_ARM_v7a_3
from common.O3_ARM_v7a import O3_ARM_v7a_3
root = LinuxArmFSSystem(machine_type='VExpress_EMM64',
mem_mode='timing',

View File

@ -37,7 +37,7 @@
from m5.objects import *
from arm_generic import *
from O3_ARM_v7a import O3_ARM_v7a_3
from common.O3_ARM_v7a import O3_ARM_v7a_3
root = LinuxArmFSSystemUniprocessor(machine_type='VExpress_EMM64',
mem_mode='timing',

View File

@ -34,11 +34,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
m5.util.addToPath('../configs/common')
m5.util.addToPath('../configs/')
from ruby import Ruby
import Options
from common import Options
parser = optparse.OptionParser()
Options.addCommonOptions(parser)

View File

@ -32,10 +32,9 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
m5.util.addToPath('../configs/common')
m5.util.addToPath('../configs/')
import Options
from common import Options
from ruby import Ruby
parser = optparse.OptionParser()

View File

@ -32,11 +32,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
m5.util.addToPath('../configs/common')
m5.util.addToPath('../configs/')
from ruby import Ruby
import Options
from common import Options
parser = optparse.OptionParser()
Options.addCommonOptions(parser)

View File

@ -37,8 +37,8 @@
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
from Caches import *
m5.util.addToPath('../configs/')
from common.Caches import *
class Sequential:
"""Sequential CPU switcher.

View File

@ -28,8 +28,8 @@
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
import FSConfig
m5.util.addToPath('../configs/')
from common import FSConfig
try:
system = FSConfig.makeSparcSystem('atomic')

View File

@ -28,9 +28,9 @@
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
from FSConfig import *
from Benchmarks import *
m5.util.addToPath('../configs/')
from common.FSConfig import *
from common.Benchmarks import *
test_sys = makeLinuxAlphaSystem('atomic',
SysConfig('netperf-stream-client.rcS'))

View File

@ -39,10 +39,10 @@ from abc import ABCMeta, abstractmethod
import m5
from m5.objects import *
from m5.proxy import *
m5.util.addToPath('../configs/common')
from Benchmarks import SysConfig
import FSConfig
from Caches import *
m5.util.addToPath('../configs/')
from common.Benchmarks import SysConfig
from common import FSConfig
from common.Caches import *
from base_config import *
class LinuxX86SystemBuilder(object):