ruby: Fix regressions and make Ruby configs Python packages
authorAndreas Hansson <andreas.hansson@arm.com>
Thu, 13 Oct 2016 07:17:19 +0000 (03:17 -0400)
committerAndreas Hansson <andreas.hansson@arm.com>
Thu, 13 Oct 2016 07:17:19 +0000 (03:17 -0400)
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.

29 files changed:
configs/common/__init__.py [new file with mode: 0644]
configs/example/apu_se.py
configs/example/fs.py
configs/example/garnet_synth_traffic.py
configs/example/ruby_direct_test.py
configs/example/ruby_gpu_random_test.py
configs/example/ruby_mem_test.py
configs/example/ruby_random_test.py
configs/example/se.py
configs/network/__init__.py [new file with mode: 0644]
configs/ruby/AMD_Base_Constructor.py
configs/ruby/GPU_RfO.py
configs/ruby/GPU_VIPER.py
configs/ruby/GPU_VIPER_Baseline.py
configs/ruby/GPU_VIPER_Region.py
configs/ruby/MOESI_AMD_Base.py
configs/ruby/Ruby.py
configs/ruby/__init__.py [new file with mode: 0644]
configs/topologies/__init__.py [new file with mode: 0644]
tests/configs/gpu-randomtest-ruby.py
tests/configs/gpu-ruby.py
tests/configs/memtest-ruby.py
tests/configs/o3-timing-mp-ruby.py
tests/configs/o3-timing-ruby.py
tests/configs/pc-simple-timing-ruby.py
tests/configs/rubytest-ruby.py
tests/configs/simple-atomic-mp-ruby.py
tests/configs/simple-timing-mp-ruby.py
tests/configs/simple-timing-ruby.py

diff --git a/configs/common/__init__.py b/configs/common/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
index 2069daccb0c0719e0708b40cf80b0dcc1b2537dd..84fadee3f8080e3924715585658253b33b53417c 100644 (file)
@@ -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)
index 32fc699ba82013e187dcb7d1b72887d2964288b9..13a8b0cf98b64260da73a63bfd6af4df02ba8e1b 100644 (file)
@@ -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()
 
index 8962c4af1c2373babc9285e502784eef3f93588c..f11022006f771a284533aeaf0ebb696e600df084 100644 (file)
@@ -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"))
 
index cc74aec5d79d2cd77dc2f5f2771781ceb007e767..128a7889a847f4518753d81378f7734c6f13cc15 100644 (file)
@@ -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:
index 00554671288db30d8d37b00f3cfe3c1a0b07d8a7..9af4467996d05a31dde50d47eaf1cb4af0d217ae 100644 (file)
@@ -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"))
 
index d7d36d687b4b571dc9dd9f46ac6549a2b3d69bf3..1958c139d934f7f99ec424595045631c853cba7c 100644 (file)
@@ -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"))
 
index 44df082b3f14bf4eade8d5d6469f72abcca75a79..a0dca297e86a86fcaa1462cbdcafed3b4fafb63a 100644 (file)
@@ -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"))
 
index 238aa9e64f11acb549c4692b5016630f37e4116c..cfc82e83ac9543cb455ecad48a1b59f60ae02ccf 100644 (file)
@@ -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 (file)
index 0000000..1829385
--- /dev/null
@@ -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
index d13153e9aab4863420c9f1e4afe0cfcbf7433584..b02b49f9827d6bd3a417a907714a6d1f18675fe0 100644 (file)
@@ -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
index 283ba70afd24a19b991d76748ad6d5b658d32f3f..71e21d932b87ad8f5cc3e7fc53f812dd7f61c6b9 100644 (file)
@@ -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
index eeed637d4bd6a5d4f78e987a35b470adf74e08b2..e4ba18089ebe7837522a6cc39026aa23e0c73ee8 100644 (file)
@@ -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
index 879b34e88c3fc8e370527b2ed838385849e43f75..978d4cc3996eff7d7b68a94a37089d76f330c405 100644 (file)
@@ -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
index 94cb9b70b2d9521e06c0c45e9b7f58747fd256d7..8b59c047d9049f982208ca8cc3ee644f60f6669e 100644 (file)
@@ -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
index 4c8ad28b0ceb23ee30c1093bb40fbf293219ce72..f1b3d792b027e417bbf92c666756109203274f6b 100644 (file)
@@ -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
index 2670c678ac34b97434a7cd15dd9309503bda5b78..a82f6dc5c6193566ee6142fa284d3f624427dd1a 100644 (file)
@@ -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 (file)
index 0000000..1829385
--- /dev/null
@@ -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 (file)
index 0000000..1829385
--- /dev/null
@@ -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
index 92810fd649cd6528e34aebb42bf1ab5f6f64229a..0bc386973b35d0cdc80094a7847263a65219ce06 100644 (file)
@@ -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()
index d007ebffc635f311a7b94cd6a8755c9aa9474a20..b019147801e13fe15dda7fff38e8d13bc5d2007c 100644 (file)
@@ -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
 
index 221d28b2ed5ac6dbb0721edc157979bcacd1292f..1fac02a14214136deecf4b8831c557f49faa9fff 100644 (file)
@@ -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()
index fb2d56fd1f5e789fc82327269cd8805c00eb89a2..74b207b3ef172236681707948b3254333168b4c1 100644 (file)
@@ -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) ]
index c47d9f355caa3de7575397aaf692cca1369485db..787ae0badb96cede3716e54c3580257e79fb917a 100644 (file)
@@ -29,7 +29,6 @@
 import m5
 from m5.objects import *
 m5.util.addToPath('../configs/common')
-m5.util.addToPath('../configs/topologies')
 
 
 import ruby_config
index 006aeb6a43cd3b30d3d4a595bfac0df271722c33..32964a8753ccef13c3c119d1fec26ec1cde67a83 100644 (file)
@@ -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
index 77c7b51a8bb4be73ce0c285c278cc2df2321124c..6e64785da12de982e1dd1a1c25f2f241e9bb2ead 100644 (file)
@@ -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()
index bdda6d0051c02e645734310911ebce82ec2d47b4..e435907417ea4c2600664cb866f955f581f048ee 100644 (file)
@@ -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) ]
index 263b330fb10345299d7c8ed1ba96932e58b63488..c7dd6cd878cb6a83f14ff9bcf43f746faf6bfc7c 100644 (file)
@@ -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)
index b9fb650e5cf736d2b92c85c432b99d200165033d..2d2a9e4dfd110103c5ee8cfda63d258543413663 100644 (file)
@@ -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()