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 9 * notice, this list of conditions and the following disclaimer in the 10 * documentation and/or other materials provided with the distribution; 11 * neither the name of the copyright holders nor the names of its 12 * contributors may be used to endorse or promote products derived from 13 * this software without specific prior written permission. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 * Authors: Gabe Black 28 */ 29 30#include <memory> 31#include <string> 32#include <vector> 33 34#include "base/logging.hh" 35#include "systemc/core/event.hh" 36#include "systemc/core/kernel.hh" 37#include "systemc/core/module.hh" 38#include "systemc/core/object.hh" 39#include "systemc/core/port.hh" 40#include "systemc/core/process_types.hh" 41#include "systemc/core/sensitivity.hh" 42#include "systemc/ext/channel/sc_in.hh" 43#include "systemc/ext/channel/sc_inout.hh" 44#include "systemc/ext/channel/sc_out.hh" 45#include "systemc/ext/channel/sc_signal_in_if.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 9 * notice, this list of conditions and the following disclaimer in the 10 * documentation and/or other materials provided with the distribution; 11 * neither the name of the copyright holders nor the names of its 12 * contributors may be used to endorse or promote products derived from 13 * this software without specific prior written permission. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 * Authors: Gabe Black 28 */ 29 30#include <memory> 31#include <string> 32#include <vector> 33 34#include "base/logging.hh" 35#include "systemc/core/event.hh" 36#include "systemc/core/kernel.hh" 37#include "systemc/core/module.hh" 38#include "systemc/core/object.hh" 39#include "systemc/core/port.hh" 40#include "systemc/core/process_types.hh" 41#include "systemc/core/sensitivity.hh" 42#include "systemc/ext/channel/sc_in.hh" 43#include "systemc/ext/channel/sc_inout.hh" 44#include "systemc/ext/channel/sc_out.hh" 45#include "systemc/ext/channel/sc_signal_in_if.hh"
|
| 46#include "systemc/ext/core/messages.hh"
|
46#include "systemc/ext/core/sc_module.hh" 47#include "systemc/ext/core/sc_module_name.hh" 48#include "systemc/ext/dt/bit/sc_logic.hh" 49#include "systemc/ext/utils/sc_report_handler.hh" 50 51namespace sc_gem5 52{ 53 54Process * 55newMethodProcess(const char *name, ProcessFuncWrapper *func) 56{ 57 Method *p = new Method(name, func); 58 if (::sc_core::sc_is_running()) { 59 std::string name = p->name(); 60 delete p;
| 47#include "systemc/ext/core/sc_module.hh" 48#include "systemc/ext/core/sc_module_name.hh" 49#include "systemc/ext/dt/bit/sc_logic.hh" 50#include "systemc/ext/utils/sc_report_handler.hh" 51 52namespace sc_gem5 53{ 54 55Process * 56newMethodProcess(const char *name, ProcessFuncWrapper *func) 57{ 58 Method *p = new Method(name, func); 59 if (::sc_core::sc_is_running()) { 60 std::string name = p->name(); 61 delete p;
|
61 SC_REPORT_ERROR("(E541) call to SC_METHOD in sc_module while " 62 "simulation running", name.c_str());
| 62 SC_REPORT_ERROR(sc_core::SC_ID_MODULE_METHOD_AFTER_START_, 63 name.c_str());
|
63 return nullptr; 64 } 65 scheduler.reg(p); 66 return p; 67} 68 69Process * 70newThreadProcess(const char *name, ProcessFuncWrapper *func) 71{ 72 Thread *p = new Thread(name, func); 73 if (::sc_core::sc_is_running()) { 74 std::string name = p->name(); 75 delete p;
| 64 return nullptr; 65 } 66 scheduler.reg(p); 67 return p; 68} 69 70Process * 71newThreadProcess(const char *name, ProcessFuncWrapper *func) 72{ 73 Thread *p = new Thread(name, func); 74 if (::sc_core::sc_is_running()) { 75 std::string name = p->name(); 76 delete p;
|
76 SC_REPORT_ERROR("(E542) call to SC_THREAD in sc_module while " 77 "simulation running", name.c_str());
| 77 SC_REPORT_ERROR(sc_core::SC_ID_MODULE_THREAD_AFTER_START_, 78 name.c_str());
|
78 return nullptr; 79 } 80 scheduler.reg(p); 81 return p; 82} 83 84Process * 85newCThreadProcess(const char *name, ProcessFuncWrapper *func) 86{ 87 CThread *p = new CThread(name, func); 88 if (::sc_core::sc_is_running()) { 89 std::string name = p->name(); 90 delete p;
| 79 return nullptr; 80 } 81 scheduler.reg(p); 82 return p; 83} 84 85Process * 86newCThreadProcess(const char *name, ProcessFuncWrapper *func) 87{ 88 CThread *p = new CThread(name, func); 89 if (::sc_core::sc_is_running()) { 90 std::string name = p->name(); 91 delete p;
|
91 SC_REPORT_ERROR("(E543) call to SC_CTHREAD in sc_module while " 92 "simulation running", name.c_str());
| 92 SC_REPORT_ERROR(sc_core::SC_ID_MODULE_CTHREAD_AFTER_START_, 93 name.c_str());
|
93 return nullptr; 94 } 95 scheduler.reg(p); 96 p->dontInitialize(true); 97 return p; 98} 99 100} // namespace sc_gem5 101 102namespace sc_core 103{ 104 105sc_bind_proxy::sc_bind_proxy(sc_interface &_interface) : 106 _interface(&_interface), _port(nullptr) 107{} 108 109sc_bind_proxy::sc_bind_proxy(sc_port_base &_port) : 110 _interface(nullptr), _port(&_port) 111{} 112 113const sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr); 114 115sc_module::~sc_module() { delete _gem5_module; } 116 117const sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr); 118 119void 120sc_module::operator () (const sc_bind_proxy &p001, 121 const sc_bind_proxy &p002, 122 const sc_bind_proxy &p003, 123 const sc_bind_proxy &p004, 124 const sc_bind_proxy &p005, 125 const sc_bind_proxy &p006, 126 const sc_bind_proxy &p007, 127 const sc_bind_proxy &p008, 128 const sc_bind_proxy &p009, 129 const sc_bind_proxy &p010, 130 const sc_bind_proxy &p011, 131 const sc_bind_proxy &p012, 132 const sc_bind_proxy &p013, 133 const sc_bind_proxy &p014, 134 const sc_bind_proxy &p015, 135 const sc_bind_proxy &p016, 136 const sc_bind_proxy &p017, 137 const sc_bind_proxy &p018, 138 const sc_bind_proxy &p019, 139 const sc_bind_proxy &p020, 140 const sc_bind_proxy &p021, 141 const sc_bind_proxy &p022, 142 const sc_bind_proxy &p023, 143 const sc_bind_proxy &p024, 144 const sc_bind_proxy &p025, 145 const sc_bind_proxy &p026, 146 const sc_bind_proxy &p027, 147 const sc_bind_proxy &p028, 148 const sc_bind_proxy &p029, 149 const sc_bind_proxy &p030, 150 const sc_bind_proxy &p031, 151 const sc_bind_proxy &p032, 152 const sc_bind_proxy &p033, 153 const sc_bind_proxy &p034, 154 const sc_bind_proxy &p035, 155 const sc_bind_proxy &p036, 156 const sc_bind_proxy &p037, 157 const sc_bind_proxy &p038, 158 const sc_bind_proxy &p039, 159 const sc_bind_proxy &p040, 160 const sc_bind_proxy &p041, 161 const sc_bind_proxy &p042, 162 const sc_bind_proxy &p043, 163 const sc_bind_proxy &p044, 164 const sc_bind_proxy &p045, 165 const sc_bind_proxy &p046, 166 const sc_bind_proxy &p047, 167 const sc_bind_proxy &p048, 168 const sc_bind_proxy &p049, 169 const sc_bind_proxy &p050, 170 const sc_bind_proxy &p051, 171 const sc_bind_proxy &p052, 172 const sc_bind_proxy &p053, 173 const sc_bind_proxy &p054, 174 const sc_bind_proxy &p055, 175 const sc_bind_proxy &p056, 176 const sc_bind_proxy &p057, 177 const sc_bind_proxy &p058, 178 const sc_bind_proxy &p059, 179 const sc_bind_proxy &p060, 180 const sc_bind_proxy &p061, 181 const sc_bind_proxy &p062, 182 const sc_bind_proxy &p063, 183 const sc_bind_proxy &p064) 184{ 185 std::vector<const ::sc_core::sc_bind_proxy *> proxies; 186 auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool { 187 if (!p.port() && !p.interface()) 188 return false; 189 proxies.push_back(&p); 190 return true; 191 }; 192 insert(p001) && insert(p002) && insert(p003) && insert(p004) && 193 insert(p005) && insert(p006) && insert(p007) && insert(p008) && 194 insert(p009) && insert(p010) && insert(p011) && insert(p012) && 195 insert(p013) && insert(p014) && insert(p015) && insert(p016) && 196 insert(p017) && insert(p018) && insert(p019) && insert(p020) && 197 insert(p021) && insert(p022) && insert(p023) && insert(p024) && 198 insert(p025) && insert(p026) && insert(p027) && insert(p028) && 199 insert(p029) && insert(p030) && insert(p031) && insert(p032) && 200 insert(p033) && insert(p034) && insert(p035) && insert(p036) && 201 insert(p037) && insert(p038) && insert(p039) && insert(p040) && 202 insert(p041) && insert(p042) && insert(p043) && insert(p044) && 203 insert(p045) && insert(p046) && insert(p047) && insert(p048) && 204 insert(p049) && insert(p050) && insert(p051) && insert(p052) && 205 insert(p053) && insert(p054) && insert(p055) && insert(p056) && 206 insert(p057) && insert(p058) && insert(p059) && insert(p060) && 207 insert(p061) && insert(p062) && insert(p063) && insert(p064); 208 _gem5_module->bindPorts(proxies); 209} 210 211sc_module & 212sc_module::operator << (sc_interface &iface) 213{ 214 (*this)(iface); 215 return *this; 216} 217 218sc_module & 219sc_module::operator << (sc_port_base &pb) 220{ 221 (*this)(pb); 222 return *this; 223} 224 225sc_module & 226sc_module::operator , (sc_interface &iface) 227{ 228 (*this)(iface); 229 return *this; 230} 231 232sc_module & 233sc_module::operator , (sc_port_base &pb) 234{ 235 (*this)(pb); 236 return *this; 237} 238 239const std::vector<sc_object *> & 240sc_module::get_child_objects() const 241{ 242 return _gem5_module->obj()->get_child_objects(); 243} 244 245const std::vector<sc_event *> & 246sc_module::get_child_events() const 247{ 248 return _gem5_module->obj()->get_child_events(); 249} 250 251sc_module::sc_module() : 252 sc_object(sc_gem5::newModuleChecked()->name()), 253 _gem5_module(sc_gem5::currentModule()) 254{
| 94 return nullptr; 95 } 96 scheduler.reg(p); 97 p->dontInitialize(true); 98 return p; 99} 100 101} // namespace sc_gem5 102 103namespace sc_core 104{ 105 106sc_bind_proxy::sc_bind_proxy(sc_interface &_interface) : 107 _interface(&_interface), _port(nullptr) 108{} 109 110sc_bind_proxy::sc_bind_proxy(sc_port_base &_port) : 111 _interface(nullptr), _port(&_port) 112{} 113 114const sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr); 115 116sc_module::~sc_module() { delete _gem5_module; } 117 118const sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr); 119 120void 121sc_module::operator () (const sc_bind_proxy &p001, 122 const sc_bind_proxy &p002, 123 const sc_bind_proxy &p003, 124 const sc_bind_proxy &p004, 125 const sc_bind_proxy &p005, 126 const sc_bind_proxy &p006, 127 const sc_bind_proxy &p007, 128 const sc_bind_proxy &p008, 129 const sc_bind_proxy &p009, 130 const sc_bind_proxy &p010, 131 const sc_bind_proxy &p011, 132 const sc_bind_proxy &p012, 133 const sc_bind_proxy &p013, 134 const sc_bind_proxy &p014, 135 const sc_bind_proxy &p015, 136 const sc_bind_proxy &p016, 137 const sc_bind_proxy &p017, 138 const sc_bind_proxy &p018, 139 const sc_bind_proxy &p019, 140 const sc_bind_proxy &p020, 141 const sc_bind_proxy &p021, 142 const sc_bind_proxy &p022, 143 const sc_bind_proxy &p023, 144 const sc_bind_proxy &p024, 145 const sc_bind_proxy &p025, 146 const sc_bind_proxy &p026, 147 const sc_bind_proxy &p027, 148 const sc_bind_proxy &p028, 149 const sc_bind_proxy &p029, 150 const sc_bind_proxy &p030, 151 const sc_bind_proxy &p031, 152 const sc_bind_proxy &p032, 153 const sc_bind_proxy &p033, 154 const sc_bind_proxy &p034, 155 const sc_bind_proxy &p035, 156 const sc_bind_proxy &p036, 157 const sc_bind_proxy &p037, 158 const sc_bind_proxy &p038, 159 const sc_bind_proxy &p039, 160 const sc_bind_proxy &p040, 161 const sc_bind_proxy &p041, 162 const sc_bind_proxy &p042, 163 const sc_bind_proxy &p043, 164 const sc_bind_proxy &p044, 165 const sc_bind_proxy &p045, 166 const sc_bind_proxy &p046, 167 const sc_bind_proxy &p047, 168 const sc_bind_proxy &p048, 169 const sc_bind_proxy &p049, 170 const sc_bind_proxy &p050, 171 const sc_bind_proxy &p051, 172 const sc_bind_proxy &p052, 173 const sc_bind_proxy &p053, 174 const sc_bind_proxy &p054, 175 const sc_bind_proxy &p055, 176 const sc_bind_proxy &p056, 177 const sc_bind_proxy &p057, 178 const sc_bind_proxy &p058, 179 const sc_bind_proxy &p059, 180 const sc_bind_proxy &p060, 181 const sc_bind_proxy &p061, 182 const sc_bind_proxy &p062, 183 const sc_bind_proxy &p063, 184 const sc_bind_proxy &p064) 185{ 186 std::vector<const ::sc_core::sc_bind_proxy *> proxies; 187 auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool { 188 if (!p.port() && !p.interface()) 189 return false; 190 proxies.push_back(&p); 191 return true; 192 }; 193 insert(p001) && insert(p002) && insert(p003) && insert(p004) && 194 insert(p005) && insert(p006) && insert(p007) && insert(p008) && 195 insert(p009) && insert(p010) && insert(p011) && insert(p012) && 196 insert(p013) && insert(p014) && insert(p015) && insert(p016) && 197 insert(p017) && insert(p018) && insert(p019) && insert(p020) && 198 insert(p021) && insert(p022) && insert(p023) && insert(p024) && 199 insert(p025) && insert(p026) && insert(p027) && insert(p028) && 200 insert(p029) && insert(p030) && insert(p031) && insert(p032) && 201 insert(p033) && insert(p034) && insert(p035) && insert(p036) && 202 insert(p037) && insert(p038) && insert(p039) && insert(p040) && 203 insert(p041) && insert(p042) && insert(p043) && insert(p044) && 204 insert(p045) && insert(p046) && insert(p047) && insert(p048) && 205 insert(p049) && insert(p050) && insert(p051) && insert(p052) && 206 insert(p053) && insert(p054) && insert(p055) && insert(p056) && 207 insert(p057) && insert(p058) && insert(p059) && insert(p060) && 208 insert(p061) && insert(p062) && insert(p063) && insert(p064); 209 _gem5_module->bindPorts(proxies); 210} 211 212sc_module & 213sc_module::operator << (sc_interface &iface) 214{ 215 (*this)(iface); 216 return *this; 217} 218 219sc_module & 220sc_module::operator << (sc_port_base &pb) 221{ 222 (*this)(pb); 223 return *this; 224} 225 226sc_module & 227sc_module::operator , (sc_interface &iface) 228{ 229 (*this)(iface); 230 return *this; 231} 232 233sc_module & 234sc_module::operator , (sc_port_base &pb) 235{ 236 (*this)(pb); 237 return *this; 238} 239 240const std::vector<sc_object *> & 241sc_module::get_child_objects() const 242{ 243 return _gem5_module->obj()->get_child_objects(); 244} 245 246const std::vector<sc_event *> & 247sc_module::get_child_events() const 248{ 249 return _gem5_module->obj()->get_child_events(); 250} 251 252sc_module::sc_module() : 253 sc_object(sc_gem5::newModuleChecked()->name()), 254 _gem5_module(sc_gem5::currentModule()) 255{
|
255 if (sc_is_running()) { 256 SC_REPORT_ERROR("(E529) insert module failed", "simulation running"); 257 std::cout << "Running!\n"; 258 } 259 if (::sc_gem5::scheduler.elaborationDone()) { 260 SC_REPORT_ERROR("(E529) insert module failed", "elaboration done"); 261 std::cout << "Elaboration done!\n"; 262 }
| 256 if (sc_is_running()) 257 SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "simulation running"); 258 if (::sc_gem5::scheduler.elaborationDone()) 259 SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "elaboration done");
|
263} 264 265sc_module::sc_module(const sc_module_name &) : sc_module() {} 266sc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) 267{ 268 _gem5_module->deprecatedConstructor();
| 260} 261 262sc_module::sc_module(const sc_module_name &) : sc_module() {} 263sc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) 264{ 265 _gem5_module->deprecatedConstructor();
|
269 SC_REPORT_WARNING("(W569) sc_module(const char*), " 270 "sc_module(const std::string&) have been deprecated, use " 271 "sc_module(const sc_module_name&)", _name);
| 266 SC_REPORT_WARNING(SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, _name);
|
272} 273sc_module::sc_module(const std::string &_name) : 274 sc_module(sc_module_name(_name.c_str())) 275{ 276 _gem5_module->deprecatedConstructor();
| 267} 268sc_module::sc_module(const std::string &_name) : 269 sc_module(sc_module_name(_name.c_str())) 270{ 271 _gem5_module->deprecatedConstructor();
|
277 SC_REPORT_WARNING("(W569) sc_module(const char*), " 278 "sc_module(const std::string&) have been deprecated, use " 279 "sc_module(const sc_module_name&)", _name.c_str());
| 272 SC_REPORT_WARNING(SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, _name.c_str());
|
280} 281 282void 283sc_module::end_module() 284{ 285 _gem5_module->endModule(); 286} 287 288void 289sc_module::reset_signal_is(const sc_in<bool> &port, bool val) 290{ 291 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 292} 293 294void 295sc_module::reset_signal_is(const sc_inout<bool> &port, bool val) 296{ 297 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 298} 299 300void 301sc_module::reset_signal_is(const sc_out<bool> &port, bool val) 302{ 303 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 304} 305 306void 307sc_module::reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 308{ 309 ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), true, val); 310} 311 312 313void 314sc_module::async_reset_signal_is(const sc_in<bool> &port, bool val) 315{ 316 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 317} 318 319void 320sc_module::async_reset_signal_is(const sc_inout<bool> &port, bool val) 321{ 322 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 323} 324 325void 326sc_module::async_reset_signal_is(const sc_out<bool> &port, bool val) 327{ 328 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 329} 330 331void 332sc_module::async_reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 333{ 334 ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), false, val); 335} 336 337 338void 339sc_module::dont_initialize() 340{ 341 ::sc_gem5::Process *p = ::sc_gem5::Process::newest();
| 273} 274 275void 276sc_module::end_module() 277{ 278 _gem5_module->endModule(); 279} 280 281void 282sc_module::reset_signal_is(const sc_in<bool> &port, bool val) 283{ 284 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 285} 286 287void 288sc_module::reset_signal_is(const sc_inout<bool> &port, bool val) 289{ 290 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 291} 292 293void 294sc_module::reset_signal_is(const sc_out<bool> &port, bool val) 295{ 296 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), true, val); 297} 298 299void 300sc_module::reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 301{ 302 ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), true, val); 303} 304 305 306void 307sc_module::async_reset_signal_is(const sc_in<bool> &port, bool val) 308{ 309 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 310} 311 312void 313sc_module::async_reset_signal_is(const sc_inout<bool> &port, bool val) 314{ 315 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 316} 317 318void 319sc_module::async_reset_signal_is(const sc_out<bool> &port, bool val) 320{ 321 ::sc_gem5::newReset(&port, ::sc_gem5::Process::newest(), false, val); 322} 323 324void 325sc_module::async_reset_signal_is(const sc_signal_in_if<bool> &signal, bool val) 326{ 327 ::sc_gem5::newReset(&signal, ::sc_gem5::Process::newest(), false, val); 328} 329 330 331void 332sc_module::dont_initialize() 333{ 334 ::sc_gem5::Process *p = ::sc_gem5::Process::newest();
|
342 if (p->procKind() == SC_CTHREAD_PROC_) { 343 SC_REPORT_WARNING("(W524) dont_initialize() has no effect for " 344 "SC_CTHREADs", ""); 345 }
| 335 if (p->procKind() == SC_CTHREAD_PROC_) 336 SC_REPORT_WARNING(SC_ID_DONT_INITIALIZE_, "");
|
346 p->dontInitialize(true); 347} 348 349void 350sc_module::set_stack_size(size_t size) 351{ 352 ::sc_gem5::Process::newest()->setStackSize(size); 353} 354 355 356void sc_module::next_trigger() { ::sc_core::next_trigger(); } 357 358void 359sc_module::next_trigger(const sc_event &e) 360{ 361 ::sc_core::next_trigger(e); 362} 363 364void 365sc_module::next_trigger(const sc_event_or_list &eol) 366{ 367 ::sc_core::next_trigger(eol); 368} 369 370void 371sc_module::next_trigger(const sc_event_and_list &eal) 372{ 373 ::sc_core::next_trigger(eal); 374} 375 376void 377sc_module::next_trigger(const sc_time &t) 378{ 379 ::sc_core::next_trigger(t); 380} 381 382void 383sc_module::next_trigger(double d, sc_time_unit u) 384{ 385 ::sc_core::next_trigger(d, u); 386} 387 388void 389sc_module::next_trigger(const sc_time &t, const sc_event &e) 390{ 391 ::sc_core::next_trigger(t, e); 392} 393 394void 395sc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 396{ 397 ::sc_core::next_trigger(d, u, e); 398} 399 400void 401sc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 402{ 403 ::sc_core::next_trigger(t, eol); 404} 405 406void 407sc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 408{ 409 ::sc_core::next_trigger(d, u, eol); 410} 411 412void 413sc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 414{ 415 ::sc_core::next_trigger(t, eal); 416} 417 418void 419sc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 420{ 421 ::sc_core::next_trigger(d, u, eal); 422} 423 424 425bool 426sc_module::timed_out() 427{ 428 return ::sc_core::timed_out(); 429} 430 431 432void 433sc_module::wait() 434{ 435 ::sc_core::wait(); 436} 437 438void 439sc_module::wait(int i) 440{ 441 ::sc_core::wait(i); 442} 443 444void 445sc_module::wait(const sc_event &e) 446{ 447 ::sc_core::wait(e); 448} 449 450void 451sc_module::wait(const sc_event_or_list &eol) 452{ 453 ::sc_core::wait(eol); 454} 455 456void 457sc_module::wait(const sc_event_and_list &eal) 458{ 459 ::sc_core::wait(eal); 460} 461 462void 463sc_module::wait(const sc_time &t) 464{ 465 ::sc_core::wait(t); 466} 467 468void 469sc_module::wait(double d, sc_time_unit u) 470{ 471 ::sc_core::wait(d, u); 472} 473 474void 475sc_module::wait(const sc_time &t, const sc_event &e) 476{ 477 ::sc_core::wait(t, e); 478} 479 480void 481sc_module::wait(double d, sc_time_unit u, const sc_event &e) 482{ 483 ::sc_core::wait(d, u, e); 484} 485 486void 487sc_module::wait(const sc_time &t, const sc_event_or_list &eol) 488{ 489 ::sc_core::wait(t, eol); 490} 491 492void 493sc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 494{ 495 ::sc_core::wait(d, u, eol); 496} 497 498void 499sc_module::wait(const sc_time &t, const sc_event_and_list &eal) 500{ 501 ::sc_core::wait(t, eal); 502} 503 504void 505sc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 506{ 507 ::sc_core::wait(d, u, eal); 508} 509 510 511void 512sc_module::halt() 513{ 514 ::sc_core::halt(); 515} 516 517void 518sc_module::at_posedge(const sc_signal_in_if<bool> &s) 519{ 520 ::sc_core::at_posedge(s); 521} 522 523void 524sc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 525{ 526 ::sc_core::at_posedge(s); 527} 528 529void 530sc_module::at_negedge(const sc_signal_in_if<bool> &s) 531{ 532 ::sc_core::at_negedge(s); 533} 534 535void 536sc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 537{ 538 ::sc_core::at_negedge(s); 539} 540 541 542void 543next_trigger() 544{ 545 sc_gem5::Process *p = sc_gem5::scheduler.current(); 546 p->cancelTimeout(); 547 p->clearDynamic(); 548} 549 550void 551next_trigger(const sc_event &e) 552{ 553 sc_gem5::Process *p = sc_gem5::scheduler.current(); 554 p->cancelTimeout(); 555 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 556} 557 558void 559next_trigger(const sc_event_or_list &eol) 560{ 561 sc_gem5::Process *p = sc_gem5::scheduler.current(); 562 p->cancelTimeout(); 563 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 564} 565 566void 567next_trigger(const sc_event_and_list &eal) 568{ 569 sc_gem5::Process *p = sc_gem5::scheduler.current(); 570 p->cancelTimeout(); 571 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 572} 573 574void 575next_trigger(const sc_time &t) 576{ 577 sc_gem5::Process *p = sc_gem5::scheduler.current(); 578 p->setTimeout(t); 579 p->clearDynamic(); 580} 581 582void 583next_trigger(double d, sc_time_unit u) 584{ 585 next_trigger(sc_time(d, u)); 586} 587 588void 589next_trigger(const sc_time &t, const sc_event &e) 590{ 591 sc_gem5::Process *p = sc_gem5::scheduler.current(); 592 p->setTimeout(t); 593 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 594} 595 596void 597next_trigger(double d, sc_time_unit u, const sc_event &e) 598{ 599 next_trigger(sc_time(d, u), e); 600} 601 602void 603next_trigger(const sc_time &t, const sc_event_or_list &eol) 604{ 605 sc_gem5::Process *p = sc_gem5::scheduler.current(); 606 p->setTimeout(t); 607 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 608} 609 610void 611next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 612{ 613 next_trigger(sc_time(d, u), eol); 614} 615 616void 617next_trigger(const sc_time &t, const sc_event_and_list &eal) 618{ 619 sc_gem5::Process *p = sc_gem5::scheduler.current(); 620 p->setTimeout(t); 621 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 622} 623 624void 625next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 626{ 627 next_trigger(sc_time(d, u), eal); 628} 629 630bool 631timed_out() 632{ 633 ::sc_gem5::Process *p = sc_gem5::scheduler.current(); 634 if (!p) 635 return false; 636 else 637 return p->timedOut(); 638} 639 640 641namespace 642{ 643 644bool 645waitErrorCheck(sc_gem5::Process *p) 646{ 647 if (p->procKind() == SC_METHOD_PROC_) {
| 337 p->dontInitialize(true); 338} 339 340void 341sc_module::set_stack_size(size_t size) 342{ 343 ::sc_gem5::Process::newest()->setStackSize(size); 344} 345 346 347void sc_module::next_trigger() { ::sc_core::next_trigger(); } 348 349void 350sc_module::next_trigger(const sc_event &e) 351{ 352 ::sc_core::next_trigger(e); 353} 354 355void 356sc_module::next_trigger(const sc_event_or_list &eol) 357{ 358 ::sc_core::next_trigger(eol); 359} 360 361void 362sc_module::next_trigger(const sc_event_and_list &eal) 363{ 364 ::sc_core::next_trigger(eal); 365} 366 367void 368sc_module::next_trigger(const sc_time &t) 369{ 370 ::sc_core::next_trigger(t); 371} 372 373void 374sc_module::next_trigger(double d, sc_time_unit u) 375{ 376 ::sc_core::next_trigger(d, u); 377} 378 379void 380sc_module::next_trigger(const sc_time &t, const sc_event &e) 381{ 382 ::sc_core::next_trigger(t, e); 383} 384 385void 386sc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 387{ 388 ::sc_core::next_trigger(d, u, e); 389} 390 391void 392sc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 393{ 394 ::sc_core::next_trigger(t, eol); 395} 396 397void 398sc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 399{ 400 ::sc_core::next_trigger(d, u, eol); 401} 402 403void 404sc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 405{ 406 ::sc_core::next_trigger(t, eal); 407} 408 409void 410sc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 411{ 412 ::sc_core::next_trigger(d, u, eal); 413} 414 415 416bool 417sc_module::timed_out() 418{ 419 return ::sc_core::timed_out(); 420} 421 422 423void 424sc_module::wait() 425{ 426 ::sc_core::wait(); 427} 428 429void 430sc_module::wait(int i) 431{ 432 ::sc_core::wait(i); 433} 434 435void 436sc_module::wait(const sc_event &e) 437{ 438 ::sc_core::wait(e); 439} 440 441void 442sc_module::wait(const sc_event_or_list &eol) 443{ 444 ::sc_core::wait(eol); 445} 446 447void 448sc_module::wait(const sc_event_and_list &eal) 449{ 450 ::sc_core::wait(eal); 451} 452 453void 454sc_module::wait(const sc_time &t) 455{ 456 ::sc_core::wait(t); 457} 458 459void 460sc_module::wait(double d, sc_time_unit u) 461{ 462 ::sc_core::wait(d, u); 463} 464 465void 466sc_module::wait(const sc_time &t, const sc_event &e) 467{ 468 ::sc_core::wait(t, e); 469} 470 471void 472sc_module::wait(double d, sc_time_unit u, const sc_event &e) 473{ 474 ::sc_core::wait(d, u, e); 475} 476 477void 478sc_module::wait(const sc_time &t, const sc_event_or_list &eol) 479{ 480 ::sc_core::wait(t, eol); 481} 482 483void 484sc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 485{ 486 ::sc_core::wait(d, u, eol); 487} 488 489void 490sc_module::wait(const sc_time &t, const sc_event_and_list &eal) 491{ 492 ::sc_core::wait(t, eal); 493} 494 495void 496sc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 497{ 498 ::sc_core::wait(d, u, eal); 499} 500 501 502void 503sc_module::halt() 504{ 505 ::sc_core::halt(); 506} 507 508void 509sc_module::at_posedge(const sc_signal_in_if<bool> &s) 510{ 511 ::sc_core::at_posedge(s); 512} 513 514void 515sc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 516{ 517 ::sc_core::at_posedge(s); 518} 519 520void 521sc_module::at_negedge(const sc_signal_in_if<bool> &s) 522{ 523 ::sc_core::at_negedge(s); 524} 525 526void 527sc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 528{ 529 ::sc_core::at_negedge(s); 530} 531 532 533void 534next_trigger() 535{ 536 sc_gem5::Process *p = sc_gem5::scheduler.current(); 537 p->cancelTimeout(); 538 p->clearDynamic(); 539} 540 541void 542next_trigger(const sc_event &e) 543{ 544 sc_gem5::Process *p = sc_gem5::scheduler.current(); 545 p->cancelTimeout(); 546 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 547} 548 549void 550next_trigger(const sc_event_or_list &eol) 551{ 552 sc_gem5::Process *p = sc_gem5::scheduler.current(); 553 p->cancelTimeout(); 554 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 555} 556 557void 558next_trigger(const sc_event_and_list &eal) 559{ 560 sc_gem5::Process *p = sc_gem5::scheduler.current(); 561 p->cancelTimeout(); 562 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 563} 564 565void 566next_trigger(const sc_time &t) 567{ 568 sc_gem5::Process *p = sc_gem5::scheduler.current(); 569 p->setTimeout(t); 570 p->clearDynamic(); 571} 572 573void 574next_trigger(double d, sc_time_unit u) 575{ 576 next_trigger(sc_time(d, u)); 577} 578 579void 580next_trigger(const sc_time &t, const sc_event &e) 581{ 582 sc_gem5::Process *p = sc_gem5::scheduler.current(); 583 p->setTimeout(t); 584 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 585} 586 587void 588next_trigger(double d, sc_time_unit u, const sc_event &e) 589{ 590 next_trigger(sc_time(d, u), e); 591} 592 593void 594next_trigger(const sc_time &t, const sc_event_or_list &eol) 595{ 596 sc_gem5::Process *p = sc_gem5::scheduler.current(); 597 p->setTimeout(t); 598 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 599} 600 601void 602next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 603{ 604 next_trigger(sc_time(d, u), eol); 605} 606 607void 608next_trigger(const sc_time &t, const sc_event_and_list &eal) 609{ 610 sc_gem5::Process *p = sc_gem5::scheduler.current(); 611 p->setTimeout(t); 612 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 613} 614 615void 616next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 617{ 618 next_trigger(sc_time(d, u), eal); 619} 620 621bool 622timed_out() 623{ 624 ::sc_gem5::Process *p = sc_gem5::scheduler.current(); 625 if (!p) 626 return false; 627 else 628 return p->timedOut(); 629} 630 631 632namespace 633{ 634 635bool 636waitErrorCheck(sc_gem5::Process *p) 637{ 638 if (p->procKind() == SC_METHOD_PROC_) {
|
648 SC_REPORT_ERROR( 649 "(E519) wait() is only allowed in SC_THREADs and SC_CTHREADs",
| 639 SC_REPORT_ERROR(SC_ID_WAIT_NOT_ALLOWED_,
|
650 "\n in SC_METHODs use next_trigger() instead"); 651 return true; 652 } 653 return false; 654} 655 656} // anonymous namespace 657 658void 659wait() 660{ 661 sc_gem5::Process *p = sc_gem5::scheduler.current(); 662 if (waitErrorCheck(p)) 663 return; 664 p->cancelTimeout(); 665 p->clearDynamic(); 666 sc_gem5::scheduler.yield(); 667} 668 669void 670wait(int n) 671{ 672 if (n <= 0) { 673 std::string msg = csprintf("n = %d", n);
| 640 "\n in SC_METHODs use next_trigger() instead"); 641 return true; 642 } 643 return false; 644} 645 646} // anonymous namespace 647 648void 649wait() 650{ 651 sc_gem5::Process *p = sc_gem5::scheduler.current(); 652 if (waitErrorCheck(p)) 653 return; 654 p->cancelTimeout(); 655 p->clearDynamic(); 656 sc_gem5::scheduler.yield(); 657} 658 659void 660wait(int n) 661{ 662 if (n <= 0) { 663 std::string msg = csprintf("n = %d", n);
|
674 SC_REPORT_ERROR("(E525) wait(n) is only valid for n > 0", msg.c_str());
| 664 SC_REPORT_ERROR(SC_ID_WAIT_N_INVALID_, msg.c_str());
|
675 } 676 sc_gem5::Process *p = sc_gem5::scheduler.current(); 677 p->waitCount(n - 1); 678 wait(); 679} 680 681void 682wait(const sc_event &e) 683{ 684 sc_gem5::Process *p = sc_gem5::scheduler.current(); 685 if (waitErrorCheck(p)) 686 return; 687 p->cancelTimeout(); 688 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 689 sc_gem5::scheduler.yield(); 690} 691 692void 693wait(const sc_event_or_list &eol) 694{ 695 sc_gem5::Process *p = sc_gem5::scheduler.current(); 696 if (waitErrorCheck(p)) 697 return; 698 p->cancelTimeout(); 699 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 700 sc_gem5::scheduler.yield(); 701} 702 703void 704wait(const sc_event_and_list &eal) 705{ 706 sc_gem5::Process *p = sc_gem5::scheduler.current(); 707 if (waitErrorCheck(p)) 708 return; 709 p->cancelTimeout(); 710 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 711 sc_gem5::scheduler.yield(); 712} 713 714void 715wait(const sc_time &t) 716{ 717 sc_gem5::Process *p = sc_gem5::scheduler.current(); 718 if (waitErrorCheck(p)) 719 return; 720 p->setTimeout(t); 721 p->clearDynamic(); 722 sc_gem5::scheduler.yield(); 723} 724 725void 726wait(double d, sc_time_unit u) 727{ 728 wait(sc_time(d, u)); 729} 730 731void 732wait(const sc_time &t, const sc_event &e) 733{ 734 sc_gem5::Process *p = sc_gem5::scheduler.current(); 735 if (waitErrorCheck(p)) 736 return; 737 p->setTimeout(t); 738 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 739 sc_gem5::scheduler.yield(); 740} 741 742void 743wait(double d, sc_time_unit u, const sc_event &e) 744{ 745 wait(sc_time(d, u), e); 746} 747 748void 749wait(const sc_time &t, const sc_event_or_list &eol) 750{ 751 sc_gem5::Process *p = sc_gem5::scheduler.current(); 752 if (waitErrorCheck(p)) 753 return; 754 p->setTimeout(t); 755 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 756 sc_gem5::scheduler.yield(); 757} 758 759void 760wait(double d, sc_time_unit u, const sc_event_or_list &eol) 761{ 762 wait(sc_time(d, u), eol); 763} 764 765void 766wait(const sc_time &t, const sc_event_and_list &eal) 767{ 768 sc_gem5::Process *p = sc_gem5::scheduler.current(); 769 if (waitErrorCheck(p)) 770 return; 771 p->setTimeout(t); 772 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 773 sc_gem5::scheduler.yield(); 774} 775 776void 777wait(double d, sc_time_unit u, const sc_event_and_list &eal) 778{ 779 wait(sc_time(d, u), eal); 780} 781 782void 783halt() 784{ 785 ::sc_core::wait(); 786 throw ::sc_gem5::ScHalt(); 787} 788 789void 790at_posedge(const sc_signal_in_if<bool> &s) 791{ 792 while (s.read()) 793 wait(); 794 while (!s.read()) 795 wait(); 796} 797 798void 799at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 800{ 801 while (s.read() == sc_dt::Log_1) 802 wait(); 803 while (s.read() == sc_dt::Log_0) 804 wait(); 805} 806 807void 808at_negedge(const sc_signal_in_if<bool> &s) 809{ 810 while (!s.read()) 811 wait(); 812 while (s.read()) 813 wait(); 814} 815 816void 817at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 818{ 819 while (s.read() == sc_dt::Log_0) 820 wait(); 821 while (s.read() == sc_dt::Log_1) 822 wait(); 823} 824 825const char * 826sc_gen_unique_name(const char *seed) 827{ 828 if (!seed || seed[0] == '\0') {
| 665 } 666 sc_gem5::Process *p = sc_gem5::scheduler.current(); 667 p->waitCount(n - 1); 668 wait(); 669} 670 671void 672wait(const sc_event &e) 673{ 674 sc_gem5::Process *p = sc_gem5::scheduler.current(); 675 if (waitErrorCheck(p)) 676 return; 677 p->cancelTimeout(); 678 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 679 sc_gem5::scheduler.yield(); 680} 681 682void 683wait(const sc_event_or_list &eol) 684{ 685 sc_gem5::Process *p = sc_gem5::scheduler.current(); 686 if (waitErrorCheck(p)) 687 return; 688 p->cancelTimeout(); 689 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 690 sc_gem5::scheduler.yield(); 691} 692 693void 694wait(const sc_event_and_list &eal) 695{ 696 sc_gem5::Process *p = sc_gem5::scheduler.current(); 697 if (waitErrorCheck(p)) 698 return; 699 p->cancelTimeout(); 700 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 701 sc_gem5::scheduler.yield(); 702} 703 704void 705wait(const sc_time &t) 706{ 707 sc_gem5::Process *p = sc_gem5::scheduler.current(); 708 if (waitErrorCheck(p)) 709 return; 710 p->setTimeout(t); 711 p->clearDynamic(); 712 sc_gem5::scheduler.yield(); 713} 714 715void 716wait(double d, sc_time_unit u) 717{ 718 wait(sc_time(d, u)); 719} 720 721void 722wait(const sc_time &t, const sc_event &e) 723{ 724 sc_gem5::Process *p = sc_gem5::scheduler.current(); 725 if (waitErrorCheck(p)) 726 return; 727 p->setTimeout(t); 728 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 729 sc_gem5::scheduler.yield(); 730} 731 732void 733wait(double d, sc_time_unit u, const sc_event &e) 734{ 735 wait(sc_time(d, u), e); 736} 737 738void 739wait(const sc_time &t, const sc_event_or_list &eol) 740{ 741 sc_gem5::Process *p = sc_gem5::scheduler.current(); 742 if (waitErrorCheck(p)) 743 return; 744 p->setTimeout(t); 745 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 746 sc_gem5::scheduler.yield(); 747} 748 749void 750wait(double d, sc_time_unit u, const sc_event_or_list &eol) 751{ 752 wait(sc_time(d, u), eol); 753} 754 755void 756wait(const sc_time &t, const sc_event_and_list &eal) 757{ 758 sc_gem5::Process *p = sc_gem5::scheduler.current(); 759 if (waitErrorCheck(p)) 760 return; 761 p->setTimeout(t); 762 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 763 sc_gem5::scheduler.yield(); 764} 765 766void 767wait(double d, sc_time_unit u, const sc_event_and_list &eal) 768{ 769 wait(sc_time(d, u), eal); 770} 771 772void 773halt() 774{ 775 ::sc_core::wait(); 776 throw ::sc_gem5::ScHalt(); 777} 778 779void 780at_posedge(const sc_signal_in_if<bool> &s) 781{ 782 while (s.read()) 783 wait(); 784 while (!s.read()) 785 wait(); 786} 787 788void 789at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 790{ 791 while (s.read() == sc_dt::Log_1) 792 wait(); 793 while (s.read() == sc_dt::Log_0) 794 wait(); 795} 796 797void 798at_negedge(const sc_signal_in_if<bool> &s) 799{ 800 while (!s.read()) 801 wait(); 802 while (s.read()) 803 wait(); 804} 805 806void 807at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 808{ 809 while (s.read() == sc_dt::Log_0) 810 wait(); 811 while (s.read() == sc_dt::Log_1) 812 wait(); 813} 814 815const char * 816sc_gen_unique_name(const char *seed) 817{ 818 if (!seed || seed[0] == '\0') {
|
829 SC_REPORT_ERROR( 830 "(E532) cannot generate unique name from null string", "");
| 819 SC_REPORT_ERROR(SC_ID_GEN_UNIQUE_NAME_, "");
|
831 seed = "unnamed"; 832 } 833 834 auto mod = sc_gem5::pickParentModule(); 835 if (mod) 836 return mod->uniqueName(seed); 837 838 sc_gem5::Process *p = sc_gem5::scheduler.current(); 839 if (p) 840 return p->uniqueName(seed); 841 842 return ::sc_gem5::globalNameGen.gen(seed); 843} 844 845bool 846sc_hierarchical_name_exists(const char *name) 847{ 848 return sc_gem5::findEvent(name) != sc_gem5::allEvents.end() || 849 ::sc_gem5::findObject(name, sc_gem5::allObjects); 850} 851 852bool 853sc_start_of_simulation_invoked() 854{ 855 return ::sc_gem5::kernel->startOfSimulationComplete(); 856} 857 858bool 859sc_end_of_simulation_invoked() 860{ 861 return ::sc_gem5::kernel->endOfSimulationComplete(); 862} 863 864sc_module * 865sc_module_sc_new(sc_module *mod) 866{ 867 static std::vector<std::unique_ptr<sc_module> > modules; 868 modules.emplace_back(mod); 869 return mod; 870} 871 872} // namespace sc_core
| 820 seed = "unnamed"; 821 } 822 823 auto mod = sc_gem5::pickParentModule(); 824 if (mod) 825 return mod->uniqueName(seed); 826 827 sc_gem5::Process *p = sc_gem5::scheduler.current(); 828 if (p) 829 return p->uniqueName(seed); 830 831 return ::sc_gem5::globalNameGen.gen(seed); 832} 833 834bool 835sc_hierarchical_name_exists(const char *name) 836{ 837 return sc_gem5::findEvent(name) != sc_gem5::allEvents.end() || 838 ::sc_gem5::findObject(name, sc_gem5::allObjects); 839} 840 841bool 842sc_start_of_simulation_invoked() 843{ 844 return ::sc_gem5::kernel->startOfSimulationComplete(); 845} 846 847bool 848sc_end_of_simulation_invoked() 849{ 850 return ::sc_gem5::kernel->endOfSimulationComplete(); 851} 852 853sc_module * 854sc_module_sc_new(sc_module *mod) 855{ 856 static std::vector<std::unique_ptr<sc_module> > modules; 857 modules.emplace_back(mod); 858 return mod; 859} 860 861} // namespace sc_core
|