summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2016-10-13 03:17:19 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2016-10-13 03:17:19 -0400
commit68fdccb30bd85cd99823fb411ec7ae67112062d7 (patch)
treee6ef3d54238c64c63b00a3b83da96a9a1cdaad8b
parent2e5e9085792b1a7c47c231a2adf0da6f7ff8f20d (diff)
downloadgem5-68fdccb30bd85cd99823fb411ec7ae67112062d7.tar.xz
ruby: Fix regressions and make Ruby configs Python packages
This patch moves the addition of network options into the Ruby module to avoid the regressions all having to add it explicitly. Doing this exposes an issue in our current config system though, namely the fact that addtoPath is relative to the Python script being executed. Since both example and regression scripts use the Ruby module we would end up with two different (relative) paths being added. Instead we take a first step at turning the config modules into Python packages, simply by adding a __init__.py in the configs/ruby, configs/topologies and configs/network subdirectories. As a result, we can now add the top-level configs directory to the Python search path, and then use the package names in the various modules. The example scripts are also updated, and the messy path-deducing variations in the scripts are unified.
-rw-r--r--configs/common/__init__.py0
-rw-r--r--configs/example/apu_se.py9
-rw-r--r--configs/example/fs.py7
-rw-r--r--configs/example/garnet_synth_traffic.py8
-rw-r--r--configs/example/ruby_direct_test.py8
-rw-r--r--configs/example/ruby_gpu_random_test.py8
-rw-r--r--configs/example/ruby_mem_test.py8
-rw-r--r--configs/example/ruby_random_test.py8
-rw-r--r--configs/example/se.py8
-rw-r--r--configs/network/__init__.py36
-rw-r--r--configs/ruby/AMD_Base_Constructor.py2
-rw-r--r--configs/ruby/GPU_RfO.py4
-rw-r--r--configs/ruby/GPU_VIPER.py4
-rw-r--r--configs/ruby/GPU_VIPER_Baseline.py4
-rw-r--r--configs/ruby/GPU_VIPER_Region.py2
-rw-r--r--configs/ruby/MOESI_AMD_Base.py4
-rw-r--r--configs/ruby/Ruby.py8
-rw-r--r--configs/ruby/__init__.py36
-rw-r--r--configs/topologies/__init__.py36
-rw-r--r--tests/configs/gpu-randomtest-ruby.py13
-rw-r--r--tests/configs/gpu-ruby.py12
-rw-r--r--tests/configs/memtest-ruby.py13
-rw-r--r--tests/configs/o3-timing-mp-ruby.py1
-rw-r--r--tests/configs/o3-timing-ruby.py1
-rw-r--r--tests/configs/pc-simple-timing-ruby.py5
-rw-r--r--tests/configs/rubytest-ruby.py13
-rw-r--r--tests/configs/simple-atomic-mp-ruby.py2
-rw-r--r--tests/configs/simple-timing-mp-ruby.py11
-rw-r--r--tests/configs/simple-timing-ruby.py12
29 files changed, 165 insertions, 118 deletions
diff --git a/configs/common/__init__.py b/configs/common/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/configs/common/__init__.py
diff --git a/configs/example/apu_se.py b/configs/example/apu_se.py
index 2069daccb..84fadee3f 100644
--- a/configs/example/apu_se.py
+++ b/configs/example/apu_se.py
@@ -42,14 +42,12 @@ import m5
from m5.objects import *
from m5.util import addToPath
-addToPath('../ruby')
-addToPath('../network')
+addToPath('../')
addToPath('../common')
-addToPath('../topologies')
+
+from ruby import Ruby
import Options
-import Ruby
-import Network
import Simulation
import GPUTLBOptions, GPUTLBConfig
@@ -159,7 +157,6 @@ parser.add_option('--fast-forward-pseudo-op', action='store_true',
Ruby.define_options(parser)
-Network.define_options(parser)
#add TLB options to the parser
GPUTLBOptions.tlb_options(parser)
diff --git a/configs/example/fs.py b/configs/example/fs.py
index 32fc699ba..13a8b0cf9 100644
--- a/configs/example/fs.py
+++ b/configs/example/fs.py
@@ -49,12 +49,10 @@ from m5.defines import buildEnv
from m5.objects import *
from m5.util import addToPath, fatal
+addToPath('../')
addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-import Ruby
-import Network
+from ruby import Ruby
from FSConfig import *
from SysPaths import *
@@ -308,7 +306,6 @@ Options.addFSOptions(parser)
# Add the ruby specific and protocol specific options
if '--ruby' in sys.argv:
Ruby.define_options(parser)
- Network.define_options(parser)
(options, args) = parser.parse_args()
diff --git a/configs/example/garnet_synth_traffic.py b/configs/example/garnet_synth_traffic.py
index 8962c4af1..f11022006 100644
--- a/configs/example/garnet_synth_traffic.py
+++ b/configs/example/garnet_synth_traffic.py
@@ -32,13 +32,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
import Options
-import Ruby
-import Network
+from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__file__))
@@ -87,7 +84,6 @@ parser.add_option("--inj-vnet", type="int", default=-1,
# Add the ruby specific and protocol specific options
#
Ruby.define_options(parser)
-Network.define_options(parser)
execfile(os.path.join(config_root, "common", "Options.py"))
diff --git a/configs/example/ruby_direct_test.py b/configs/example/ruby_direct_test.py
index cc74aec5d..128a7889a 100644
--- a/configs/example/ruby_direct_test.py
+++ b/configs/example/ruby_direct_test.py
@@ -34,13 +34,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
import Options
-import Ruby
-import Network
+from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__file__))
@@ -65,7 +62,6 @@ parser.add_option("--percent-writes", type="int", default=100,
# Add the ruby specific and protocol specific options
#
Ruby.define_options(parser)
-Network.define_options(parser)
(options, args) = parser.parse_args()
if args:
diff --git a/configs/example/ruby_gpu_random_test.py b/configs/example/ruby_gpu_random_test.py
index 005546712..9af446799 100644
--- a/configs/example/ruby_gpu_random_test.py
+++ b/configs/example/ruby_gpu_random_test.py
@@ -39,13 +39,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
import Options
-import Ruby
-import Network
+from ruby import Ruby
# Get paths we might need.
config_path = os.path.dirname(os.path.abspath(__file__))
@@ -78,7 +75,6 @@ parser.add_option("--wfs-per-simd", type="int", default=10, help="Number of " \
# Add the ruby specific and protocol specific options
#
Ruby.define_options(parser)
-Network.define_options(parser)
execfile(os.path.join(config_root, "common", "Options.py"))
diff --git a/configs/example/ruby_mem_test.py b/configs/example/ruby_mem_test.py
index d7d36d687..1958c139d 100644
--- a/configs/example/ruby_mem_test.py
+++ b/configs/example/ruby_mem_test.py
@@ -34,13 +34,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
import Options
-import Ruby
-import Network
+from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__file__))
@@ -65,7 +62,6 @@ parser.add_option("--suppress-func-warnings", action="store_true",
# Add the ruby specific and protocol specific options
#
Ruby.define_options(parser)
-Network.define_options(parser)
execfile(os.path.join(config_root, "common", "Options.py"))
diff --git a/configs/example/ruby_random_test.py b/configs/example/ruby_random_test.py
index 44df082b3..a0dca297e 100644
--- a/configs/example/ruby_random_test.py
+++ b/configs/example/ruby_random_test.py
@@ -34,13 +34,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
import Options
-import Ruby
-import Network
+from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__file__))
@@ -59,7 +56,6 @@ parser.add_option("-f", "--wakeup_freq", metavar="N", default=10,
# Add the ruby specific and protocol specific options
#
Ruby.define_options(parser)
-Network.define_options(parser)
execfile(os.path.join(config_root, "common", "Options.py"))
diff --git a/configs/example/se.py b/configs/example/se.py
index 238aa9e64..cfc82e83a 100644
--- a/configs/example/se.py
+++ b/configs/example/se.py
@@ -51,13 +51,12 @@ from m5.defines import buildEnv
from m5.objects import *
from m5.util import addToPath, fatal
+addToPath('../')
addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
+
+from ruby import Ruby
import Options
-import Ruby
-import Network
import Simulation
import CacheConfig
import CpuConfig
@@ -129,7 +128,6 @@ Options.addSEOptions(parser)
if '--ruby' in sys.argv:
Ruby.define_options(parser)
- Network.define_options(parser)
(options, args) = parser.parse_args()
diff --git a/configs/network/__init__.py b/configs/network/__init__.py
new file mode 100644
index 000000000..1829385b6
--- /dev/null
+++ b/configs/network/__init__.py
@@ -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
diff --git a/configs/ruby/AMD_Base_Constructor.py b/configs/ruby/AMD_Base_Constructor.py
index d13153e9a..b02b49f98 100644
--- a/configs/ruby/AMD_Base_Constructor.py
+++ b/configs/ruby/AMD_Base_Constructor.py
@@ -39,7 +39,7 @@ from m5.objects import *
from m5.defines import buildEnv
from m5.util import convert
from CntrlBase import *
-from Cluster import Cluster
+from topologies.Cluster import Cluster
#
# Note: the L1 Cache latency is only used by the sequencer on fast path hits
diff --git a/configs/ruby/GPU_RfO.py b/configs/ruby/GPU_RfO.py
index 283ba70af..71e21d932 100644
--- a/configs/ruby/GPU_RfO.py
+++ b/configs/ruby/GPU_RfO.py
@@ -40,8 +40,8 @@ from m5.defines import buildEnv
from Ruby import create_topology
from Ruby import send_evicts
-from Cluster import Cluster
-from Crossbar import Crossbar
+from topologies.Cluster import Cluster
+from topologies.Crossbar import Crossbar
class CntrlBase:
_seqs = 0
diff --git a/configs/ruby/GPU_VIPER.py b/configs/ruby/GPU_VIPER.py
index eeed637d4..e4ba18089 100644
--- a/configs/ruby/GPU_VIPER.py
+++ b/configs/ruby/GPU_VIPER.py
@@ -40,8 +40,8 @@ from m5.defines import buildEnv
from Ruby import create_topology
from Ruby import send_evicts
-from Cluster import Cluster
-from Crossbar import Crossbar
+from topologies.Cluster import Cluster
+from topologies.Crossbar import Crossbar
class CntrlBase:
_seqs = 0
diff --git a/configs/ruby/GPU_VIPER_Baseline.py b/configs/ruby/GPU_VIPER_Baseline.py
index 879b34e88..978d4cc39 100644
--- a/configs/ruby/GPU_VIPER_Baseline.py
+++ b/configs/ruby/GPU_VIPER_Baseline.py
@@ -40,8 +40,8 @@ from m5.defines import buildEnv
from Ruby import create_topology
from Ruby import send_evicts
-from Cluster import Cluster
-from Crossbar import Crossbar
+from topologies.Cluster import Cluster
+from topologies.Crossbar import Crossbar
class CntrlBase:
_seqs = 0
diff --git a/configs/ruby/GPU_VIPER_Region.py b/configs/ruby/GPU_VIPER_Region.py
index 94cb9b70b..8b59c047d 100644
--- a/configs/ruby/GPU_VIPER_Region.py
+++ b/configs/ruby/GPU_VIPER_Region.py
@@ -39,7 +39,7 @@ from m5.objects import *
from m5.defines import buildEnv
from Ruby import send_evicts
-from Cluster import Cluster
+from topologies.Cluster import Cluster
class CntrlBase:
_seqs = 0
diff --git a/configs/ruby/MOESI_AMD_Base.py b/configs/ruby/MOESI_AMD_Base.py
index 4c8ad28b0..f1b3d792b 100644
--- a/configs/ruby/MOESI_AMD_Base.py
+++ b/configs/ruby/MOESI_AMD_Base.py
@@ -40,8 +40,8 @@ from m5.defines import buildEnv
from Ruby import create_topology
from Ruby import send_evicts
-from Cluster import Cluster
-from Crossbar import Crossbar
+from topologies.Cluster import Cluster
+from topologies.Crossbar import Crossbar
class CntrlBase:
_seqs = 0
diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py
index 2670c678a..a82f6dc5c 100644
--- a/configs/ruby/Ruby.py
+++ b/configs/ruby/Ruby.py
@@ -46,10 +46,9 @@ from m5.defines import buildEnv
from m5.util import addToPath, fatal
import MemConfig
-addToPath('../topologies')
-addToPath('../network')
-import Network
+from topologies import *
+from network import Network
def define_options(parser):
# By default, ruby uses the simple timing cpu
@@ -80,6 +79,7 @@ def define_options(parser):
protocol = buildEnv['PROTOCOL']
exec "import %s" % protocol
eval("%s.define_options(parser)" % protocol)
+ Network.define_options(parser)
def setup_memory_controllers(system, ruby, dir_cntrls, options):
ruby.block_size_bytes = options.cacheline_size
@@ -141,7 +141,7 @@ def create_topology(controllers, options):
found in configs/topologies/BaseTopology.py
This is a wrapper for the legacy topologies.
"""
- exec "import %s as Topo" % options.topology
+ exec "import topologies.%s as Topo" % options.topology
topology = eval("Topo.%s(controllers)" % options.topology)
return topology
diff --git a/configs/ruby/__init__.py b/configs/ruby/__init__.py
new file mode 100644
index 000000000..1829385b6
--- /dev/null
+++ b/configs/ruby/__init__.py
@@ -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
diff --git a/configs/topologies/__init__.py b/configs/topologies/__init__.py
new file mode 100644
index 000000000..1829385b6
--- /dev/null
+++ b/configs/topologies/__init__.py
@@ -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
diff --git a/tests/configs/gpu-randomtest-ruby.py b/tests/configs/gpu-randomtest-ruby.py
index 92810fd64..0bc386973 100644
--- a/tests/configs/gpu-randomtest-ruby.py
+++ b/tests/configs/gpu-randomtest-ruby.py
@@ -39,15 +39,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
-# Get paths we might need. It's expected this file is in m5/configs/example.
-config_path = os.path.dirname(os.path.abspath(__file__))
-config_root = os.path.dirname(config_path)
-m5_root = os.path.dirname(config_root)
-addToPath(config_root+'/configs/common')
-addToPath(config_root+'/configs/ruby')
-addToPath(config_root+'/configs/topologies')
-
-import Ruby
+m5.util.addToPath('../configs/common')
+m5.util.addToPath('../configs/')
+
+from ruby import Ruby
import Options
parser = optparse.OptionParser()
diff --git a/tests/configs/gpu-ruby.py b/tests/configs/gpu-ruby.py
index d007ebffc..b01914780 100644
--- a/tests/configs/gpu-ruby.py
+++ b/tests/configs/gpu-ruby.py
@@ -39,14 +39,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys, math, glob
-# Get paths we might need
-config_path = os.path.dirname(os.path.abspath(__file__))
-config_root = os.path.dirname(config_path)
-addToPath(config_root+'/configs/common')
-addToPath(config_root+'/configs/ruby')
-addToPath(config_root+'/configs/topologies')
-
-import Ruby
+m5.util.addToPath('../configs/common')
+m5.util.addToPath('../configs/')
+
+from ruby import Ruby
import Options
import GPUTLBOptions, GPUTLBConfig
diff --git a/tests/configs/memtest-ruby.py b/tests/configs/memtest-ruby.py
index 221d28b2e..1fac02a14 100644
--- a/tests/configs/memtest-ruby.py
+++ b/tests/configs/memtest-ruby.py
@@ -33,15 +33,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
-# Get paths we might need
-config_path = os.path.dirname(os.path.abspath(__file__))
-config_root = os.path.dirname(config_path)
-m5_root = os.path.dirname(config_root)
-addToPath(config_root+'/configs/common')
-addToPath(config_root+'/configs/ruby')
-addToPath(config_root+'/configs/topologies')
-
-import Ruby
+m5.util.addToPath('../configs/common')
+m5.util.addToPath('../configs/')
+
+from ruby import Ruby
import Options
parser = optparse.OptionParser()
diff --git a/tests/configs/o3-timing-mp-ruby.py b/tests/configs/o3-timing-mp-ruby.py
index fb2d56fd1..74b207b3e 100644
--- a/tests/configs/o3-timing-mp-ruby.py
+++ b/tests/configs/o3-timing-mp-ruby.py
@@ -29,7 +29,6 @@
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
-m5.util.addToPath('../configs/topologies')
nb_cores = 4
cpus = [ DerivO3CPU(cpu_id=i) for i in xrange(nb_cores) ]
diff --git a/tests/configs/o3-timing-ruby.py b/tests/configs/o3-timing-ruby.py
index c47d9f355..787ae0bad 100644
--- a/tests/configs/o3-timing-ruby.py
+++ b/tests/configs/o3-timing-ruby.py
@@ -29,7 +29,6 @@
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
-m5.util.addToPath('../configs/topologies')
import ruby_config
diff --git a/tests/configs/pc-simple-timing-ruby.py b/tests/configs/pc-simple-timing-ruby.py
index 006aeb6a4..32964a875 100644
--- a/tests/configs/pc-simple-timing-ruby.py
+++ b/tests/configs/pc-simple-timing-ruby.py
@@ -32,9 +32,8 @@ m5.util.addToPath('../configs/common')
from Benchmarks import SysConfig
import FSConfig
-m5.util.addToPath('../configs/ruby')
-m5.util.addToPath('../configs/topologies')
-import Ruby
+m5.util.addToPath('../configs/')
+from ruby import Ruby
import Options
# Add the ruby specific and protocol specific options
diff --git a/tests/configs/rubytest-ruby.py b/tests/configs/rubytest-ruby.py
index 77c7b51a8..6e64785da 100644
--- a/tests/configs/rubytest-ruby.py
+++ b/tests/configs/rubytest-ruby.py
@@ -34,15 +34,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
-# Get paths we might need. It's expected this file is in m5/configs/example.
-config_path = os.path.dirname(os.path.abspath(__file__))
-config_root = os.path.dirname(config_path)
-m5_root = os.path.dirname(config_root)
-addToPath(config_root+'/configs/common')
-addToPath(config_root+'/configs/ruby')
-addToPath(config_root+'/configs/topologies')
-
-import Ruby
+m5.util.addToPath('../configs/common')
+m5.util.addToPath('../configs/')
+
+from ruby import Ruby
import Options
parser = optparse.OptionParser()
diff --git a/tests/configs/simple-atomic-mp-ruby.py b/tests/configs/simple-atomic-mp-ruby.py
index bdda6d005..e43590741 100644
--- a/tests/configs/simple-atomic-mp-ruby.py
+++ b/tests/configs/simple-atomic-mp-ruby.py
@@ -28,8 +28,6 @@
import m5
from m5.objects import *
-m5.util.addToPath('../configs/topologies')
-
nb_cores = 4
cpus = [ AtomicSimpleCPU(cpu_id=i) for i in xrange(nb_cores) ]
diff --git a/tests/configs/simple-timing-mp-ruby.py b/tests/configs/simple-timing-mp-ruby.py
index 263b330fb..c7dd6cd87 100644
--- a/tests/configs/simple-timing-mp-ruby.py
+++ b/tests/configs/simple-timing-mp-ruby.py
@@ -32,16 +32,11 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
-# Get paths we might need
-config_path = os.path.dirname(os.path.abspath(__file__))
-config_root = os.path.dirname(config_path)
-m5_root = os.path.dirname(config_root)
-addToPath(config_root+'/configs/common')
-addToPath(config_root+'/configs/ruby')
-addToPath(config_root+'/configs/topologies')
+m5.util.addToPath('../configs/common')
+m5.util.addToPath('../configs/')
import Options
-import Ruby
+from ruby import Ruby
parser = optparse.OptionParser()
Options.addCommonOptions(parser)
diff --git a/tests/configs/simple-timing-ruby.py b/tests/configs/simple-timing-ruby.py
index b9fb650e5..2d2a9e4df 100644
--- a/tests/configs/simple-timing-ruby.py
+++ b/tests/configs/simple-timing-ruby.py
@@ -32,14 +32,10 @@ from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
-# Get paths we might need
-config_path = os.path.dirname(os.path.abspath(__file__))
-config_root = os.path.dirname(config_path)
-addToPath(config_root+'/configs/common')
-addToPath(config_root+'/configs/ruby')
-addToPath(config_root+'/configs/topologies')
-
-import Ruby
+m5.util.addToPath('../configs/common')
+m5.util.addToPath('../configs/')
+
+from ruby import Ruby
import Options
parser = optparse.OptionParser()