changeset d229654ff4c2 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=d229654ff4c2
description:
config: Refactor the network switch configuration file
This patch prevents the body of the script getting executed when
the script is imported as a module.
Change-Id: I70a50f6295f1e7a088398017f5fa9d06fe90476a
Reviewed-by: Andreas Sandberg <[email protected]>
diffstat:
configs/dist/sw.py | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diffs (29 lines):
diff -r 9323db591b22 -r d229654ff4c2 configs/dist/sw.py
--- a/configs/dist/sw.py Tue Feb 14 15:09:18 2017 -0600
+++ b/configs/dist/sw.py Tue Feb 14 15:09:18 2017 -0600
@@ -63,13 +63,17 @@
link.int0 = switch.interface[i]
return switch
-# Add options
-parser = optparse.OptionParser()
-Options.addCommonOptions(parser)
-Options.addFSOptions(parser)
-(options, args) = parser.parse_args()
-system = build_switch(options)
-root = Root(full_system = True, system = system)
-Simulation.run(options, root, None, None)
+def main():
+ # Add options
+ parser = optparse.OptionParser()
+ Options.addCommonOptions(parser)
+ Options.addFSOptions(parser)
+ (options, args) = parser.parse_args()
+ system = build_switch(options)
+ root = Root(full_system = True, system = system)
+ Simulation.run(options, root, None, None)
+
+if __name__ == "__m5_main__":
+ main()
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev