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.objects import *
from m5.util import addToPath, fatal from m5.util import addToPath, fatal
addToPath('../common') addToPath('../')
import Simulation from common import Simulation
import Options from common import Options
def build_switch(options): def build_switch(options):
# instantiate an EtherSwitch # instantiate an EtherSwitch

View file

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

View file

@ -42,9 +42,9 @@ from m5.objects import *
from m5.util import addToPath from m5.util import addToPath
from m5.internal.stats import periodicStatDump 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 # this script is helpful to sweep the efficiency of a specific memory
# controller configuration, by varying the number of banks accessed, # controller configuration, by varying the number of banks accessed,

View file

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

View file

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

View file

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

View file

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

View file

@ -50,18 +50,17 @@ from m5.objects import *
from m5.util import addToPath, fatal from m5.util import addToPath, fatal
addToPath('../') addToPath('../')
addToPath('../common')
from ruby import Ruby from ruby import Ruby
from FSConfig import * from common.FSConfig import *
from SysPaths import * from common.SysPaths import *
from Benchmarks import * from common.Benchmarks import *
import Simulation from common import Simulation
import CacheConfig from common import CacheConfig
import MemConfig from common import MemConfig
from Caches import * from common.Caches import *
import Options from common import Options
# Check if KVM support has been enabled, we might need to do VM # 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.defines import buildEnv
from m5.util import addToPath from m5.util import addToPath
import os, optparse, sys import os, optparse, sys
addToPath('../common')
addToPath('../') addToPath('../')
import Options from common import Options
from ruby import Ruby from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example. # 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.objects import *
from m5.util import addToPath from m5.util import addToPath
addToPath('../common') addToPath('../')
import MemConfig
import HMC from common import MemConfig
from common import HMC
parser = optparse.OptionParser() parser = optparse.OptionParser()

View file

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

View file

@ -33,10 +33,10 @@ from m5.objects import *
from m5.defines import buildEnv from m5.defines import buildEnv
from m5.util import addToPath from m5.util import addToPath
import os, optparse, sys import os, optparse, sys
addToPath('../common')
addToPath('../') addToPath('../')
import Options from common import Options
from ruby import Ruby from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example. # 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.defines import buildEnv
from m5.util import addToPath from m5.util import addToPath
import os, optparse, sys import os, optparse, sys
addToPath('../common')
addToPath('../') addToPath('../')
import Options from common import Options
from ruby import Ruby from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example. # 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 from m5.util import addToPath, fatal
addToPath('../') addToPath('../')
addToPath('../common')
from ruby import Ruby from ruby import Ruby
import Options from common import Options
import Simulation from common import Simulation
import CacheConfig from common import CacheConfig
import CpuConfig from common import CpuConfig
import MemConfig from common import MemConfig
from Caches import * from common.Caches import *
from cpu2000 import * from common.cpu2000 import *
# Check if KVM support has been enabled, we might need to do VM # Check if KVM support has been enabled, we might need to do VM
# configuration if that's the case. # configuration if that's the case.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -28,7 +28,6 @@
import m5 import m5
from m5.objects import * from m5.objects import *
m5.util.addToPath('../configs/common')
nb_cores = 4 nb_cores = 4
cpus = [ DerivO3CPU(cpu_id=i) for i in xrange(nb_cores) ] 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 m5.defines import buildEnv
from base_config import * from base_config import *
from arm_generic 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 # If we are running ARM regressions, use a more sensible CPU
# configuration. This makes the results more meaningful, and also # configuration. This makes the results more meaningful, and also

View file

@ -28,8 +28,6 @@
import m5 import m5
from m5.objects import * from m5.objects import *
m5.util.addToPath('../configs/common')
import ruby_config import ruby_config
ruby_memory = ruby_config.generate("TwoLevel_SplitL1UnifiedL2.rb", 1) 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 m5.defines import buildEnv
from base_config import * from base_config import *
from arm_generic 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 # If we are running ARM regressions, use a more sensible CPU
# configuration. This makes the results more meaningful, and also # configuration. This makes the results more meaningful, and also

View file

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

View file

@ -37,7 +37,7 @@
from m5.objects import * from m5.objects import *
from arm_generic 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', root = LinuxArmFSSystemUniprocessor(mem_mode='timing',
mem_class=DDR3_1600_x64, mem_class=DDR3_1600_x64,

View file

@ -37,7 +37,7 @@
from m5.objects import * from m5.objects import *
from arm_generic 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', root = LinuxArmFSSystem(mem_mode='timing',
mem_class=DDR3_1600_x64, mem_class=DDR3_1600_x64,

View file

@ -37,7 +37,7 @@
from m5.objects import * from m5.objects import *
from arm_generic 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', root = LinuxArmFSSystemUniprocessor(mem_mode='timing',
mem_class=DDR3_1600_x64, mem_class=DDR3_1600_x64,

View file

@ -37,7 +37,7 @@
from m5.objects import * from m5.objects import *
from arm_generic 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', root = LinuxArmFSSystemUniprocessor(machine_type='VExpress_EMM64',
mem_mode='timing', mem_mode='timing',

View file

@ -37,7 +37,7 @@
from m5.objects import * from m5.objects import *
from arm_generic 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', root = LinuxArmFSSystem(machine_type='VExpress_EMM64',
mem_mode='timing', mem_mode='timing',

View file

@ -37,7 +37,7 @@
from m5.objects import * from m5.objects import *
from arm_generic 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', root = LinuxArmFSSystemUniprocessor(machine_type='VExpress_EMM64',
mem_mode='timing', mem_mode='timing',

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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