summaryrefslogtreecommitdiff
path: root/configs
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2019-02-25 11:55:02 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2019-03-18 15:13:52 +0000
commitfe3e8084959a6910f4c8d075c5c03e40d0269527 (patch)
tree7e4e43608dfd8d3d5544177e439f57733f3837d8 /configs
parent9e22a2ab603d743b187108986cfbeba07c0c0b8d (diff)
downloadgem5-fe3e8084959a6910f4c8d075c5c03e40d0269527.tar.xz
configs: Use absolute import paths
Use absoluate import paths to be Python 3 compatible. This also imports absolute_import from __future__ to ensure that Python 2.7 behaves the same way as Python 3. Change-Id: Ica06ed95814e9cd3e768b3e1785075e36f6e56d0 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/16708 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'configs')
-rw-r--r--configs/common/BPConfig.py1
-rw-r--r--configs/common/Benchmarks.py3
-rw-r--r--configs/common/CacheConfig.py8
-rw-r--r--configs/common/Caches.py3
-rw-r--r--configs/common/CpuConfig.py4
-rw-r--r--configs/common/FSConfig.py5
-rw-r--r--configs/common/GPUTLBConfig.py1
-rw-r--r--configs/common/GPUTLBOptions.py3
-rw-r--r--configs/common/HMC.py3
-rw-r--r--configs/common/MemConfig.py3
-rw-r--r--configs/common/Options.py15
-rw-r--r--configs/common/PlatformConfig.py1
-rw-r--r--configs/common/SimpleOpts.py3
-rw-r--r--configs/common/Simulation.py7
-rw-r--r--configs/common/SysPaths.py2
-rw-r--r--configs/common/__init__.py4
-rw-r--r--configs/common/cores/__init__.py3
-rw-r--r--configs/common/cores/arm/HPI.py1
-rw-r--r--configs/common/cores/arm/O3_ARM_v7a.py2
-rw-r--r--configs/common/cores/arm/__init__.py5
-rw-r--r--configs/common/cores/arm/ex5_LITTLE.py3
-rw-r--r--configs/common/cores/arm/ex5_big.py3
-rw-r--r--configs/common/cpu2000.py1
-rw-r--r--configs/dram/lat_mem_rd.py1
-rw-r--r--configs/dram/low_power_sweep.py6
-rw-r--r--configs/dram/sweep.py1
-rw-r--r--configs/example/apu_se.py1
-rw-r--r--configs/example/arm/devices.py3
-rw-r--r--configs/example/arm/dist_bigLITTLE.py3
-rw-r--r--configs/example/arm/fs_bigLITTLE.py1
-rw-r--r--configs/example/arm/fs_power.py1
-rw-r--r--configs/example/arm/starter_fs.py1
-rw-r--r--configs/example/arm/starter_se.py1
-rw-r--r--configs/example/etrace_replay.py1
-rw-r--r--configs/example/fs.py1
-rw-r--r--configs/example/garnet_synth_traffic.py1
-rw-r--r--configs/example/hmc_hello.py3
-rw-r--r--configs/example/hmctest.py2
-rw-r--r--configs/example/memcheck.py1
-rw-r--r--configs/example/memtest.py1
-rw-r--r--configs/example/read_config.py1
-rw-r--r--configs/example/ruby_direct_test.py1
-rw-r--r--configs/example/ruby_gpu_random_test.py1
-rw-r--r--configs/example/ruby_mem_test.py1
-rw-r--r--configs/example/ruby_random_test.py1
-rw-r--r--configs/example/se.py1
-rw-r--r--configs/learning_gem5/part1/caches.py4
-rw-r--r--configs/learning_gem5/part1/simple.py2
-rw-r--r--configs/learning_gem5/part1/two_level.py1
-rw-r--r--configs/learning_gem5/part2/hello_goodbye.py1
-rw-r--r--configs/learning_gem5/part2/run_simple.py1
-rw-r--r--configs/learning_gem5/part2/simple_cache.py1
-rw-r--r--configs/learning_gem5/part2/simple_memobj.py1
-rw-r--r--configs/learning_gem5/part3/msi_caches.py3
-rw-r--r--configs/learning_gem5/part3/ruby_caches_MI_example.py3
-rw-r--r--configs/learning_gem5/part3/ruby_test.py3
-rw-r--r--configs/learning_gem5/part3/simple_ruby.py3
-rw-r--r--configs/learning_gem5/part3/test_caches.py5
-rw-r--r--configs/network/Network.py3
-rw-r--r--configs/network/__init__.py3
-rw-r--r--configs/ruby/GPU_RfO.py4
-rw-r--r--configs/ruby/MI_example.py4
-rw-r--r--configs/ruby/Ruby.py6
-rw-r--r--configs/splash2/cluster.py1
-rw-r--r--configs/splash2/run.py1
-rw-r--r--configs/topologies/BaseTopology.py3
-rw-r--r--configs/topologies/Cluster.py4
-rw-r--r--configs/topologies/Crossbar.py5
-rw-r--r--configs/topologies/CrossbarGarnet.py5
-rw-r--r--configs/topologies/MeshDirCorners_XY.py5
-rw-r--r--configs/topologies/Mesh_XY.py5
-rw-r--r--configs/topologies/Mesh_westfirst.py4
-rw-r--r--configs/topologies/Pt2Pt.py5
-rw-r--r--configs/topologies/__init__.py3
74 files changed, 171 insertions, 37 deletions
diff --git a/configs/common/BPConfig.py b/configs/common/BPConfig.py
index c4e40e791..65e6d65a2 100644
--- a/configs/common/BPConfig.py
+++ b/configs/common/BPConfig.py
@@ -30,6 +30,7 @@
# hanle branch predictors instead of memory controllers / CPUs
from __future__ import print_function
+from __future__ import absolute_import
from m5 import fatal
import m5.objects
diff --git a/configs/common/Benchmarks.py b/configs/common/Benchmarks.py
index f7d1b4d1e..3cf963bd5 100644
--- a/configs/common/Benchmarks.py
+++ b/configs/common/Benchmarks.py
@@ -27,8 +27,9 @@
# Authors: Ali Saidi
from __future__ import print_function
+from __future__ import absolute_import
-from SysPaths import script, disk, binary
+from .SysPaths import script, disk, binary
from os import environ as env
from m5.defines import buildEnv
diff --git a/configs/common/CacheConfig.py b/configs/common/CacheConfig.py
index 368356f06..ab9d26735 100644
--- a/configs/common/CacheConfig.py
+++ b/configs/common/CacheConfig.py
@@ -42,10 +42,11 @@
#
from __future__ import print_function
+from __future__ import absolute_import
import m5
from m5.objects import *
-from Caches import *
+from .Caches import *
def config_cache(options, system):
if options.external_memory_system and (options.caches or options.l2cache):
@@ -57,13 +58,14 @@ def config_cache(options, system):
if options.cpu_type == "O3_ARM_v7a_3":
try:
- from cores.arm.O3_ARM_v7a import *
+ import cores.arm.O3_ARM_v7a as core
except:
print("O3_ARM_v7a_3 is unavailable. Did you compile the O3 model?")
sys.exit(1)
dcache_class, icache_class, l2_cache_class, walk_cache_class = \
- O3_ARM_v7a_DCache, O3_ARM_v7a_ICache, O3_ARM_v7aL2, \
+ core.O3_ARM_v7a_DCache, core.O3_ARM_v7a_ICache, \
+ core.O3_ARM_v7aL2, \
O3_ARM_v7aWalkCache
else:
dcache_class, icache_class, l2_cache_class, walk_cache_class = \
diff --git a/configs/common/Caches.py b/configs/common/Caches.py
index 926a41d07..f8edc8b6b 100644
--- a/configs/common/Caches.py
+++ b/configs/common/Caches.py
@@ -38,6 +38,9 @@
#
# Authors: Lisa Hsu
+from __future__ import print_function
+from __future__ import absolute_import
+
from m5.defines import buildEnv
from m5.objects import *
diff --git a/configs/common/CpuConfig.py b/configs/common/CpuConfig.py
index 80e3766ef..831287ddc 100644
--- a/configs/common/CpuConfig.py
+++ b/configs/common/CpuConfig.py
@@ -36,6 +36,7 @@
# Authors: Andreas Sandberg
from __future__ import print_function
+from __future__ import absolute_import
from m5 import fatal
import m5.objects
@@ -134,7 +135,8 @@ from m5.defines import buildEnv
from importlib import import_module
for package in [ "generic", buildEnv['TARGET_ISA']]:
try:
- package = import_module(".cores." + package, package=__package__)
+ package = import_module(".cores." + package,
+ package=__name__.rpartition('.')[0])
except ImportError:
# No timing models for this ISA
continue
diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py
index 13c29ef1c..8b67c85e1 100644
--- a/configs/common/FSConfig.py
+++ b/configs/common/FSConfig.py
@@ -40,11 +40,12 @@
# Authors: Kevin Lim
from __future__ import print_function
+from __future__ import absolute_import
from m5.objects import *
-from Benchmarks import *
from m5.util import *
-from common import PlatformConfig
+from .Benchmarks import *
+from . import PlatformConfig
# Populate to reflect supported os types per target ISA
os_types = { 'alpha' : [ 'linux' ],
diff --git a/configs/common/GPUTLBConfig.py b/configs/common/GPUTLBConfig.py
index 80aad0b78..d93b68e2c 100644
--- a/configs/common/GPUTLBConfig.py
+++ b/configs/common/GPUTLBConfig.py
@@ -32,6 +32,7 @@
# Authors: Lisa Hsu
from __future__ import print_function
+from __future__ import absolute_import
# Configure the TLB hierarchy
# Places which would probably need to be modified if you
diff --git a/configs/common/GPUTLBOptions.py b/configs/common/GPUTLBOptions.py
index 9e370c131..fdcec5da2 100644
--- a/configs/common/GPUTLBOptions.py
+++ b/configs/common/GPUTLBOptions.py
@@ -31,6 +31,9 @@
#
# Authors: Myrto Papadopoulou
+from __future__ import print_function
+from __future__ import absolute_import
+
def tlb_options(parser):
#===================================================================
diff --git a/configs/common/HMC.py b/configs/common/HMC.py
index 61e521d52..08b217da2 100644
--- a/configs/common/HMC.py
+++ b/configs/common/HMC.py
@@ -122,6 +122,9 @@
# 2 Crossbars are connected to only local vaults. From other 2 crossbar, a
# request can be forwarded to any other vault.
+from __future__ import print_function
+from __future__ import absolute_import
+
import argparse
import m5
diff --git a/configs/common/MemConfig.py b/configs/common/MemConfig.py
index b6e6663f9..29c41388c 100644
--- a/configs/common/MemConfig.py
+++ b/configs/common/MemConfig.py
@@ -37,12 +37,13 @@
# Andreas Hansson
from __future__ import print_function
+from __future__ import absolute_import
import m5.objects
import inspect
import sys
-import HMC
from textwrap import TextWrapper
+from . import HMC
# Dictionary of mapping names of real memory controller models to
# classes.
diff --git a/configs/common/Options.py b/configs/common/Options.py
index 7b231c7df..6d9c9cf37 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -38,15 +38,18 @@
#
# Authors: Lisa Hsu
+from __future__ import print_function
+from __future__ import absolute_import
+
import m5
from m5.defines import buildEnv
from m5.objects import *
-from common.Benchmarks import *
-from common import CpuConfig
-from common import BPConfig
-from common import MemConfig
-from common import PlatformConfig
+from .Benchmarks import *
+from . import CpuConfig
+from . import BPConfig
+from . import MemConfig
+from . import PlatformConfig
def _listCpuTypes(option, opt, value, parser):
CpuConfig.print_cpu_list()
@@ -330,7 +333,7 @@ def addSEOptions(parser):
help="Redirect stderr to a file.")
def addFSOptions(parser):
- from FSConfig import os_types
+ from .FSConfig import os_types
# Simulation options
parser.add_option("--timesync", action="store_true",
diff --git a/configs/common/PlatformConfig.py b/configs/common/PlatformConfig.py
index ae55d1a16..0c2ef3649 100644
--- a/configs/common/PlatformConfig.py
+++ b/configs/common/PlatformConfig.py
@@ -39,6 +39,7 @@
# Pierre-Yves Peneau
from __future__ import print_function
+from __future__ import absolute_import
import m5.objects
import inspect
diff --git a/configs/common/SimpleOpts.py b/configs/common/SimpleOpts.py
index e2f122eab..32e3447b0 100644
--- a/configs/common/SimpleOpts.py
+++ b/configs/common/SimpleOpts.py
@@ -27,6 +27,9 @@
#
# Authors: Jason Power
+from __future__ import print_function
+from __future__ import absolute_import
+
""" Options wrapper for simple gem5 configuration scripts
This module wraps the optparse class so that we can register options
diff --git a/configs/common/Simulation.py b/configs/common/Simulation.py
index 5b1ab0177..d1b623dd1 100644
--- a/configs/common/Simulation.py
+++ b/configs/common/Simulation.py
@@ -40,14 +40,15 @@
# Authors: Lisa Hsu
from __future__ import print_function
+from __future__ import absolute_import
import sys
from os import getcwd
from os.path import join as joinpath
-from common import CpuConfig
-from common import BPConfig
-from common import MemConfig
+from . import CpuConfig
+from . import BPConfig
+from . import MemConfig
import m5
from m5.defines import buildEnv
diff --git a/configs/common/SysPaths.py b/configs/common/SysPaths.py
index 17d5fb864..e5d9f83b2 100644
--- a/configs/common/SysPaths.py
+++ b/configs/common/SysPaths.py
@@ -26,6 +26,8 @@
#
# Authors: Ali Saidi
+from __future__ import print_function
+from __future__ import absolute_import
from six import string_types
import os, sys
diff --git a/configs/common/__init__.py b/configs/common/__init__.py
index 1829385b6..5e72a6052 100644
--- a/configs/common/__init__.py
+++ b/configs/common/__init__.py
@@ -34,3 +34,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Andreas Hansson
+
+from __future__ import print_function
+from __future__ import absolute_import
+
diff --git a/configs/common/cores/__init__.py b/configs/common/cores/__init__.py
index 7a2173eab..c61e6d8b5 100644
--- a/configs/common/cores/__init__.py
+++ b/configs/common/cores/__init__.py
@@ -34,3 +34,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Andreas Sandberg
+
+from __future__ import print_function
+from __future__ import absolute_import
diff --git a/configs/common/cores/arm/HPI.py b/configs/common/cores/arm/HPI.py
index d105790e3..01c088470 100644
--- a/configs/common/cores/arm/HPI.py
+++ b/configs/common/cores/arm/HPI.py
@@ -46,6 +46,7 @@ at: http://www.arm.com/ResearchEnablement/SystemModeling
"""
from __future__ import print_function
+from __future__ import absolute_import
from m5.objects import *
diff --git a/configs/common/cores/arm/O3_ARM_v7a.py b/configs/common/cores/arm/O3_ARM_v7a.py
index b0ba1280f..3a1f9af7c 100644
--- a/configs/common/cores/arm/O3_ARM_v7a.py
+++ b/configs/common/cores/arm/O3_ARM_v7a.py
@@ -26,6 +26,8 @@
#
# Authors: Ron Dreslinski
+from __future__ import print_function
+from __future__ import absolute_import
from m5.objects import *
diff --git a/configs/common/cores/arm/__init__.py b/configs/common/cores/arm/__init__.py
index 582e6b859..b90b61eac 100644
--- a/configs/common/cores/arm/__init__.py
+++ b/configs/common/cores/arm/__init__.py
@@ -35,6 +35,9 @@
#
# Authors: Andreas Sandberg
+from __future__ import print_function
+from __future__ import absolute_import
+
from pkgutil import iter_modules
from importlib import import_module
@@ -44,7 +47,7 @@ _cpu_modules = [
for c in _cpu_modules:
try:
- import_module("." + c, package=__package__)
+ import_module("." + c, package=__name__)
except NameError:
# Failed to import a CPU model due to a missing
# dependency. This typically happens if gem5 has been compiled
diff --git a/configs/common/cores/arm/ex5_LITTLE.py b/configs/common/cores/arm/ex5_LITTLE.py
index 1ae0f16df..85fdd5541 100644
--- a/configs/common/cores/arm/ex5_LITTLE.py
+++ b/configs/common/cores/arm/ex5_LITTLE.py
@@ -29,6 +29,9 @@
# Anastasiia Butko
# Louisa Bessad
+from __future__ import print_function
+from __future__ import absolute_import
+
from m5.objects import *
#-----------------------------------------------------------------------
diff --git a/configs/common/cores/arm/ex5_big.py b/configs/common/cores/arm/ex5_big.py
index 96323f435..445aa3255 100644
--- a/configs/common/cores/arm/ex5_big.py
+++ b/configs/common/cores/arm/ex5_big.py
@@ -29,6 +29,9 @@
# Anastasiia Butko
# Louisa Bessad
+from __future__ import print_function
+from __future__ import absolute_import
+
from m5.objects import *
#-----------------------------------------------------------------------
diff --git a/configs/common/cpu2000.py b/configs/common/cpu2000.py
index 8143e45de..730a47878 100644
--- a/configs/common/cpu2000.py
+++ b/configs/common/cpu2000.py
@@ -27,6 +27,7 @@
# Authors: Nathan Binkert
from __future__ import print_function
+from __future__ import absolute_import
import os
import sys
diff --git a/configs/dram/lat_mem_rd.py b/configs/dram/lat_mem_rd.py
index a1aa77df4..fd92a6350 100644
--- a/configs/dram/lat_mem_rd.py
+++ b/configs/dram/lat_mem_rd.py
@@ -36,6 +36,7 @@
# Authors: Andreas Hansson
from __future__ import print_function
+from __future__ import absolute_import
import gzip
import optparse
diff --git a/configs/dram/low_power_sweep.py b/configs/dram/low_power_sweep.py
index e9714a6dc..dc8de01e8 100644
--- a/configs/dram/low_power_sweep.py
+++ b/configs/dram/low_power_sweep.py
@@ -37,6 +37,7 @@
# Andreas Hansson
from __future__ import print_function
+from __future__ import absolute_import
import argparse
@@ -45,8 +46,9 @@ from m5.objects import *
from m5.util import addToPath
from m5.stats import periodicStatDump
-addToPath(os.getcwd() + '/configs/common')
-import MemConfig
+addToPath('../')
+
+from common import MemConfig
# This script aims at triggering low power state transitions in the DRAM
# controller. The traffic generator is used in DRAM mode and traffic
diff --git a/configs/dram/sweep.py b/configs/dram/sweep.py
index 10ef7486d..61b316417 100644
--- a/configs/dram/sweep.py
+++ b/configs/dram/sweep.py
@@ -36,6 +36,7 @@
# Authors: Andreas Hansson
from __future__ import print_function
+from __future__ import absolute_import
import math
import optparse
diff --git a/configs/example/apu_se.py b/configs/example/apu_se.py
index 146863d62..2b2d9c853 100644
--- a/configs/example/apu_se.py
+++ b/configs/example/apu_se.py
@@ -32,6 +32,7 @@
# Authors: Sooraj Puthoor
from __future__ import print_function
+from __future__ import absolute_import
import optparse, os, re
import math
diff --git a/configs/example/arm/devices.py b/configs/example/arm/devices.py
index 0c08ea23d..c7d5a7c4d 100644
--- a/configs/example/arm/devices.py
+++ b/configs/example/arm/devices.py
@@ -38,6 +38,9 @@
# System components used by the bigLITTLE.py configuration script
+from __future__ import print_function
+from __future__ import absolute_import
+
import m5
from m5.objects import *
m5.util.addToPath('../../')
diff --git a/configs/example/arm/dist_bigLITTLE.py b/configs/example/arm/dist_bigLITTLE.py
index 5194fc7e6..5bce3fd82 100644
--- a/configs/example/arm/dist_bigLITTLE.py
+++ b/configs/example/arm/dist_bigLITTLE.py
@@ -38,6 +38,9 @@
# This configuration file extends the example ARM big.LITTLE(tm)
# configuration to enabe dist-gem5 siulations of big.LITTLE systems.
+from __future__ import print_function
+from __future__ import absolute_import
+
import argparse
import os
diff --git a/configs/example/arm/fs_bigLITTLE.py b/configs/example/arm/fs_bigLITTLE.py
index f363872a3..678b038ea 100644
--- a/configs/example/arm/fs_bigLITTLE.py
+++ b/configs/example/arm/fs_bigLITTLE.py
@@ -41,6 +41,7 @@
from __future__ import print_function
+from __future__ import absolute_import
import argparse
import os
diff --git a/configs/example/arm/fs_power.py b/configs/example/arm/fs_power.py
index 7b92c8db8..0de656801 100644
--- a/configs/example/arm/fs_power.py
+++ b/configs/example/arm/fs_power.py
@@ -40,6 +40,7 @@
# with example power models.
from __future__ import print_function
+from __future__ import absolute_import
import argparse
import os
diff --git a/configs/example/arm/starter_fs.py b/configs/example/arm/starter_fs.py
index 6e53d7b8c..35ed2afa2 100644
--- a/configs/example/arm/starter_fs.py
+++ b/configs/example/arm/starter_fs.py
@@ -44,6 +44,7 @@ at: http://www.arm.com/ResearchEnablement/SystemModeling
"""
from __future__ import print_function
+from __future__ import absolute_import
import os
import m5
diff --git a/configs/example/arm/starter_se.py b/configs/example/arm/starter_se.py
index ef218d978..b76be5f48 100644
--- a/configs/example/arm/starter_se.py
+++ b/configs/example/arm/starter_se.py
@@ -44,6 +44,7 @@ at: http://www.arm.com/ResearchEnablement/SystemModeling
"""
from __future__ import print_function
+from __future__ import absolute_import
import os
import m5
diff --git a/configs/example/etrace_replay.py b/configs/example/etrace_replay.py
index e64871af7..588d0a454 100644
--- a/configs/example/etrace_replay.py
+++ b/configs/example/etrace_replay.py
@@ -38,6 +38,7 @@
# Basic elastic traces replay script that configures a Trace CPU
from __future__ import print_function
+from __future__ import absolute_import
import optparse
diff --git a/configs/example/fs.py b/configs/example/fs.py
index 70275a0f6..695744e10 100644
--- a/configs/example/fs.py
+++ b/configs/example/fs.py
@@ -42,6 +42,7 @@
# Brad Beckmann
from __future__ import print_function
+from __future__ import absolute_import
import optparse
import sys
diff --git a/configs/example/garnet_synth_traffic.py b/configs/example/garnet_synth_traffic.py
index f5b7690de..8396ddb2e 100644
--- a/configs/example/garnet_synth_traffic.py
+++ b/configs/example/garnet_synth_traffic.py
@@ -27,6 +27,7 @@
# Author: Tushar Krishna
from __future__ import print_function
+from __future__ import absolute_import
import m5
from m5.objects import *
diff --git a/configs/example/hmc_hello.py b/configs/example/hmc_hello.py
index d9a6c0f9e..a68251981 100644
--- a/configs/example/hmc_hello.py
+++ b/configs/example/hmc_hello.py
@@ -30,6 +30,9 @@
#
# Author: Éder F. Zulian
+from __future__ import print_function
+from __future__ import absolute_import
+
import sys
import argparse
diff --git a/configs/example/hmctest.py b/configs/example/hmctest.py
index 091ed8b03..32a82222b 100644
--- a/configs/example/hmctest.py
+++ b/configs/example/hmctest.py
@@ -1,4 +1,6 @@
+
from __future__ import print_function
+from __future__ import absolute_import
import sys
import argparse
diff --git a/configs/example/memcheck.py b/configs/example/memcheck.py
index 1dae86fc3..e758b67e7 100644
--- a/configs/example/memcheck.py
+++ b/configs/example/memcheck.py
@@ -40,6 +40,7 @@
# Andreas Hansson
from __future__ import print_function
+from __future__ import absolute_import
import optparse
import random
diff --git a/configs/example/memtest.py b/configs/example/memtest.py
index 81c826a41..1bbedfd46 100644
--- a/configs/example/memtest.py
+++ b/configs/example/memtest.py
@@ -40,6 +40,7 @@
# Andreas Hansson
from __future__ import print_function
+from __future__ import absolute_import
import optparse
import random
diff --git a/configs/example/read_config.py b/configs/example/read_config.py
index 0d60ec4cb..6ab5a8199 100644
--- a/configs/example/read_config.py
+++ b/configs/example/read_config.py
@@ -46,6 +46,7 @@
# debugging.
from __future__ import print_function
+from __future__ import absolute_import
import argparse
import ConfigParser
diff --git a/configs/example/ruby_direct_test.py b/configs/example/ruby_direct_test.py
index 317fb47fd..d69df6e0f 100644
--- a/configs/example/ruby_direct_test.py
+++ b/configs/example/ruby_direct_test.py
@@ -29,6 +29,7 @@
# Brad Beckmann
from __future__ import print_function
+from __future__ import absolute_import
import m5
from m5.objects import *
diff --git a/configs/example/ruby_gpu_random_test.py b/configs/example/ruby_gpu_random_test.py
index 175717701..63c4e9c87 100644
--- a/configs/example/ruby_gpu_random_test.py
+++ b/configs/example/ruby_gpu_random_test.py
@@ -32,6 +32,7 @@
# Authors: Brad Beckmann
from __future__ import print_function
+from __future__ import absolute_import
import m5
from m5.objects import *
diff --git a/configs/example/ruby_mem_test.py b/configs/example/ruby_mem_test.py
index 880a150cd..592ab1c60 100644
--- a/configs/example/ruby_mem_test.py
+++ b/configs/example/ruby_mem_test.py
@@ -29,6 +29,7 @@
# Brad Beckmann
from __future__ import print_function
+from __future__ import absolute_import
import m5
from m5.objects import *
diff --git a/configs/example/ruby_random_test.py b/configs/example/ruby_random_test.py
index 15d474cec..982557e25 100644
--- a/configs/example/ruby_random_test.py
+++ b/configs/example/ruby_random_test.py
@@ -29,6 +29,7 @@
# Brad Beckmann
from __future__ import print_function
+from __future__ import absolute_import
import m5
from m5.objects import *
diff --git a/configs/example/se.py b/configs/example/se.py
index 59af888e0..f3630db37 100644
--- a/configs/example/se.py
+++ b/configs/example/se.py
@@ -43,6 +43,7 @@
# "m5 test.py"
from __future__ import print_function
+from __future__ import absolute_import
import optparse
import sys
diff --git a/configs/learning_gem5/part1/caches.py b/configs/learning_gem5/part1/caches.py
index 5183c134d..5e87c2b2f 100644
--- a/configs/learning_gem5/part1/caches.py
+++ b/configs/learning_gem5/part1/caches.py
@@ -33,6 +33,10 @@ This file contains L1 I/D and L2 caches to be used in the simple
gem5 configuration script. It uses the SimpleOpts wrapper to set up command
line options from each individual class.
"""
+
+from __future__ import print_function
+from __future__ import absolute_import
+
import m5
from m5.objects import Cache
diff --git a/configs/learning_gem5/part1/simple.py b/configs/learning_gem5/part1/simple.py
index 5336b445b..c624de0aa 100644
--- a/configs/learning_gem5/part1/simple.py
+++ b/configs/learning_gem5/part1/simple.py
@@ -38,6 +38,8 @@ IMPORTANT: If you modify this file, it's likely that the Learning gem5 book
"""
from __future__ import print_function
+from __future__ import absolute_import
+
# import the m5 (gem5) library created when gem5 is built
import m5
diff --git a/configs/learning_gem5/part1/two_level.py b/configs/learning_gem5/part1/two_level.py
index 51d51c474..b6f8781d2 100644
--- a/configs/learning_gem5/part1/two_level.py
+++ b/configs/learning_gem5/part1/two_level.py
@@ -41,6 +41,7 @@ IMPORTANT: If you modify this file, it's likely that the Learning gem5 book
"""
from __future__ import print_function
+from __future__ import absolute_import
# import the m5 (gem5) library created when gem5 is built
import m5
diff --git a/configs/learning_gem5/part2/hello_goodbye.py b/configs/learning_gem5/part2/hello_goodbye.py
index e908ae0c3..e5ee5e78b 100644
--- a/configs/learning_gem5/part2/hello_goodbye.py
+++ b/configs/learning_gem5/part2/hello_goodbye.py
@@ -37,6 +37,7 @@ IMPORTANT: If you modify this file, it's likely that the Learning gem5 book
"""
from __future__ import print_function
+from __future__ import absolute_import
# import the m5 (gem5) library created when gem5 is built
import m5
diff --git a/configs/learning_gem5/part2/run_simple.py b/configs/learning_gem5/part2/run_simple.py
index 1b729ae7c..7940c0e04 100644
--- a/configs/learning_gem5/part2/run_simple.py
+++ b/configs/learning_gem5/part2/run_simple.py
@@ -36,6 +36,7 @@ system. Since there are no events, this "simulation" should finish immediately
"""
from __future__ import print_function
+from __future__ import absolute_import
# import the m5 (gem5) library created when gem5 is built
import m5
diff --git a/configs/learning_gem5/part2/simple_cache.py b/configs/learning_gem5/part2/simple_cache.py
index 98078df30..c65024233 100644
--- a/configs/learning_gem5/part2/simple_cache.py
+++ b/configs/learning_gem5/part2/simple_cache.py
@@ -34,6 +34,7 @@ This config file assumes that the x86 ISA was built.
"""
from __future__ import print_function
+from __future__ import absolute_import
# import the m5 (gem5) library created when gem5 is built
import m5
diff --git a/configs/learning_gem5/part2/simple_memobj.py b/configs/learning_gem5/part2/simple_memobj.py
index 066bca08d..24c6a24d6 100644
--- a/configs/learning_gem5/part2/simple_memobj.py
+++ b/configs/learning_gem5/part2/simple_memobj.py
@@ -34,6 +34,7 @@ This config file assumes that the x86 ISA was built.
"""
from __future__ import print_function
+from __future__ import absolute_import
# import the m5 (gem5) library created when gem5 is built
import m5
diff --git a/configs/learning_gem5/part3/msi_caches.py b/configs/learning_gem5/part3/msi_caches.py
index 7bd24efe1..42ec95a9f 100644
--- a/configs/learning_gem5/part3/msi_caches.py
+++ b/configs/learning_gem5/part3/msi_caches.py
@@ -36,6 +36,9 @@ IMPORTANT: If you modify this file, it's likely that the Learning gem5 book
"""
+from __future__ import print_function
+from __future__ import absolute_import
+
import math
from m5.defines import buildEnv
diff --git a/configs/learning_gem5/part3/ruby_caches_MI_example.py b/configs/learning_gem5/part3/ruby_caches_MI_example.py
index 104f0dff9..db39bace7 100644
--- a/configs/learning_gem5/part3/ruby_caches_MI_example.py
+++ b/configs/learning_gem5/part3/ruby_caches_MI_example.py
@@ -38,6 +38,9 @@ IMPORTANT: If you modify this file, it's likely that the Learning gem5 book
"""
+from __future__ import print_function
+from __future__ import absolute_import
+
import math
from m5.defines import buildEnv
diff --git a/configs/learning_gem5/part3/ruby_test.py b/configs/learning_gem5/part3/ruby_test.py
index 692a87e62..45c139bdf 100644
--- a/configs/learning_gem5/part3/ruby_test.py
+++ b/configs/learning_gem5/part3/ruby_test.py
@@ -35,13 +35,14 @@ IMPORTANT: If you modify this file, it's likely that the Learning gem5 book
"""
from __future__ import print_function
+from __future__ import absolute_import
# import the m5 (gem5) library created when gem5 is built
import m5
# import all of the SimObjects
from m5.objects import *
-from test_caches import TestCacheSystem
+from .test_caches import TestCacheSystem
# create the system we are going to simulate
system = System()
diff --git a/configs/learning_gem5/part3/simple_ruby.py b/configs/learning_gem5/part3/simple_ruby.py
index 9b89b78fd..dda9e6dc7 100644
--- a/configs/learning_gem5/part3/simple_ruby.py
+++ b/configs/learning_gem5/part3/simple_ruby.py
@@ -38,6 +38,7 @@ IMPORTANT: If you modify this file, it's likely that the Learning gem5 book
"""
from __future__ import print_function
+from __future__ import absolute_import
# import the m5 (gem5) library created when gem5 is built
import m5
@@ -46,7 +47,7 @@ from m5.objects import *
# You can import ruby_caches_MI_example to use the MI_example protocol instead
# of the MSI protocol
-from msi_caches import MyCacheSystem
+from .msi_caches import MyCacheSystem
# create the system we are going to simulate
system = System()
diff --git a/configs/learning_gem5/part3/test_caches.py b/configs/learning_gem5/part3/test_caches.py
index 3721f4a6b..4b17250ff 100644
--- a/configs/learning_gem5/part3/test_caches.py
+++ b/configs/learning_gem5/part3/test_caches.py
@@ -36,12 +36,15 @@ IMPORTANT: If you modify this file, it's likely that the Learning gem5 book
"""
+from __future__ import print_function
+from __future__ import absolute_import
+
from m5.defines import buildEnv
from m5.util import fatal
from m5.objects import *
-from msi_caches import L1Cache, DirController, MyNetwork
+from .msi_caches import L1Cache, DirController, MyNetwork
class TestCacheSystem(RubySystem):
diff --git a/configs/network/Network.py b/configs/network/Network.py
index 567e6b01f..c1e55bcdc 100644
--- a/configs/network/Network.py
+++ b/configs/network/Network.py
@@ -26,6 +26,9 @@
#
# Authors: Tushar Krishna
+from __future__ import print_function
+from __future__ import absolute_import
+
import math
import m5
from m5.objects import *
diff --git a/configs/network/__init__.py b/configs/network/__init__.py
index 1829385b6..32393d15f 100644
--- a/configs/network/__init__.py
+++ b/configs/network/__init__.py
@@ -34,3 +34,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Andreas Hansson
+
+from __future__ import print_function
+from __future__ import absolute_import
diff --git a/configs/ruby/GPU_RfO.py b/configs/ruby/GPU_RfO.py
index afe9614c0..c9bda0bc9 100644
--- a/configs/ruby/GPU_RfO.py
+++ b/configs/ruby/GPU_RfO.py
@@ -36,8 +36,8 @@ import m5
from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
-from Ruby import create_topology
-from Ruby import send_evicts
+from .Ruby import create_topology
+from .Ruby import send_evicts
addToPath('../')
diff --git a/configs/ruby/MI_example.py b/configs/ruby/MI_example.py
index e3395bdd2..5e3ec58f0 100644
--- a/configs/ruby/MI_example.py
+++ b/configs/ruby/MI_example.py
@@ -31,8 +31,8 @@ import math
import m5
from m5.objects import *
from m5.defines import buildEnv
-from Ruby import create_topology, create_directories
-from Ruby import send_evicts
+from .Ruby import create_topology, create_directories
+from .Ruby import send_evicts
#
# Declare caches used by the protocol
diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py
index 03e836eb0..ffa5a0294 100644
--- a/configs/ruby/Ruby.py
+++ b/configs/ruby/Ruby.py
@@ -81,7 +81,7 @@ def define_options(parser):
help="Recycle latency for ruby controller input buffers")
protocol = buildEnv['PROTOCOL']
- exec "import %s" % protocol
+ exec("from . import %s" % protocol)
eval("%s.define_options(parser)" % protocol)
Network.define_options(parser)
@@ -144,7 +144,7 @@ def create_topology(controllers, options):
found in configs/topologies/BaseTopology.py
This is a wrapper for the legacy topologies.
"""
- exec "import topologies.%s as Topo" % options.topology
+ exec("import topologies.%s as Topo" % options.topology)
topology = eval("Topo.%s(controllers)" % options.topology)
return topology
@@ -160,7 +160,7 @@ def create_system(options, full_system, system, piobus = None, dma_ports = [],
ruby.network = network
protocol = buildEnv['PROTOCOL']
- exec "import %s" % protocol
+ exec("from . import %s" % protocol)
try:
(cpu_sequencers, dir_cntrls, topology) = \
eval("%s.create_system(options, full_system, system, dma_ports,\
diff --git a/configs/splash2/cluster.py b/configs/splash2/cluster.py
index 753fb0f70..04195cc99 100644
--- a/configs/splash2/cluster.py
+++ b/configs/splash2/cluster.py
@@ -31,6 +31,7 @@
# "m5 test.py"
from __future__ import print_function
+from __future__ import absolute_import
import os
import optparse
diff --git a/configs/splash2/run.py b/configs/splash2/run.py
index f97616a51..c74266462 100644
--- a/configs/splash2/run.py
+++ b/configs/splash2/run.py
@@ -30,6 +30,7 @@
#
from __future__ import print_function
+from __future__ import absolute_import
import os
import optparse
diff --git a/configs/topologies/BaseTopology.py b/configs/topologies/BaseTopology.py
index bd8ae255e..180d4373a 100644
--- a/configs/topologies/BaseTopology.py
+++ b/configs/topologies/BaseTopology.py
@@ -26,6 +26,9 @@
#
# Authors: Jason Power
+from __future__ import print_function
+from __future__ import absolute_import
+
import m5
class BaseTopology(object):
diff --git a/configs/topologies/Cluster.py b/configs/topologies/Cluster.py
index 211647991..a0e7df638 100644
--- a/configs/topologies/Cluster.py
+++ b/configs/topologies/Cluster.py
@@ -26,8 +26,10 @@
#
# Authors: Jason Power
+from __future__ import print_function
+from __future__ import absolute_import
-from BaseTopology import BaseTopology
+from .BaseTopology import BaseTopology
class Cluster(BaseTopology):
""" A cluster is a group of nodes which are all one hop from eachother
diff --git a/configs/topologies/Crossbar.py b/configs/topologies/Crossbar.py
index 447b1c597..d545d541d 100644
--- a/configs/topologies/Crossbar.py
+++ b/configs/topologies/Crossbar.py
@@ -26,10 +26,13 @@
#
# Authors: Steve Reinhardt
+from __future__ import print_function
+from __future__ import absolute_import
+
from m5.params import *
from m5.objects import *
-from BaseTopology import SimpleTopology
+from .BaseTopology import SimpleTopology
class Crossbar(SimpleTopology):
description='Crossbar'
diff --git a/configs/topologies/CrossbarGarnet.py b/configs/topologies/CrossbarGarnet.py
index 64f8001e2..6322a319b 100644
--- a/configs/topologies/CrossbarGarnet.py
+++ b/configs/topologies/CrossbarGarnet.py
@@ -26,10 +26,13 @@
#
# Authors: Tushar Krishna
+from __future__ import print_function
+from __future__ import absolute_import
+
from m5.params import *
from m5.objects import *
-from BaseTopology import SimpleTopology
+from .BaseTopology import SimpleTopology
class CrossbarGarnet(SimpleTopology):
description='CrossbarGarnet'
diff --git a/configs/topologies/MeshDirCorners_XY.py b/configs/topologies/MeshDirCorners_XY.py
index 238162491..95cb486ab 100644
--- a/configs/topologies/MeshDirCorners_XY.py
+++ b/configs/topologies/MeshDirCorners_XY.py
@@ -26,10 +26,13 @@
#
# Authors: Brad Beckmann
+from __future__ import print_function
+from __future__ import absolute_import
+
from m5.params import *
from m5.objects import *
-from BaseTopology import SimpleTopology
+from .BaseTopology import SimpleTopology
# Creates a Mesh topology with 4 directories, one at each corner.
# One L1 (and L2, depending on the protocol) are connected to each router.
diff --git a/configs/topologies/Mesh_XY.py b/configs/topologies/Mesh_XY.py
index 200d346d9..79575b35d 100644
--- a/configs/topologies/Mesh_XY.py
+++ b/configs/topologies/Mesh_XY.py
@@ -28,10 +28,13 @@
# Authors: Brad Beckmann
# Tushar Krishna
+from __future__ import print_function
+from __future__ import absolute_import
+
from m5.params import *
from m5.objects import *
-from BaseTopology import SimpleTopology
+from .BaseTopology import SimpleTopology
# Creates a generic Mesh assuming an equal number of cache
# and directory controllers.
diff --git a/configs/topologies/Mesh_westfirst.py b/configs/topologies/Mesh_westfirst.py
index f3278200d..95cdae037 100644
--- a/configs/topologies/Mesh_westfirst.py
+++ b/configs/topologies/Mesh_westfirst.py
@@ -27,11 +27,13 @@
#
# Authors: Brad Beckmann
# Tushar Krishna
+from __future__ import print_function
+from __future__ import absolute_import
from m5.params import *
from m5.objects import *
-from BaseTopology import SimpleTopology
+from .BaseTopology import SimpleTopology
# Creates a generic Mesh assuming an equal number of cache
# and directory controllers.
diff --git a/configs/topologies/Pt2Pt.py b/configs/topologies/Pt2Pt.py
index 81d61d7d1..ce98dc5b0 100644
--- a/configs/topologies/Pt2Pt.py
+++ b/configs/topologies/Pt2Pt.py
@@ -28,10 +28,13 @@
# Authors: Brad Beckmann
# Tushar Krishna
+from __future__ import print_function
+from __future__ import absolute_import
+
from m5.params import *
from m5.objects import *
-from BaseTopology import SimpleTopology
+from .BaseTopology import SimpleTopology
class Pt2Pt(SimpleTopology):
description='Pt2Pt'
diff --git a/configs/topologies/__init__.py b/configs/topologies/__init__.py
index 1829385b6..32393d15f 100644
--- a/configs/topologies/__init__.py
+++ b/configs/topologies/__init__.py
@@ -34,3 +34,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Andreas Hansson
+
+from __future__ import print_function
+from __future__ import absolute_import