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 --- 18 unchanged lines hidden (view full) --- 27 * Authors: Gabe Black 28 */ 29 30#include "systemc/core/process.hh" 31 32#include "base/logging.hh" 33#include "systemc/core/event.hh" 34#include "systemc/core/scheduler.hh" |
35#include "systemc/ext/core/sc_main.hh" |
36#include "systemc/ext/core/sc_process_handle.hh" 37#include "systemc/ext/utils/sc_report_handler.hh" 38 39namespace sc_gem5 40{ 41 42SensitivityTimeout::SensitivityTimeout(Process *p, ::sc_core::sc_time t) : 43 Sensitivity(p), timeoutEvent([this]() { this->timeout(); }) --- 164 unchanged lines hidden (view full) --- 208 forEachKid([](Process *p) { p->enable(true); }); 209 210 _disabled = false; 211} 212 213void 214Process::kill(bool inc_kids) 215{ |
216 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) { 217 SC_REPORT_ERROR( 218 "(E572) a process may not be killed before it is initialized", 219 name()); 220 } 221 |
222 // Propogate the kill to our children no matter what happens to us. 223 if (inc_kids) 224 forEachKid([](Process *p) { p->kill(true); }); 225 226 // If we're in the middle of unwinding, ignore the kill request. 227 if (_isUnwinding) 228 return; 229 --- 7 unchanged lines hidden (view full) --- 237 // Inject the kill exception into this process if it's started. 238 if (!_needsStart) 239 injectException(killException); 240} 241 242void 243Process::reset(bool inc_kids) 244{ |
245 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) { 246 SC_REPORT_ERROR( 247 "(E573) a process may not be asynchronously reset while" 248 "the simulation is not running", name()); 249 } 250 |
251 // Propogate the reset to our children no matter what happens to us. 252 if (inc_kids) 253 forEachKid([](Process *p) { p->reset(true); }); 254 255 // If we're in the middle of unwinding, ignore the reset request. 256 if (_isUnwinding) 257 return; 258 --- 6 unchanged lines hidden (view full) --- 265 } 266 267 _resetEvent.notify(); 268} 269 270void 271Process::throw_it(ExceptionWrapperBase &exc, bool inc_kids) 272{ |
273 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) { 274 SC_REPORT_ERROR( 275 "(E574) throw_it not allowed unless simulation is running ", 276 name()); 277 } 278 |
279 if (inc_kids) 280 forEachKid([&exc](Process *p) { p->throw_it(exc, true); }); 281 282 // Only inject an exception into threads that have started. 283 if (!_needsStart) 284 injectException(exc); 285} 286 --- 141 unchanged lines hidden --- |