simulate.py (8664:42052d5bb793) | simulate.py (8675:fd3f7091a5cf) |
---|---|
1# Copyright (c) 2005 The Regents of The University of Michigan 2# Copyright (c) 2010 Advanced Micro Devices, Inc. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 17 unchanged lines hidden (view full) --- 26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27# 28# Authors: Nathan Binkert 29# Steve Reinhardt 30 31import atexit 32import os 33import sys | 1# Copyright (c) 2005 The Regents of The University of Michigan 2# Copyright (c) 2010 Advanced Micro Devices, Inc. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 17 unchanged lines hidden (view full) --- 26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27# 28# Authors: Nathan Binkert 29# Steve Reinhardt 30 31import atexit 32import os 33import sys |
34import json | |
35 36# import the SWIG-wrapped main C++ functions 37import internal 38import core 39import stats 40import SimObject 41import ticks 42import objects --- 26 unchanged lines hidden (view full) --- 69 if options.dump_config: 70 ini_file = file(os.path.join(options.outdir, options.dump_config), 'w') 71 # Print ini sections in sorted order for easier diffing 72 for obj in sorted(root.descendants(), key=lambda o: o.path()): 73 obj.print_ini(ini_file) 74 ini_file.close() 75 76 if options.json_config: | 34 35# import the SWIG-wrapped main C++ functions 36import internal 37import core 38import stats 39import SimObject 40import ticks 41import objects --- 26 unchanged lines hidden (view full) --- 68 if options.dump_config: 69 ini_file = file(os.path.join(options.outdir, options.dump_config), 'w') 70 # Print ini sections in sorted order for easier diffing 71 for obj in sorted(root.descendants(), key=lambda o: o.path()): 72 obj.print_ini(ini_file) 73 ini_file.close() 74 75 if options.json_config: |
77 json_file = file(os.path.join(options.outdir, options.json_config), 'w') 78 d = root.get_config_as_dict() 79 json.dump(d, json_file, indent=4) 80 json_file.close() | 76 try: 77 import json 78 json_file = file(os.path.join(options.outdir, options.json_config), 'w') 79 d = root.get_config_as_dict() 80 json.dump(d, json_file, indent=4) 81 json_file.close() 82 except ImportError: 83 pass |
81 82 83 # Initialize the global statistics 84 stats.initSimStats() 85 86 # Create the C++ sim objects and connect ports 87 for obj in root.descendants(): obj.createCCObject() 88 for obj in root.descendants(): obj.connectPorts() --- 137 unchanged lines hidden --- | 84 85 86 # Initialize the global statistics 87 stats.initSimStats() 88 89 # Create the C++ sim objects and connect ports 90 for obj in root.descendants(): obj.createCCObject() 91 for obj in root.descendants(): obj.connectPorts() --- 137 unchanged lines hidden --- |