Deleted Added
sdiff udiff text old ( 13310:160fb526ab4d ) new ( 13317:36c574a4036e )
full compact
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

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

28 */
29
30#include "systemc/core/process.hh"
31
32#include "base/logging.hh"
33#include "systemc/core/event.hh"
34#include "systemc/core/port.hh"
35#include "systemc/core/scheduler.hh"
36#include "systemc/ext/core/sc_join.hh"
37#include "systemc/ext/core/sc_main.hh"
38#include "systemc/ext/core/sc_process_handle.hh"
39#include "systemc/ext/utils/sc_report_handler.hh"
40
41namespace sc_gem5
42{
43

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

115{
116 if (inc_kids)
117 forEachKid([](Process *p) { p->disable(true); });
118
119 if (!::sc_core::sc_allow_process_control_corners &&
120 timeoutEvent.scheduled()) {
121 std::string message("attempt to disable a thread with timeout wait: ");
122 message += name();
123 SC_REPORT_ERROR("Undefined process control interaction",
124 message.c_str());
125 }
126
127 _disabled = true;
128}
129
130void
131Process::enable(bool inc_kids)

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

136
137 _disabled = false;
138}
139
140void
141Process::kill(bool inc_kids)
142{
143 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
144 SC_REPORT_ERROR(
145 "(E572) a process may not be killed before it is initialized",
146 name());
147 }
148
149 // Propogate the kill to our children no matter what happens to us.
150 if (inc_kids)
151 forEachKid([](Process *p) { p->kill(true); });
152
153 // If we're in the middle of unwinding, ignore the kill request.

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

165 if (!_needsStart)
166 injectException(killException);
167}
168
169void
170Process::reset(bool inc_kids)
171{
172 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
173 SC_REPORT_ERROR(
174 "(E573) a process may not be asynchronously reset while"
175 "the simulation is not running", name());
176 }
177
178 // Propogate the reset to our children no matter what happens to us.
179 if (inc_kids)
180 forEachKid([](Process *p) { p->reset(true); });
181
182 // If we're in the middle of unwinding, ignore the reset request.
183 if (_isUnwinding)

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

194 _isUnwinding = true;
195 injectException(resetException);
196 }
197}
198
199void
200Process::throw_it(ExceptionWrapperBase &exc, bool inc_kids)
201{
202 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
203 SC_REPORT_ERROR(
204 "(E574) throw_it not allowed unless simulation is running ",
205 name());
206 }
207
208 if (inc_kids)
209 forEachKid([&exc](Process *p) { p->throw_it(exc, true); });
210
211 if (_needsStart || _terminated ||
212 procKind() == ::sc_core::SC_METHOD_PROC_) {
213 SC_REPORT_WARNING("(W556) throw_it on method/non-running process "
214 "is being ignored ", name());
215 return;
216 }
217
218 injectException(exc);
219}
220
221void
222Process::injectException(ExceptionWrapperBase &exc)

--- 222 unchanged lines hidden ---