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 43from util import fatal |
44from util import attrdict |
45 46# define a MaxTick parameter 47MaxTick = 2**63 - 1 48 49# The final hook to generate .ini files. Called from the user script 50# once the config is built. 51def instantiate(ckpt_dir=None): 52 from m5 import options --- 15 unchanged lines hidden (view full) --- 68 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: 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() 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() 89 90 # Do a second pass to finish initializing the sim objects --- 135 unchanged lines hidden --- |