sc_module.cc revision 13146:3539fe351218
12036SN/A/* 22036SN/A * Copyright 2018 Google, Inc. 32036SN/A * 42036SN/A * Redistribution and use in source and binary forms, with or without 52036SN/A * modification, are permitted provided that the following conditions are 62036SN/A * met: redistributions of source code must retain the above copyright 72036SN/A * notice, this list of conditions and the following disclaimer; 82036SN/A * redistributions in binary form must reproduce the above copyright 92036SN/A * notice, this list of conditions and the following disclaimer in the 102036SN/A * documentation and/or other materials provided with the distribution; 112036SN/A * neither the name of the copyright holders nor the names of its 122036SN/A * contributors may be used to endorse or promote products derived from 132036SN/A * this software without specific prior written permission. 142036SN/A * 152036SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 162036SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 172036SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 182036SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 192036SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 202036SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 212036SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 222036SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 232036SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 242036SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 252036SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262036SN/A * 272665Ssaidi@eecs.umich.edu * Authors: Gabe Black 282956Sgblack@eecs.umich.edu */ 292956Sgblack@eecs.umich.edu 302772Ssaidi@eecs.umich.edu#include <memory> 312036SN/A#include <string> 322036SN/A#include <vector> 332036SN/A 342036SN/A#include "base/logging.hh" 352036SN/A#include "systemc/core/kernel.hh" 362036SN/A#include "systemc/core/module.hh" 372036SN/A#include "systemc/core/process_types.hh" 382036SN/A#include "systemc/ext/core/sc_module.hh" 392036SN/A#include "systemc/ext/core/sc_module_name.hh" 402779Sbinkertn@umich.edu#include "systemc/ext/utils/sc_report_handler.hh" 412036SN/A 422036SN/Anamespace sc_gem5 432036SN/A{ 442036SN/A 452036SN/AProcess * 462565SN/AnewMethodProcess(const char *name, ProcessFuncWrapper *func) 472565SN/A{ 482565SN/A Method *p = new Method(name, func); 492565SN/A if (::sc_core::sc_is_running()) { 502036SN/A std::string name = p->name(); 512036SN/A delete p; 522036SN/A SC_REPORT_ERROR("(E541) call to SC_METHOD in sc_module while " 532036SN/A "simulation running", name.c_str()); 542778Ssaidi@eecs.umich.edu return nullptr; 552778Ssaidi@eecs.umich.edu } 562778Ssaidi@eecs.umich.edu scheduler.reg(p); 572778Ssaidi@eecs.umich.edu return p; 582036SN/A} 592036SN/A 602036SN/AProcess * 612036SN/AnewThreadProcess(const char *name, ProcessFuncWrapper *func) 622036SN/A{ 632565SN/A Thread *p = new Thread(name, func); 642565SN/A if (::sc_core::sc_is_running()) { 652778Ssaidi@eecs.umich.edu std::string name = p->name(); 662778Ssaidi@eecs.umich.edu delete p; 672565SN/A SC_REPORT_ERROR("(E542) call to SC_THREAD in sc_module while " 682036SN/A "simulation running", name.c_str()); 692036SN/A return nullptr; 702036SN/A } 712036SN/A scheduler.reg(p); 722036SN/A return p; 732036SN/A} 742036SN/A 752036SN/AProcess * 762565SN/AnewCThreadProcess(const char *name, ProcessFuncWrapper *func) 772036SN/A{ 782036SN/A CThread *p = new CThread(name, func); 792036SN/A if (::sc_core::sc_is_running()) { 802036SN/A std::string name = p->name(); 812036SN/A delete p; 822565SN/A SC_REPORT_ERROR("(E543) call to SC_CTHREAD in sc_module while " 832565SN/A "simulation running", name.c_str()); 842778Ssaidi@eecs.umich.edu return nullptr; 852778Ssaidi@eecs.umich.edu } 862565SN/A scheduler.reg(p); 872036SN/A p->dontInitialize(); 882036SN/A return p; 892036SN/A} 902565SN/A 912036SN/AUniqueNameGen nameGen; 922036SN/A 932036SN/A} // namespace sc_gem5 942036SN/A 952036SN/Anamespace sc_core 962565SN/A{ 972565SN/A 982778Ssaidi@eecs.umich.edusc_bind_proxy::sc_bind_proxy(sc_interface &_interface) : 992778Ssaidi@eecs.umich.edu _interface(&_interface), _port(nullptr) 1002565SN/A{} 1012036SN/A 1022036SN/Asc_bind_proxy::sc_bind_proxy(sc_port_base &_port) : 1032565SN/A _interface(nullptr), _port(&_port) 1042036SN/A{} 1052036SN/A 1062764Sstever@eecs.umich.educonst sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr); 1072764Sstever@eecs.umich.edu 1082764Sstever@eecs.umich.edusc_module::~sc_module() { delete _gem5_module; } 1092764Sstever@eecs.umich.edu 1102764Sstever@eecs.umich.educonst sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr); 1112764Sstever@eecs.umich.edu 1122764Sstever@eecs.umich.eduvoid 1132764Sstever@eecs.umich.edusc_module::operator () (const sc_bind_proxy &p001, 1142764Sstever@eecs.umich.edu const sc_bind_proxy &p002, 1152764Sstever@eecs.umich.edu const sc_bind_proxy &p003, 1162764Sstever@eecs.umich.edu const sc_bind_proxy &p004, 1172764Sstever@eecs.umich.edu const sc_bind_proxy &p005, 1182764Sstever@eecs.umich.edu const sc_bind_proxy &p006, 1192764Sstever@eecs.umich.edu const sc_bind_proxy &p007, 1202764Sstever@eecs.umich.edu const sc_bind_proxy &p008, 1212764Sstever@eecs.umich.edu const sc_bind_proxy &p009, 1222764Sstever@eecs.umich.edu const sc_bind_proxy &p010, 1232036SN/A const sc_bind_proxy &p011, 1242036SN/A const sc_bind_proxy &p012, 1252036SN/A const sc_bind_proxy &p013, 1262036SN/A const sc_bind_proxy &p014, 1272036SN/A const sc_bind_proxy &p015, 1282036SN/A const sc_bind_proxy &p016, 1292036SN/A const sc_bind_proxy &p017, 1302036SN/A const sc_bind_proxy &p018, 1312036SN/A const sc_bind_proxy &p019, 1322036SN/A const sc_bind_proxy &p020, 1332036SN/A const sc_bind_proxy &p021, 1342036SN/A const sc_bind_proxy &p022, 1352036SN/A const sc_bind_proxy &p023, 1362036SN/A const sc_bind_proxy &p024, 1372036SN/A const sc_bind_proxy &p025, 1382036SN/A const sc_bind_proxy &p026, 1392036SN/A const sc_bind_proxy &p027, 1402036SN/A const sc_bind_proxy &p028, 1412036SN/A const sc_bind_proxy &p029, 1422036SN/A const sc_bind_proxy &p030, 1432036SN/A const sc_bind_proxy &p031, 1442036SN/A const sc_bind_proxy &p032, 1452036SN/A const sc_bind_proxy &p033, 1462036SN/A const sc_bind_proxy &p034, 1472036SN/A const sc_bind_proxy &p035, 1482036SN/A const sc_bind_proxy &p036, 1492036SN/A const sc_bind_proxy &p037, 1502036SN/A const sc_bind_proxy &p038, 1512036SN/A const sc_bind_proxy &p039, 1522036SN/A const sc_bind_proxy &p040, 1532036SN/A const sc_bind_proxy &p041, 1542036SN/A const sc_bind_proxy &p042, 1552036SN/A const sc_bind_proxy &p043, 1562036SN/A const sc_bind_proxy &p044, 1572036SN/A const sc_bind_proxy &p045, 1582036SN/A const sc_bind_proxy &p046, 1592036SN/A const sc_bind_proxy &p047, 1602036SN/A const sc_bind_proxy &p048, 1612036SN/A const sc_bind_proxy &p049, 1622036SN/A const sc_bind_proxy &p050, 1632036SN/A const sc_bind_proxy &p051, 1642036SN/A const sc_bind_proxy &p052, 1652036SN/A const sc_bind_proxy &p053, 1662036SN/A const sc_bind_proxy &p054, 1672036SN/A const sc_bind_proxy &p055, 1682036SN/A const sc_bind_proxy &p056, 1692036SN/A const sc_bind_proxy &p057, 1702036SN/A const sc_bind_proxy &p058, 1712036SN/A const sc_bind_proxy &p059, 1722036SN/A const sc_bind_proxy &p060, 1732036SN/A const sc_bind_proxy &p061, 1742036SN/A const sc_bind_proxy &p062, 1752036SN/A const sc_bind_proxy &p063, 1762036SN/A const sc_bind_proxy &p064) 177{ 178 std::vector<const ::sc_core::sc_bind_proxy *> proxies; 179 auto insert = [&proxies](const ::sc_core::sc_bind_proxy &p) -> bool { 180 if (!p.port() && !p.interface()) 181 return false; 182 proxies.push_back(&p); 183 return true; 184 }; 185 insert(p001) && insert(p002) && insert(p003) && insert(p004) && 186 insert(p005) && insert(p006) && insert(p007) && insert(p008) && 187 insert(p009) && insert(p010) && insert(p011) && insert(p012) && 188 insert(p013) && insert(p014) && insert(p015) && insert(p016) && 189 insert(p017) && insert(p018) && insert(p019) && insert(p020) && 190 insert(p021) && insert(p022) && insert(p023) && insert(p024) && 191 insert(p025) && insert(p026) && insert(p027) && insert(p028) && 192 insert(p029) && insert(p030) && insert(p031) && insert(p032) && 193 insert(p033) && insert(p034) && insert(p035) && insert(p036) && 194 insert(p037) && insert(p038) && insert(p039) && insert(p040) && 195 insert(p041) && insert(p042) && insert(p043) && insert(p044) && 196 insert(p045) && insert(p046) && insert(p047) && insert(p048) && 197 insert(p049) && insert(p050) && insert(p051) && insert(p052) && 198 insert(p053) && insert(p054) && insert(p055) && insert(p056) && 199 insert(p057) && insert(p058) && insert(p059) && insert(p060) && 200 insert(p061) && insert(p062) && insert(p063) && insert(p064); 201 _gem5_module->bindPorts(proxies); 202} 203 204const std::vector<sc_object *> & 205sc_module::get_child_objects() const 206{ 207 return _gem5_module->obj()->get_child_objects(); 208} 209 210const std::vector<sc_event *> & 211sc_module::get_child_events() const 212{ 213 return _gem5_module->obj()->get_child_events(); 214} 215 216sc_module::sc_module() : 217 sc_object(sc_gem5::newModuleChecked()->name()), 218 _gem5_module(sc_gem5::currentModule()) 219{} 220 221sc_module::sc_module(const sc_module_name &) : sc_module() {} 222sc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name)) {} 223sc_module::sc_module(const std::string &_name) : 224 sc_module(sc_module_name(_name.c_str())) 225{} 226 227void 228sc_module::reset_signal_is(const sc_in<bool> &, bool) 229{ 230 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 231} 232 233void 234sc_module::reset_signal_is(const sc_inout<bool> &, bool) 235{ 236 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 237} 238 239void 240sc_module::reset_signal_is(const sc_out<bool> &, bool) 241{ 242 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 243} 244 245void 246sc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool) 247{ 248 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 249} 250 251 252void 253sc_module::async_reset_signal_is(const sc_in<bool> &, bool) 254{ 255 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 256} 257 258void 259sc_module::async_reset_signal_is(const sc_inout<bool> &, bool) 260{ 261 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 262} 263 264void 265sc_module::async_reset_signal_is(const sc_out<bool> &, bool) 266{ 267 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 268} 269 270void 271sc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool) 272{ 273 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 274} 275 276 277void 278sc_module::dont_initialize() 279{ 280 ::sc_gem5::Process::newest()->dontInitialize(); 281} 282 283void 284sc_module::set_stack_size(size_t size) 285{ 286 ::sc_gem5::Process::newest()->setStackSize(size); 287} 288 289 290void sc_module::next_trigger() { ::sc_core::next_trigger(); } 291 292void 293sc_module::next_trigger(const sc_event &e) 294{ 295 ::sc_core::next_trigger(e); 296} 297 298void 299sc_module::next_trigger(const sc_event_or_list &eol) 300{ 301 ::sc_core::next_trigger(eol); 302} 303 304void 305sc_module::next_trigger(const sc_event_and_list &eal) 306{ 307 ::sc_core::next_trigger(eal); 308} 309 310void 311sc_module::next_trigger(const sc_time &t) 312{ 313 ::sc_core::next_trigger(t); 314} 315 316void 317sc_module::next_trigger(double d, sc_time_unit u) 318{ 319 ::sc_core::next_trigger(d, u); 320} 321 322void 323sc_module::next_trigger(const sc_time &t, const sc_event &e) 324{ 325 ::sc_core::next_trigger(t, e); 326} 327 328void 329sc_module::next_trigger(double d, sc_time_unit u, const sc_event &e) 330{ 331 ::sc_core::next_trigger(d, u, e); 332} 333 334void 335sc_module::next_trigger(const sc_time &t, const sc_event_or_list &eol) 336{ 337 ::sc_core::next_trigger(t, eol); 338} 339 340void 341sc_module::next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 342{ 343 ::sc_core::next_trigger(d, u, eol); 344} 345 346void 347sc_module::next_trigger(const sc_time &t, const sc_event_and_list &eal) 348{ 349 ::sc_core::next_trigger(t, eal); 350} 351 352void 353sc_module::next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 354{ 355 ::sc_core::next_trigger(d, u, eal); 356} 357 358 359bool 360sc_module::timed_out() 361{ 362 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 363 return false; 364} 365 366 367void 368sc_module::wait() 369{ 370 ::sc_core::wait(); 371} 372 373void 374sc_module::wait(int i) 375{ 376 ::sc_core::wait(i); 377} 378 379void 380sc_module::wait(const sc_event &e) 381{ 382 ::sc_core::wait(e); 383} 384 385void 386sc_module::wait(const sc_event_or_list &eol) 387{ 388 ::sc_core::wait(eol); 389} 390 391void 392sc_module::wait(const sc_event_and_list &eal) 393{ 394 ::sc_core::wait(eal); 395} 396 397void 398sc_module::wait(const sc_time &t) 399{ 400 ::sc_core::wait(t); 401} 402 403void 404sc_module::wait(double d, sc_time_unit u) 405{ 406 ::sc_core::wait(d, u); 407} 408 409void 410sc_module::wait(const sc_time &t, const sc_event &e) 411{ 412 ::sc_core::wait(t, e); 413} 414 415void 416sc_module::wait(double d, sc_time_unit u, const sc_event &e) 417{ 418 ::sc_core::wait(d, u, e); 419} 420 421void 422sc_module::wait(const sc_time &t, const sc_event_or_list &eol) 423{ 424 ::sc_core::wait(t, eol); 425} 426 427void 428sc_module::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 429{ 430 ::sc_core::wait(d, u, eol); 431} 432 433void 434sc_module::wait(const sc_time &t, const sc_event_and_list &eal) 435{ 436 ::sc_core::wait(t, eal); 437} 438 439void 440sc_module::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 441{ 442 ::sc_core::wait(d, u, eal); 443} 444 445 446void 447sc_module::halt() 448{ 449 ::sc_core::halt(); 450} 451 452void 453sc_module::at_posedge(const sc_signal_in_if<bool> &s) 454{ 455 ::sc_core::at_posedge(s); 456} 457 458void 459sc_module::at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 460{ 461 ::sc_core::at_posedge(s); 462} 463 464void 465sc_module::at_negedge(const sc_signal_in_if<bool> &s) 466{ 467 ::sc_core::at_negedge(s); 468} 469 470void 471sc_module::at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &s) 472{ 473 ::sc_core::at_negedge(s); 474} 475 476 477void 478next_trigger() 479{ 480 sc_gem5::Process *p = sc_gem5::scheduler.current(); 481 p->setDynamic(nullptr); 482} 483 484void 485next_trigger(const sc_event &e) 486{ 487 sc_gem5::Process *p = sc_gem5::scheduler.current(); 488 p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e)); 489} 490 491void 492next_trigger(const sc_event_or_list &eol) 493{ 494 sc_gem5::Process *p = sc_gem5::scheduler.current(); 495 p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol)); 496} 497 498void 499next_trigger(const sc_event_and_list &eal) 500{ 501 sc_gem5::Process *p = sc_gem5::scheduler.current(); 502 p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal)); 503} 504 505void 506next_trigger(const sc_time &t) 507{ 508 sc_gem5::Process *p = sc_gem5::scheduler.current(); 509 p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t)); 510} 511 512void 513next_trigger(double d, sc_time_unit u) 514{ 515 next_trigger(sc_time(d, u)); 516} 517 518void 519next_trigger(const sc_time &t, const sc_event &e) 520{ 521 sc_gem5::Process *p = sc_gem5::scheduler.current(); 522 p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e)); 523} 524 525void 526next_trigger(double d, sc_time_unit u, const sc_event &e) 527{ 528 next_trigger(sc_time(d, u), e); 529} 530 531void 532next_trigger(const sc_time &t, const sc_event_or_list &eol) 533{ 534 sc_gem5::Process *p = sc_gem5::scheduler.current(); 535 p->setDynamic( 536 new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol)); 537} 538 539void 540next_trigger(double d, sc_time_unit u, const sc_event_or_list &eol) 541{ 542 next_trigger(sc_time(d, u), eol); 543} 544 545void 546next_trigger(const sc_time &t, const sc_event_and_list &eal) 547{ 548 sc_gem5::Process *p = sc_gem5::scheduler.current(); 549 p->setDynamic( 550 new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal)); 551} 552 553void 554next_trigger(double d, sc_time_unit u, const sc_event_and_list &eal) 555{ 556 next_trigger(sc_time(d, u), eal); 557} 558 559bool 560timed_out() 561{ 562 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 563 return false; 564} 565 566 567void 568wait() 569{ 570 sc_gem5::Process *p = sc_gem5::scheduler.current(); 571 p->setDynamic(nullptr); 572 sc_gem5::scheduler.yield(); 573} 574 575void 576wait(int n) 577{ 578 if (n <= 0) { 579 std::string msg = csprintf("n = %d", n); 580 SC_REPORT_ERROR("(E525) wait(n) is only valid for n > 0", msg.c_str()); 581 } 582 for (int i = 0; i < n; i++) 583 wait(); 584} 585 586void 587wait(const sc_event &e) 588{ 589 sc_gem5::Process *p = sc_gem5::scheduler.current(); 590 p->setDynamic(new ::sc_gem5::SensitivityEvent(p, &e)); 591 sc_gem5::scheduler.yield(); 592} 593 594void 595wait(const sc_event_or_list &eol) 596{ 597 sc_gem5::Process *p = sc_gem5::scheduler.current(); 598 p->setDynamic(new ::sc_gem5::SensitivityEventOrList(p, &eol)); 599 sc_gem5::scheduler.yield(); 600} 601 602void 603wait(const sc_event_and_list &eal) 604{ 605 sc_gem5::Process *p = sc_gem5::scheduler.current(); 606 p->setDynamic(new ::sc_gem5::SensitivityEventAndList(p, &eal)); 607 sc_gem5::scheduler.yield(); 608} 609 610void 611wait(const sc_time &t) 612{ 613 sc_gem5::Process *p = sc_gem5::scheduler.current(); 614 p->setDynamic(new ::sc_gem5::SensitivityTimeout(p, t)); 615 sc_gem5::scheduler.yield(); 616} 617 618void 619wait(double d, sc_time_unit u) 620{ 621 wait(sc_time(d, u)); 622} 623 624void 625wait(const sc_time &t, const sc_event &e) 626{ 627 sc_gem5::Process *p = sc_gem5::scheduler.current(); 628 p->setDynamic(new ::sc_gem5::SensitivityTimeoutAndEvent(p, t, &e)); 629 sc_gem5::scheduler.yield(); 630} 631 632void 633wait(double d, sc_time_unit u, const sc_event &e) 634{ 635 wait(sc_time(d, u), e); 636} 637 638void 639wait(const sc_time &t, const sc_event_or_list &eol) 640{ 641 sc_gem5::Process *p = sc_gem5::scheduler.current(); 642 p->setDynamic( 643 new ::sc_gem5::SensitivityTimeoutAndEventOrList(p, t, &eol)); 644 sc_gem5::scheduler.yield(); 645} 646 647void 648wait(double d, sc_time_unit u, const sc_event_or_list &eol) 649{ 650 wait(sc_time(d, u), eol); 651} 652 653void 654wait(const sc_time &t, const sc_event_and_list &eal) 655{ 656 sc_gem5::Process *p = sc_gem5::scheduler.current(); 657 p->setDynamic( 658 new ::sc_gem5::SensitivityTimeoutAndEventAndList(p, t, &eal)); 659 sc_gem5::scheduler.yield(); 660} 661 662void 663wait(double d, sc_time_unit u, const sc_event_and_list &eal) 664{ 665 wait(sc_time(d, u), eal); 666} 667 668void 669halt() 670{ 671 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 672} 673 674void 675at_posedge(const sc_signal_in_if<bool> &) 676{ 677 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 678} 679 680void 681at_posedge(const sc_signal_in_if<sc_dt::sc_logic> &) 682{ 683 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 684} 685 686void 687at_negedge(const sc_signal_in_if<bool> &) 688{ 689 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 690} 691 692void 693at_negedge(const sc_signal_in_if<sc_dt::sc_logic> &) 694{ 695 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 696} 697 698const char * 699sc_gen_unique_name(const char *seed) 700{ 701 ::sc_gem5::Module *mod = ::sc_gem5::currentModule(); 702 return mod ? mod->uniqueName(seed) : 703 ::sc_gem5::nameGen.gen(seed); 704} 705 706bool 707sc_hierarchical_name_exists(const char *name) 708{ 709 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 710 return false; 711} 712 713bool 714sc_start_of_simulation_invoked() 715{ 716 return ::sc_gem5::kernel->startOfSimulationComplete(); 717} 718 719bool 720sc_end_of_simulation_invoked() 721{ 722 return ::sc_gem5::kernel->endOfSimulationComplete(); 723} 724 725sc_module * 726sc_module_sc_new(sc_module *mod) 727{ 728 static std::vector<std::unique_ptr<sc_module> > modules; 729 modules.emplace_back(mod); 730 return mod; 731} 732 733} // namespace sc_core 734