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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user