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 --- 30 unchanged lines hidden (view full) --- 39#include "systemc/core/scheduler.hh" 40 41namespace sc_gem5 42{ 43 44Event::Event(sc_core::sc_event *_sc_event) : Event(_sc_event, "") {} 45 46Event::Event(sc_core::sc_event *_sc_event, const char *_basename) : |
47 _sc_event(_sc_event), _basename(_basename), 48 delayedNotify([this]() { this->notify(); }) |
49{ 50 Module *p = currentModule(); 51 52 if (p) 53 parent = p->obj()->sc_obj(); 54 else if (scheduler.current()) 55 parent = scheduler.current(); 56 else --- 29 unchanged lines hidden (view full) --- 86 std::swap(*it, topLevelEvents.back()); 87 topLevelEvents.pop_back(); 88 } 89 90 EventsIt it = findEvent(_name); 91 std::swap(*it, allEvents.back()); 92 allEvents.pop_back(); 93 |
94 if (delayedNotify.scheduled()) 95 scheduler.deschedule(&delayedNotify); |
96} 97 98const std::string & 99Event::name() const 100{ 101 return _name; 102} 103 --- 19 unchanged lines hidden (view full) --- 123Event::notify() 124{ 125 auto local_sensitivities = sensitivities; 126 for (auto s: local_sensitivities) 127 s->notify(this); 128} 129 130void |
131Event::notify(const sc_core::sc_time &t) 132{ |
133 if (delayedNotify.scheduled()) { 134 if (scheduler.delayed(t) >= delayedNotify.when()) |
135 return; 136 |
137 scheduler.deschedule(&delayedNotify); |
138 } |
139 scheduler.schedule(&delayedNotify, t); |
140} 141 142void 143Event::cancel() 144{ |
145 if (delayedNotify.scheduled()) 146 scheduler.deschedule(&delayedNotify); |
147} 148 149bool 150Event::triggered() const 151{ 152 return false; 153} 154 --- 15 unchanged lines hidden --- |