gem5 v24.0.0.0
Loading...
Searching...
No Matches
sc_process_handle.cc
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
34
35namespace sc_core
36{
37
38const char *
40{
41 return _isReset ? "RESET" : "KILL";
42}
43
44bool
46{
47 return _isReset;
48}
49
52 _isReset(e._isReset)
53{}
55
56
57void
58sc_set_location(const char *file, int lineno)
59{
61 if (!current)
62 return;
63 current->file = file;
64 current->lineno = lineno;
65}
66
67
68sc_process_b *
70{
71 return ::sc_gem5::scheduler.current();
72}
73
74
75sc_process_handle::sc_process_handle() : _gem5_process(nullptr) {}
76
78 _gem5_process(handle._gem5_process)
79{
80 if (_gem5_process)
82}
83
85 _gem5_process(dynamic_cast<::sc_gem5::Process *>(obj))
86{
87 if (_gem5_process)
89}
90
96
97
98bool
100{
101 return _gem5_process != nullptr;
102}
103
104
107{
108 if (_gem5_process)
111 if (_gem5_process)
113 return *this;
114}
115
116bool
118{
119 return _gem5_process && handle._gem5_process &&
120 (_gem5_process == handle._gem5_process);
121}
122
123bool
125{
126 return !(handle == *this);
127}
128
129bool
131{
132 return _gem5_process < other._gem5_process;
133}
134
135void
142
143
144const char *
146{
147 return _gem5_process ? _gem5_process->name() : "";
148}
149
155
158{
159 static const std::vector<sc_object *> empty;
161}
162
165{
166 static const std::vector<sc_event *> empty;
167 return _gem5_process ? _gem5_process->get_child_events() : empty;
168}
169
170sc_object *
175
176sc_object *
181
182bool
184{
185 return _gem5_process ? _gem5_process->dynamic() : false;
186}
187
188bool
190{
191 return _gem5_process ? _gem5_process->terminated() : false;
192}
193
194const sc_event &
196{
197 if (!_gem5_process) {
198 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "terminated_event()");
199 static sc_gem5::InternalScEvent non_event;
200 return non_event;
201 }
203}
204
205
206void
208{
209 if (!_gem5_process) {
210 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "suspend()");
211 return;
212 }
213 _gem5_process->suspend(include_descendants == SC_INCLUDE_DESCENDANTS);
214}
215
216void
218{
219 if (!_gem5_process) {
220 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "resume()");
221 return;
222 }
223 _gem5_process->resume(include_descendants == SC_INCLUDE_DESCENDANTS);
224}
225
226void
228{
229 if (!_gem5_process) {
230 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "disable()");
231 return;
232 }
233 _gem5_process->disable(include_descendants == SC_INCLUDE_DESCENDANTS);
234}
235
236void
238{
239 if (!_gem5_process) {
240 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "enable()");
241 return;
242 }
243 _gem5_process->enable(include_descendants == SC_INCLUDE_DESCENDANTS);
244}
245
246void
248{
249 if (!_gem5_process) {
250 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "kill()");
251 return;
252 }
253 _gem5_process->kill(include_descendants == SC_INCLUDE_DESCENDANTS);
254}
255
256void
258{
259 if (!_gem5_process) {
260 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "reset()");
261 return;
262 }
263 _gem5_process->reset(include_descendants == SC_INCLUDE_DESCENDANTS);
264}
265
266bool
268{
269 if (!_gem5_process) {
270 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "is_unwinding()");
271 return false;
272 }
273 return _gem5_process->isUnwinding();
274}
275
276const sc_event &
278{
279 if (!_gem5_process) {
280 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "reset()");
281 static sc_gem5::InternalScEvent non_event;
282 return non_event;
283 }
284 return _gem5_process->resetEvent();
285}
286
287
288void
290 sc_descendent_inclusion_info include_descendants)
291{
292 if (!_gem5_process) {
293 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "sync_reset_on()");
294 return;
295 }
296 _gem5_process->syncResetOn(include_descendants == SC_INCLUDE_DESCENDANTS);
297}
298
299void
301 sc_descendent_inclusion_info include_descendants)
302{
303 if (!_gem5_process) {
304 SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "sync_reset_off()");
305 return;
306 }
307 _gem5_process->syncResetOff(include_descendants == SC_INCLUDE_DESCENDANTS);
308}
309
310
319
320bool
325
327
328} // namespace sc_core
sc_object * get_parent_object() const
Definition sc_object.cc:80
virtual const std::vector< sc_event * > & get_child_events() const
Definition sc_object.cc:74
const char * name() const
Definition sc_object.cc:44
virtual const std::vector< sc_object * > & get_child_objects() const
Definition sc_object.cc:68
bool operator<(const sc_process_handle &) const
sc_object * get_parent_object() const
void sync_reset_on(sc_descendent_inclusion_info include_descendants=SC_NO_DESCENDANTS)
const std::vector< sc_event * > & get_child_events() const
const sc_event & terminated_event() const
::sc_gem5::Process * _gem5_process
bool operator==(const sc_process_handle &) const
sc_process_handle & operator=(::sc_gem5::Process *p)
const sc_event & reset_event() const
void sync_reset_off(sc_descendent_inclusion_info include_descendants=SC_NO_DESCENDANTS)
void suspend(sc_descendent_inclusion_info include_descendants=SC_NO_DESCENDANTS)
void swap(sc_process_handle &)
bool operator!=(const sc_process_handle &) const
const std::vector< sc_object * > & get_child_objects() const
void reset(sc_descendent_inclusion_info include_descendants=SC_NO_DESCENDANTS)
void disable(sc_descendent_inclusion_info include_descendants=SC_NO_DESCENDANTS)
void resume(sc_descendent_inclusion_info include_descendants=SC_NO_DESCENDANTS)
void enable(sc_descendent_inclusion_info include_descendants=SC_NO_DESCENDANTS)
void kill(sc_descendent_inclusion_info include_descendants=SC_NO_DESCENDANTS)
sc_curr_proc_kind proc_kind() const
sc_object * get_process_object() const
virtual const char * what() const
virtual::sc_core::sc_curr_proc_kind procKind() const =0
void kill(bool inc_kids)
Definition process.cc:141
static Process * newest()
Definition process.hh:123
void suspend(bool inc_kids)
Definition process.cc:77
void resume(bool inc_kids)
Definition process.cc:98
void disable(bool inc_kids)
Definition process.cc:112
bool dynamic() const
Definition process.hh:68
void syncResetOn(bool inc_kids)
Definition process.cc:223
bool isUnwinding() const
Definition process.hh:69
::sc_core::sc_event & resetEvent()
Definition process.hh:101
bool terminated() const
Definition process.hh:71
::sc_core::sc_event & terminatedEvent()
Definition process.hh:102
void reset(bool inc_kids)
Definition process.cc:169
void syncResetOff(bool inc_kids)
Definition process.cc:232
void enable(bool inc_kids)
Definition process.cc:130
Process * current()
Definition scheduler.hh:185
STL vector class.
Definition stl.hh:37
sc_process_b * sc_get_curr_process_handle()
void sc_set_location(const char *file, int lineno)
sc_process_handle sc_get_current_process_handle()
bool sc_is_running()
Definition sc_main.cc:141
bool sc_is_unwinding()
bool sc_allow_process_control_corners
Scheduler scheduler
Definition scheduler.cc:494
#define SC_REPORT_WARNING(msg_type, msg)

Generated on Tue Jun 18 2024 16:24:06 for gem5 by doxygen 1.11.0