112952Sgabeblack@google.com/* 212952Sgabeblack@google.com * Copyright 2018 Google, Inc. 312952Sgabeblack@google.com * 412952Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 512952Sgabeblack@google.com * modification, are permitted provided that the following conditions are 612952Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 712952Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 812952Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 912952Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1012952Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1112952Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1212952Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1312952Sgabeblack@google.com * this software without specific prior written permission. 1412952Sgabeblack@google.com * 1512952Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1612952Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1712952Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1812952Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1912952Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2012952Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2112952Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2212952Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2312952Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2412952Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2512952Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2612952Sgabeblack@google.com * 2712952Sgabeblack@google.com * Authors: Gabe Black 2812952Sgabeblack@google.com */ 2912952Sgabeblack@google.com 3012952Sgabeblack@google.com#include "systemc/core/process.hh" 3112957Sgabeblack@google.com 3212957Sgabeblack@google.com#include "systemc/core/event.hh" 3313288Sgabeblack@google.com#include "systemc/core/port.hh" 3412953Sgabeblack@google.com#include "systemc/core/scheduler.hh" 3513317Sgabeblack@google.com#include "systemc/ext/core/messages.hh" 3613196Sgabeblack@google.com#include "systemc/ext/core/sc_join.hh" 3713102Sgabeblack@google.com#include "systemc/ext/core/sc_main.hh" 3812998Sgabeblack@google.com#include "systemc/ext/core/sc_process_handle.hh" 3912998Sgabeblack@google.com#include "systemc/ext/utils/sc_report_handler.hh" 4012952Sgabeblack@google.com 4112952Sgabeblack@google.comnamespace sc_gem5 4212952Sgabeblack@google.com{ 4312952Sgabeblack@google.com 4412952Sgabeblack@google.comclass UnwindExceptionReset : public ::sc_core::sc_unwind_exception 4512952Sgabeblack@google.com{ 4612952Sgabeblack@google.com public: 4712995Sgabeblack@google.com UnwindExceptionReset() { _isReset = true; } 4812952Sgabeblack@google.com}; 4912952Sgabeblack@google.com 5012952Sgabeblack@google.comclass UnwindExceptionKill : public ::sc_core::sc_unwind_exception 5112952Sgabeblack@google.com{ 5212952Sgabeblack@google.com public: 5312995Sgabeblack@google.com UnwindExceptionKill() {} 5412952Sgabeblack@google.com}; 5512952Sgabeblack@google.com 5612952Sgabeblack@google.comtemplate <typename T> 5712952Sgabeblack@google.comstruct BuiltinExceptionWrapper : public ExceptionWrapperBase 5812952Sgabeblack@google.com{ 5912952Sgabeblack@google.com public: 6012952Sgabeblack@google.com T t; 6112952Sgabeblack@google.com void throw_it() override { throw t; } 6212952Sgabeblack@google.com}; 6312952Sgabeblack@google.com 6412952Sgabeblack@google.comBuiltinExceptionWrapper<UnwindExceptionReset> resetException; 6512952Sgabeblack@google.comBuiltinExceptionWrapper<UnwindExceptionKill> killException; 6612952Sgabeblack@google.com 6712952Sgabeblack@google.com 6812952Sgabeblack@google.comvoid 6912952Sgabeblack@google.comProcess::forEachKid(const std::function<void(Process *)> &work) 7012952Sgabeblack@google.com{ 7112952Sgabeblack@google.com for (auto &kid: get_child_objects()) { 7212952Sgabeblack@google.com Process *p_kid = dynamic_cast<Process *>(kid); 7312952Sgabeblack@google.com if (p_kid) 7412952Sgabeblack@google.com work(p_kid); 7512952Sgabeblack@google.com } 7612952Sgabeblack@google.com} 7712952Sgabeblack@google.com 7812952Sgabeblack@google.comvoid 7912952Sgabeblack@google.comProcess::suspend(bool inc_kids) 8012952Sgabeblack@google.com{ 8112952Sgabeblack@google.com if (inc_kids) 8212952Sgabeblack@google.com forEachKid([](Process *p) { p->suspend(true); }); 8312952Sgabeblack@google.com 8413489Sgabeblack@google.com if (!_suspended && !_terminated) { 8512952Sgabeblack@google.com _suspended = true; 8613133Sgabeblack@google.com _suspendedReady = scheduler.suspend(this); 8712952Sgabeblack@google.com 8813133Sgabeblack@google.com if (procKind() != ::sc_core::SC_METHOD_PROC_ && 8913133Sgabeblack@google.com scheduler.current() == this) { 9013133Sgabeblack@google.com // This isn't in the spec, but Accellera says that a thread that 9113133Sgabeblack@google.com // self suspends should be marked ready immediately when it's 9213133Sgabeblack@google.com // resumed. 9313133Sgabeblack@google.com _suspendedReady = true; 9413133Sgabeblack@google.com scheduler.yield(); 9513133Sgabeblack@google.com } 9612952Sgabeblack@google.com } 9712952Sgabeblack@google.com} 9812952Sgabeblack@google.com 9912952Sgabeblack@google.comvoid 10012952Sgabeblack@google.comProcess::resume(bool inc_kids) 10112952Sgabeblack@google.com{ 10212952Sgabeblack@google.com if (inc_kids) 10312952Sgabeblack@google.com forEachKid([](Process *p) { p->resume(true); }); 10412952Sgabeblack@google.com 10513489Sgabeblack@google.com if (_suspended && !_terminated) { 10612952Sgabeblack@google.com _suspended = false; 10712959Sgabeblack@google.com if (_suspendedReady) 10813133Sgabeblack@google.com scheduler.resume(this); 10912959Sgabeblack@google.com _suspendedReady = false; 11012952Sgabeblack@google.com } 11112952Sgabeblack@google.com} 11212952Sgabeblack@google.com 11312952Sgabeblack@google.comvoid 11412952Sgabeblack@google.comProcess::disable(bool inc_kids) 11512952Sgabeblack@google.com{ 11612952Sgabeblack@google.com if (inc_kids) 11712952Sgabeblack@google.com forEachKid([](Process *p) { p->disable(true); }); 11812952Sgabeblack@google.com 11912999Sgabeblack@google.com if (!::sc_core::sc_allow_process_control_corners && 12013206Sgabeblack@google.com timeoutEvent.scheduled()) { 12112999Sgabeblack@google.com std::string message("attempt to disable a thread with timeout wait: "); 12212999Sgabeblack@google.com message += name(); 12313317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_PROCESS_CONTROL_CORNER_CASE_, 12412999Sgabeblack@google.com message.c_str()); 12512999Sgabeblack@google.com } 12612999Sgabeblack@google.com 12713489Sgabeblack@google.com if (!_terminated) 12813489Sgabeblack@google.com _disabled = true; 12912952Sgabeblack@google.com} 13012952Sgabeblack@google.com 13112952Sgabeblack@google.comvoid 13212952Sgabeblack@google.comProcess::enable(bool inc_kids) 13312952Sgabeblack@google.com{ 13412952Sgabeblack@google.com 13512952Sgabeblack@google.com if (inc_kids) 13612952Sgabeblack@google.com forEachKid([](Process *p) { p->enable(true); }); 13712952Sgabeblack@google.com 13813489Sgabeblack@google.com if (!_terminated) 13913489Sgabeblack@google.com _disabled = false; 14012952Sgabeblack@google.com} 14112952Sgabeblack@google.com 14212952Sgabeblack@google.comvoid 14312952Sgabeblack@google.comProcess::kill(bool inc_kids) 14412952Sgabeblack@google.com{ 14513102Sgabeblack@google.com if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) { 14613317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_KILL_PROCESS_WHILE_UNITIALIZED_, 14713102Sgabeblack@google.com name()); 14813102Sgabeblack@google.com } 14913102Sgabeblack@google.com 15012952Sgabeblack@google.com // Propogate the kill to our children no matter what happens to us. 15112952Sgabeblack@google.com if (inc_kids) 15212952Sgabeblack@google.com forEachKid([](Process *p) { p->kill(true); }); 15312952Sgabeblack@google.com 15413489Sgabeblack@google.com // If we're unwinding or terminated, ignore the kill request. 15513489Sgabeblack@google.com if (_isUnwinding || _terminated) 15612952Sgabeblack@google.com return; 15712952Sgabeblack@google.com 15812995Sgabeblack@google.com // Update our state. 15912998Sgabeblack@google.com terminate(); 16012995Sgabeblack@google.com _isUnwinding = true; 16112995Sgabeblack@google.com 16212998Sgabeblack@google.com // Make sure this process isn't marked ready 16312998Sgabeblack@google.com popListNode(); 16412998Sgabeblack@google.com 16512998Sgabeblack@google.com // Inject the kill exception into this process if it's started. 16612998Sgabeblack@google.com if (!_needsStart) 16712998Sgabeblack@google.com injectException(killException); 16812952Sgabeblack@google.com} 16912952Sgabeblack@google.com 17012952Sgabeblack@google.comvoid 17112952Sgabeblack@google.comProcess::reset(bool inc_kids) 17212952Sgabeblack@google.com{ 17313102Sgabeblack@google.com if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) { 17413317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_RESET_PROCESS_WHILE_NOT_RUNNING_, 17513317Sgabeblack@google.com name()); 17613102Sgabeblack@google.com } 17713102Sgabeblack@google.com 17812952Sgabeblack@google.com // Propogate the reset to our children no matter what happens to us. 17912952Sgabeblack@google.com if (inc_kids) 18012952Sgabeblack@google.com forEachKid([](Process *p) { p->reset(true); }); 18112952Sgabeblack@google.com 18213489Sgabeblack@google.com // If we're already unwinding or terminated, ignore the reset request. 18313489Sgabeblack@google.com if (_isUnwinding || _terminated) 18412952Sgabeblack@google.com return; 18512952Sgabeblack@google.com 18613310Sgabeblack@google.com // Clear suspended ready since we're about to run regardless. 18713310Sgabeblack@google.com _suspendedReady = false; 18812995Sgabeblack@google.com 18913261Sgabeblack@google.com _resetEvent.notify(); 19013261Sgabeblack@google.com 19112998Sgabeblack@google.com if (_needsStart) { 19212998Sgabeblack@google.com scheduler.runNow(this); 19312998Sgabeblack@google.com } else { 19412998Sgabeblack@google.com _isUnwinding = true; 19512998Sgabeblack@google.com injectException(resetException); 19612998Sgabeblack@google.com } 19712952Sgabeblack@google.com} 19812952Sgabeblack@google.com 19912952Sgabeblack@google.comvoid 20012952Sgabeblack@google.comProcess::throw_it(ExceptionWrapperBase &exc, bool inc_kids) 20112952Sgabeblack@google.com{ 20213317Sgabeblack@google.com if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) 20313317Sgabeblack@google.com SC_REPORT_ERROR(sc_core::SC_ID_THROW_IT_WHILE_NOT_RUNNING_, name()); 20413102Sgabeblack@google.com 20512952Sgabeblack@google.com if (inc_kids) 20612952Sgabeblack@google.com forEachKid([&exc](Process *p) { p->throw_it(exc, true); }); 20712998Sgabeblack@google.com 20813307Sgabeblack@google.com if (_needsStart || _terminated || 20913307Sgabeblack@google.com procKind() == ::sc_core::SC_METHOD_PROC_) { 21013317Sgabeblack@google.com SC_REPORT_WARNING(sc_core::SC_ID_THROW_IT_IGNORED_, name()); 21113306Sgabeblack@google.com return; 21213307Sgabeblack@google.com } 21313306Sgabeblack@google.com 21413306Sgabeblack@google.com injectException(exc); 21512952Sgabeblack@google.com} 21612952Sgabeblack@google.com 21712952Sgabeblack@google.comvoid 21812952Sgabeblack@google.comProcess::injectException(ExceptionWrapperBase &exc) 21912952Sgabeblack@google.com{ 22012952Sgabeblack@google.com excWrapper = &exc; 22112995Sgabeblack@google.com scheduler.runNow(this); 22212952Sgabeblack@google.com}; 22312952Sgabeblack@google.com 22412952Sgabeblack@google.comvoid 22512952Sgabeblack@google.comProcess::syncResetOn(bool inc_kids) 22612952Sgabeblack@google.com{ 22712952Sgabeblack@google.com if (inc_kids) 22812952Sgabeblack@google.com forEachKid([](Process *p) { p->syncResetOn(true); }); 22912952Sgabeblack@google.com 23012952Sgabeblack@google.com _syncReset = true; 23112952Sgabeblack@google.com} 23212952Sgabeblack@google.com 23312952Sgabeblack@google.comvoid 23412952Sgabeblack@google.comProcess::syncResetOff(bool inc_kids) 23512952Sgabeblack@google.com{ 23612952Sgabeblack@google.com if (inc_kids) 23712952Sgabeblack@google.com forEachKid([](Process *p) { p->syncResetOff(true); }); 23812952Sgabeblack@google.com 23912952Sgabeblack@google.com _syncReset = false; 24012952Sgabeblack@google.com} 24112952Sgabeblack@google.com 24212952Sgabeblack@google.comvoid 24313260Sgabeblack@google.comProcess::signalReset(bool set, bool sync) 24413260Sgabeblack@google.com{ 24513260Sgabeblack@google.com if (set) { 24613260Sgabeblack@google.com waitCount(0); 24713260Sgabeblack@google.com if (sync) { 24813260Sgabeblack@google.com syncResetCount++; 24913260Sgabeblack@google.com } else { 25013260Sgabeblack@google.com asyncResetCount++; 25113260Sgabeblack@google.com cancelTimeout(); 25213260Sgabeblack@google.com clearDynamic(); 25313260Sgabeblack@google.com scheduler.runNext(this); 25413260Sgabeblack@google.com } 25513260Sgabeblack@google.com } else { 25613260Sgabeblack@google.com if (sync) 25713260Sgabeblack@google.com syncResetCount--; 25813260Sgabeblack@google.com else 25913260Sgabeblack@google.com asyncResetCount--; 26013260Sgabeblack@google.com } 26113260Sgabeblack@google.com} 26213260Sgabeblack@google.com 26313260Sgabeblack@google.comvoid 26412953Sgabeblack@google.comProcess::run() 26512952Sgabeblack@google.com{ 26612953Sgabeblack@google.com bool reset; 26712953Sgabeblack@google.com do { 26812953Sgabeblack@google.com reset = false; 26912953Sgabeblack@google.com try { 27012953Sgabeblack@google.com func->call(); 27113175Sgabeblack@google.com } catch(ScHalt) { 27213175Sgabeblack@google.com std::cout << "Terminating process " << name() << std::endl; 27312995Sgabeblack@google.com } catch(const ::sc_core::sc_unwind_exception &exc) { 27412953Sgabeblack@google.com reset = exc.is_reset(); 27512995Sgabeblack@google.com _isUnwinding = false; 27613182Sgabeblack@google.com } catch (...) { 27713182Sgabeblack@google.com throw; 27812953Sgabeblack@google.com } 27912953Sgabeblack@google.com } while (reset); 28013093Sgabeblack@google.com needsStart(true); 28112953Sgabeblack@google.com} 28212952Sgabeblack@google.com 28312957Sgabeblack@google.comvoid 28413206Sgabeblack@google.comProcess::addStatic(StaticSensitivity *s) 28512957Sgabeblack@google.com{ 28613206Sgabeblack@google.com staticSensitivities.push_back(s); 28712957Sgabeblack@google.com} 28812957Sgabeblack@google.com 28912957Sgabeblack@google.comvoid 29013206Sgabeblack@google.comProcess::setDynamic(DynamicSensitivity *s) 29112957Sgabeblack@google.com{ 29213206Sgabeblack@google.com if (dynamicSensitivity) { 29313206Sgabeblack@google.com dynamicSensitivity->clear(); 29413206Sgabeblack@google.com delete dynamicSensitivity; 29513206Sgabeblack@google.com } 29612957Sgabeblack@google.com dynamicSensitivity = s; 29713206Sgabeblack@google.com} 29813206Sgabeblack@google.com 29913206Sgabeblack@google.comvoid 30013288Sgabeblack@google.comProcess::addReset(Reset *reset) 30113260Sgabeblack@google.com{ 30213288Sgabeblack@google.com resets.push_back(reset); 30313260Sgabeblack@google.com} 30413260Sgabeblack@google.com 30513260Sgabeblack@google.comvoid 30613206Sgabeblack@google.comProcess::cancelTimeout() 30713206Sgabeblack@google.com{ 30813206Sgabeblack@google.com if (timeoutEvent.scheduled()) 30913206Sgabeblack@google.com scheduler.deschedule(&timeoutEvent); 31013206Sgabeblack@google.com} 31113206Sgabeblack@google.com 31213206Sgabeblack@google.comvoid 31313206Sgabeblack@google.comProcess::setTimeout(::sc_core::sc_time t) 31413206Sgabeblack@google.com{ 31513206Sgabeblack@google.com cancelTimeout(); 31613206Sgabeblack@google.com scheduler.schedule(&timeoutEvent, t); 31713206Sgabeblack@google.com} 31813206Sgabeblack@google.com 31913206Sgabeblack@google.comvoid 32013206Sgabeblack@google.comProcess::timeout() 32113206Sgabeblack@google.com{ 32213206Sgabeblack@google.com // A process is considered timed_out only if it was also waiting for an 32313206Sgabeblack@google.com // event but got a timeout instead. 32413206Sgabeblack@google.com _timedOut = (dynamicSensitivity != nullptr); 32513206Sgabeblack@google.com 32613206Sgabeblack@google.com setDynamic(nullptr); 32713206Sgabeblack@google.com if (disabled()) 32813206Sgabeblack@google.com return; 32913206Sgabeblack@google.com 33013206Sgabeblack@google.com ready(); 33112957Sgabeblack@google.com} 33212957Sgabeblack@google.com 33312959Sgabeblack@google.comvoid 33412959Sgabeblack@google.comProcess::satisfySensitivity(Sensitivity *s) 33512959Sgabeblack@google.com{ 33613260Sgabeblack@google.com if (_waitCount) { 33713260Sgabeblack@google.com _waitCount--; 33813260Sgabeblack@google.com return; 33913260Sgabeblack@google.com } 34013260Sgabeblack@google.com 34112959Sgabeblack@google.com // If there's a dynamic sensitivity and this wasn't it, ignore. 34213206Sgabeblack@google.com if ((dynamicSensitivity || timeoutEvent.scheduled()) && 34313206Sgabeblack@google.com dynamicSensitivity != s) { 34412959Sgabeblack@google.com return; 34513206Sgabeblack@google.com } 34612959Sgabeblack@google.com 34713206Sgabeblack@google.com _timedOut = false; 34813206Sgabeblack@google.com // This sensitivity should already be cleared by this point, or the event 34913206Sgabeblack@google.com // which triggered it will take care of it. 35013206Sgabeblack@google.com delete dynamicSensitivity; 35113206Sgabeblack@google.com dynamicSensitivity = nullptr; 35213206Sgabeblack@google.com cancelTimeout(); 35312959Sgabeblack@google.com ready(); 35412959Sgabeblack@google.com} 35512959Sgabeblack@google.com 35612959Sgabeblack@google.comvoid 35712959Sgabeblack@google.comProcess::ready() 35812959Sgabeblack@google.com{ 35912996Sgabeblack@google.com if (disabled()) 36012996Sgabeblack@google.com return; 36112959Sgabeblack@google.com if (suspended()) 36212959Sgabeblack@google.com _suspendedReady = true; 36313328Sgabeblack@google.com else if (!scheduled()) 36412959Sgabeblack@google.com scheduler.ready(this); 36512959Sgabeblack@google.com} 36612959Sgabeblack@google.com 36712997Sgabeblack@google.comvoid 36812997Sgabeblack@google.comProcess::lastReport(::sc_core::sc_report *report) 36912997Sgabeblack@google.com{ 37012997Sgabeblack@google.com if (report) { 37112997Sgabeblack@google.com _lastReport = std::unique_ptr<::sc_core::sc_report>( 37212997Sgabeblack@google.com new ::sc_core::sc_report(*report)); 37312997Sgabeblack@google.com } else { 37412997Sgabeblack@google.com _lastReport = nullptr; 37512997Sgabeblack@google.com } 37612997Sgabeblack@google.com} 37712997Sgabeblack@google.com 37812997Sgabeblack@google.com::sc_core::sc_report *Process::lastReport() const { return _lastReport.get(); } 37912997Sgabeblack@google.com 38013180Sgabeblack@google.comProcess::Process(const char *name, ProcessFuncWrapper *func, bool internal) : 38113206Sgabeblack@google.com ::sc_core::sc_process_b(name), excWrapper(nullptr), 38213206Sgabeblack@google.com timeoutEvent([this]() { this->timeout(); }), 38313206Sgabeblack@google.com func(func), _internal(internal), _timedOut(false), _dontInitialize(false), 38413194Sgabeblack@google.com _needsStart(true), _isUnwinding(false), _terminated(false), 38513328Sgabeblack@google.com _scheduled(false), _suspended(false), _disabled(false), 38613328Sgabeblack@google.com _syncReset(false), syncResetCount(0), asyncResetCount(0), _waitCount(0), 38713328Sgabeblack@google.com refCount(0), stackSize(::Fiber::DefaultStackSize), 38813328Sgabeblack@google.com dynamicSensitivity(nullptr) 38912953Sgabeblack@google.com{ 39013131Sgabeblack@google.com _dynamic = 39113131Sgabeblack@google.com (::sc_core::sc_get_status() > 39213131Sgabeblack@google.com ::sc_core::SC_BEFORE_END_OF_ELABORATION); 39312953Sgabeblack@google.com _newest = this; 39412953Sgabeblack@google.com} 39512952Sgabeblack@google.com 39612998Sgabeblack@google.comvoid 39712998Sgabeblack@google.comProcess::terminate() 39812998Sgabeblack@google.com{ 39912998Sgabeblack@google.com _terminated = true; 40012998Sgabeblack@google.com _suspendedReady = false; 40112998Sgabeblack@google.com _suspended = false; 40212998Sgabeblack@google.com _syncReset = false; 40313206Sgabeblack@google.com clearDynamic(); 40413206Sgabeblack@google.com cancelTimeout(); 40513206Sgabeblack@google.com for (auto s: staticSensitivities) { 40613206Sgabeblack@google.com s->clear(); 40712998Sgabeblack@google.com delete s; 40813206Sgabeblack@google.com } 40912998Sgabeblack@google.com staticSensitivities.clear(); 41013006Sgabeblack@google.com 41113006Sgabeblack@google.com _terminatedEvent.notify(); 41213196Sgabeblack@google.com 41313196Sgabeblack@google.com for (auto jw: joinWaiters) 41413196Sgabeblack@google.com jw->signal(); 41513196Sgabeblack@google.com joinWaiters.clear(); 41612998Sgabeblack@google.com} 41712998Sgabeblack@google.com 41812953Sgabeblack@google.comProcess *Process::_newest; 41912952Sgabeblack@google.com 42012952Sgabeblack@google.comvoid 42112952Sgabeblack@google.comthrow_it_wrapper(Process *p, ExceptionWrapperBase &exc, bool inc_kids) 42212952Sgabeblack@google.com{ 42312952Sgabeblack@google.com p->throw_it(exc, inc_kids); 42412952Sgabeblack@google.com} 42512952Sgabeblack@google.com 42613288Sgabeblack@google.comvoid 42713288Sgabeblack@google.comnewReset(const sc_core::sc_port_base *pb, Process *p, bool s, bool v) 42813288Sgabeblack@google.com{ 42913288Sgabeblack@google.com Port *port = Port::fromPort(pb); 43013288Sgabeblack@google.com port->addReset(new Reset(p, s, v)); 43113288Sgabeblack@google.com} 43213288Sgabeblack@google.com 43313288Sgabeblack@google.comvoid 43413288Sgabeblack@google.comnewReset(const sc_core::sc_signal_in_if<bool> *sig, Process *p, bool s, bool v) 43513288Sgabeblack@google.com{ 43613288Sgabeblack@google.com Reset *reset = new Reset(p, s, v); 43713288Sgabeblack@google.com if (!reset->install(sig)) 43813288Sgabeblack@google.com delete reset; 43913288Sgabeblack@google.com} 44013288Sgabeblack@google.com 44112952Sgabeblack@google.com} // namespace sc_gem5 442