simulate.py (8998:c8bf5a20bc07) simulate.py (8999:6f306dd5cee0)
1# Copyright (c) 2012 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license
9# terms below provided that you ensure that this notice is replicated
10# unmodified and in its entirety in all distributions of the software,
11# modified or unmodified, in source code or in binary form.
12#
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;

--- 18 unchanged lines hidden (view full) ---

27#
28# Authors: Nathan Binkert
29# Steve Reinhardt
30
31import atexit
32import os
33import sys
34
13# Copyright (c) 2005 The Regents of The University of Michigan
14# Copyright (c) 2010 Advanced Micro Devices, Inc.
15# All rights reserved.
16#
17# Redistribution and use in source and binary forms, with or without
18# modification, are permitted provided that the following conditions are
19# met: redistributions of source code must retain the above copyright
20# notice, this list of conditions and the following disclaimer;

--- 18 unchanged lines hidden (view full) ---

39#
40# Authors: Nathan Binkert
41# Steve Reinhardt
42
43import atexit
44import os
45import sys
46
35try:
36 import pydot
37except:
38 pydot = False
39
40
41# import the SWIG-wrapped main C++ functions
42import internal
43import core
44import stats
45import SimObject
46import ticks
47import objects
47# import the SWIG-wrapped main C++ functions
48import internal
49import core
50import stats
51import SimObject
52import ticks
53import objects
54from m5.util.dot_writer import do_dot
55
48from util import fatal
49from util import attrdict
50
51# define a MaxTick parameter
52MaxTick = 2**63 - 1
53
54# The final hook to generate .ini files. Called from the user script
55# once the config is built.

--- 27 unchanged lines hidden (view full) ---

83 import json
84 json_file = file(os.path.join(options.outdir, options.json_config), 'w')
85 d = root.get_config_as_dict()
86 json.dump(d, json_file, indent=4)
87 json_file.close()
88 except ImportError:
89 pass
90
56from util import fatal
57from util import attrdict
58
59# define a MaxTick parameter
60MaxTick = 2**63 - 1
61
62# The final hook to generate .ini files. Called from the user script
63# once the config is built.

--- 27 unchanged lines hidden (view full) ---

91 import json
92 json_file = file(os.path.join(options.outdir, options.json_config), 'w')
93 d = root.get_config_as_dict()
94 json.dump(d, json_file, indent=4)
95 json_file.close()
96 except ImportError:
97 pass
98
91 if pydot:
92 doDot(root)
99 do_dot(root, options.outdir, options.dot_config)
93
94 # Initialize the global statistics
95 stats.initSimStats()
96
97 # Create the C++ sim objects and connect ports
98 for obj in root.descendants(): obj.createCCObject()
99 for obj in root.descendants(): obj.connectPorts()
100

--- 14 unchanged lines hidden (view full) ---

115 for obj in root.descendants(): obj.loadState(ckpt)
116 need_resume.append(root)
117 else:
118 for obj in root.descendants(): obj.initState()
119
120 # Reset to put the stats in a consistent state.
121 stats.reset()
122
100
101 # Initialize the global statistics
102 stats.initSimStats()
103
104 # Create the C++ sim objects and connect ports
105 for obj in root.descendants(): obj.createCCObject()
106 for obj in root.descendants(): obj.connectPorts()
107

--- 14 unchanged lines hidden (view full) ---

122 for obj in root.descendants(): obj.loadState(ckpt)
123 need_resume.append(root)
124 else:
125 for obj in root.descendants(): obj.initState()
126
127 # Reset to put the stats in a consistent state.
128 stats.reset()
129
123def doDot(root):
124 from m5 import options
125 dot = pydot.Dot()
126 root.outputDot(dot)
127 dot.orientation = "portrait"
128 dot.size = "8.5,11"
129 dot.ranksep="equally"
130 dot.rank="samerank"
131 dot_filename = os.path.join(options.outdir, options.dot_config)
132 dot.write(dot_filename)
133 dot.write_pdf(dot_filename + ".pdf")
134
135need_resume = []
136need_startup = True
137def simulate(*args, **kwargs):
138 global need_resume, need_startup
139
140 if need_startup:
141 root = objects.Root.getInstance()
142 for obj in root.descendants(): obj.startup()

--- 96 unchanged lines hidden ---
130need_resume = []
131need_startup = True
132def simulate(*args, **kwargs):
133 global need_resume, need_startup
134
135 if need_startup:
136 root = objects.Root.getInstance()
137 for obj in root.descendants(): obj.startup()

--- 96 unchanged lines hidden ---