diff options
author | Jason Power <powerjg@cs.wisc.edu> | 2012-08-10 13:50:42 -0500 |
---|---|---|
committer | Jason Power <powerjg@cs.wisc.edu> | 2012-08-10 13:50:42 -0500 |
commit | 11411cc9c70fb532798c5c8fb287ad658111ff15 (patch) | |
tree | 5ac6030e71ed22cfb57ce927ad50cf76e44ba2ea /configs/topologies/BaseTopology.py | |
parent | 706e84f2b8553baba020560f4a83550f05b80630 (diff) | |
download | gem5-11411cc9c70fb532798c5c8fb287ad658111ff15.tar.xz |
Ruby: Clean up topology changes
This patch moves instantiateTopology into Ruby.py and removes the
mem/ruby/network/topologies directory. It also adds some extra inheritance to
the topologies to clean up some issues in the existing topologies.
Diffstat (limited to 'configs/topologies/BaseTopology.py')
-rw-r--r-- | configs/topologies/BaseTopology.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/configs/topologies/BaseTopology.py b/configs/topologies/BaseTopology.py index 114a29f19..2390bb5be 100644 --- a/configs/topologies/BaseTopology.py +++ b/configs/topologies/BaseTopology.py @@ -26,6 +26,7 @@ # # Authors: Jason Power +import m5 class BaseTopology(object): description = "BaseTopology" @@ -38,14 +39,28 @@ class BaseTopology(object): """ def makeTopology(self, options, IntLink, ExtLink, Router): - """ Called from src/mem/ruby/network/topologies/TopologyCreatory.py + """ Called from configs/ruby/Ruby.py The return value is ( list(Router), list(IntLink), list(ExtLink)) The API of this function cannot change when subclassing!! Any additional information needed to create this topology should be passed into the constructor when it's instantiated in configs/ruby/<protocol>.py """ - print "BaseTopology should have been overridden in a sub class!!" - import sys - sys.exit(1) + m5.util.fatal("BaseTopology should have been overridden!!") +class SimpleTopology(BaseTopology): + """ Provides methods needed for the topologies included in Ruby before + topology changes. + These topologies are "simple" in the sense that they only use a flat + list of controllers to construct the topology. + """ + description = "SimpleTopology" + + def __init__(self, controllers): + self.nodes = controllers + + def addController(self, controller): + self.nodes.append(controller) + + def __len__(self): + return len(self.nodes) |