process.cc (13310:160fb526ab4d) | process.cc (13317:36c574a4036e) |
---|---|
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" | 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" |
|
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(); | 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(); |
123 SC_REPORT_ERROR("Undefined process control interaction", | 124 SC_REPORT_ERROR(sc_core::SC_ID_PROCESS_CONTROL_CORNER_CASE_, |
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) { | 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) { |
144 SC_REPORT_ERROR( 145 "(E572) a process may not be killed before it is initialized", | 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) { | 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()); | 173 SC_REPORT_ERROR(sc_core::SC_ID_RESET_PROCESS_WHILE_NOT_RUNNING_, 174 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{ | 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{ |
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 } | 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()); |
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_) { | 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_) { |
213 SC_REPORT_WARNING("(W556) throw_it on method/non-running process " 214 "is being ignored ", name()); | 209 SC_REPORT_WARNING(sc_core::SC_ID_THROW_IT_IGNORED_, name()); |
215 return; 216 } 217 218 injectException(exc); 219} 220 221void 222Process::injectException(ExceptionWrapperBase &exc) --- 222 unchanged lines hidden --- | 210 return; 211 } 212 213 injectException(exc); 214} 215 216void 217Process::injectException(ExceptionWrapperBase &exc) --- 222 unchanged lines hidden --- |