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 --- 577 unchanged lines hidden (view full) --- 586 ::sc_gem5::Process *p = sc_gem5::scheduler.current(); 587 if (!p) 588 return false; 589 else 590 return p->timedOut(); 591} 592 593 |
594namespace 595{ 596 597bool 598waitErrorCheck(sc_gem5::Process *p) 599{ 600 if (p->procKind() == SC_METHOD_PROC_) { 601 SC_REPORT_ERROR( 602 "(E519) wait() is only allowed in SC_THREADs and SC_CTHREADs", 603 "\n in SC_METHODs use next_trigger() instead"); 604 return true; 605 } 606 return false; 607} 608 609} // anonymous namespace 610 |
611void 612wait() 613{ 614 sc_gem5::Process *p = sc_gem5::scheduler.current(); |
615 if (waitErrorCheck(p)) 616 return; |
617 p->cancelTimeout(); 618 p->clearDynamic(); 619 sc_gem5::scheduler.yield(); 620} 621 622void 623wait(int n) 624{ --- 4 unchanged lines hidden (view full) --- 629 for (int i = 0; i < n; i++) 630 wait(); 631} 632 633void 634wait(const sc_event &e) 635{ 636 sc_gem5::Process *p = sc_gem5::scheduler.current(); |
637 if (waitErrorCheck(p)) 638 return; |
639 p->cancelTimeout(); 640 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 641 sc_gem5::scheduler.yield(); 642} 643 644void 645wait(const sc_event_or_list &eol) 646{ 647 sc_gem5::Process *p = sc_gem5::scheduler.current(); |
648 if (waitErrorCheck(p)) 649 return; |
650 p->cancelTimeout(); 651 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 652 sc_gem5::scheduler.yield(); 653} 654 655void 656wait(const sc_event_and_list &eal) 657{ 658 sc_gem5::Process *p = sc_gem5::scheduler.current(); |
659 if (waitErrorCheck(p)) 660 return; |
661 p->cancelTimeout(); 662 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 663 sc_gem5::scheduler.yield(); 664} 665 666void 667wait(const sc_time &t) 668{ 669 sc_gem5::Process *p = sc_gem5::scheduler.current(); |
670 if (waitErrorCheck(p)) 671 return; |
672 p->setTimeout(t); 673 p->clearDynamic(); 674 sc_gem5::scheduler.yield(); 675} 676 677void 678wait(double d, sc_time_unit u) 679{ 680 wait(sc_time(d, u)); 681} 682 683void 684wait(const sc_time &t, const sc_event &e) 685{ 686 sc_gem5::Process *p = sc_gem5::scheduler.current(); |
687 if (waitErrorCheck(p)) 688 return; |
689 p->setTimeout(t); 690 ::sc_gem5::newDynamicSensitivityEvent(p, &e); 691 sc_gem5::scheduler.yield(); 692} 693 694void 695wait(double d, sc_time_unit u, const sc_event &e) 696{ 697 wait(sc_time(d, u), e); 698} 699 700void 701wait(const sc_time &t, const sc_event_or_list &eol) 702{ 703 sc_gem5::Process *p = sc_gem5::scheduler.current(); |
704 if (waitErrorCheck(p)) 705 return; |
706 p->setTimeout(t); 707 ::sc_gem5::newDynamicSensitivityEventOrList(p, &eol); 708 sc_gem5::scheduler.yield(); 709} 710 711void 712wait(double d, sc_time_unit u, const sc_event_or_list &eol) 713{ 714 wait(sc_time(d, u), eol); 715} 716 717void 718wait(const sc_time &t, const sc_event_and_list &eal) 719{ 720 sc_gem5::Process *p = sc_gem5::scheduler.current(); |
721 if (waitErrorCheck(p)) 722 return; |
723 p->setTimeout(t); 724 ::sc_gem5::newDynamicSensitivityEventAndList(p, &eal); 725 sc_gem5::scheduler.yield(); 726} 727 728void 729wait(double d, sc_time_unit u, const sc_event_and_list &eal) 730{ --- 82 unchanged lines hidden --- |