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/messages.hh" |
37#include "systemc/ext/core/sc_join.hh" 38#include "systemc/ext/core/sc_main.hh" 39#include "systemc/ext/core/sc_process_handle.hh" 40#include "systemc/ext/utils/sc_report_handler.hh" 41 42namespace sc_gem5 43{ 44 --- 71 unchanged lines hidden (view full) --- 116{ 117 if (inc_kids) 118 forEachKid([](Process *p) { p->disable(true); }); 119 120 if (!::sc_core::sc_allow_process_control_corners && 121 timeoutEvent.scheduled()) { 122 std::string message("attempt to disable a thread with timeout wait: "); 123 message += name(); |
124 SC_REPORT_ERROR(sc_core::SC_ID_PROCESS_CONTROL_CORNER_CASE_, |
125 message.c_str()); 126 } 127 128 _disabled = true; 129} 130 131void 132Process::enable(bool inc_kids) --- 4 unchanged lines hidden (view full) --- 137 138 _disabled = false; 139} 140 141void 142Process::kill(bool inc_kids) 143{ 144 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) { |
145 SC_REPORT_ERROR(sc_core::SC_ID_KILL_PROCESS_WHILE_UNITIALIZED_, |
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(sc_core::SC_ID_RESET_PROCESS_WHILE_NOT_RUNNING_, 174 name()); |
175 } 176 177 // Propogate the reset to our children no matter what happens to us. 178 if (inc_kids) 179 forEachKid([](Process *p) { p->reset(true); }); 180 181 // If we're in the middle of unwinding, ignore the reset request. 182 if (_isUnwinding) --- 10 unchanged lines hidden (view full) --- 193 _isUnwinding = true; 194 injectException(resetException); 195 } 196} 197 198void 199Process::throw_it(ExceptionWrapperBase &exc, bool inc_kids) 200{ |
201 if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) 202 SC_REPORT_ERROR(sc_core::SC_ID_THROW_IT_WHILE_NOT_RUNNING_, name()); |
203 204 if (inc_kids) 205 forEachKid([&exc](Process *p) { p->throw_it(exc, true); }); 206 207 if (_needsStart || _terminated || 208 procKind() == ::sc_core::SC_METHOD_PROC_) { |
209 SC_REPORT_WARNING(sc_core::SC_ID_THROW_IT_IGNORED_, name()); |
210 return; 211 } 212 213 injectException(exc); 214} 215 216void 217Process::injectException(ExceptionWrapperBase &exc) --- 222 unchanged lines hidden --- |