diff options
author | Gabor Dozsa <gabor.dozsa@arm.com> | 2017-02-14 15:09:18 -0600 |
---|---|---|
committer | Gabor Dozsa <gabor.dozsa@arm.com> | 2017-02-14 15:09:18 -0600 |
commit | 3bdd58ccb40191ec1422725c7dc86a250ad7ef4e (patch) | |
tree | 3dbfefe233f5a3c7013ffe3db351b9f5f4aefc17 | |
parent | 54c478c0b867c3021cc19190fd32575a8c092560 (diff) | |
download | gem5-3bdd58ccb40191ec1422725c7dc86a250ad7ef4e.tar.xz |
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 <andreas.sandberg@arm.com>
-rw-r--r-- | configs/dist/sw.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/configs/dist/sw.py b/configs/dist/sw.py index b2476e2c2..e7f31c0f3 100644 --- a/configs/dist/sw.py +++ b/configs/dist/sw.py @@ -63,13 +63,17 @@ def build_switch(options): 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() |