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 --- 173 unchanged lines hidden (view full) --- 182 // Get the current time according to gem5. 183 Tick getCurTick() { return eq ? eq->getCurTick() : 0; } 184 185 // For scheduling delayed/timed notifications/timeouts. 186 void 187 schedule(::Event *event, Tick tick) 188 { 189 pendingTicks[tick]++; |
190 191 if (initReady) 192 eq->schedule(event, tick); 193 else 194 eventsToSchedule[event] = tick; |
195 } 196 197 // For descheduling delayed/timed notifications/timeouts. 198 void 199 deschedule(::Event *event) 200 { 201 auto it = pendingTicks.find(event->when()); 202 if (--it->second == 0) 203 pendingTicks.erase(it); |
204 205 if (initReady) 206 eq->deschedule(event); 207 else 208 eventsToSchedule.erase(event); |
209 } 210 211 // Tell the scheduler than an event fired for bookkeeping purposes. 212 void 213 eventHappened() 214 { 215 auto it = pendingTicks.begin(); 216 if (--it->second == 0) --- 88 unchanged lines hidden (view full) --- 305 306 bool initReady; 307 308 ProcessList initList; 309 ProcessList toFinalize; 310 ProcessList readyList; 311 312 ChannelList updateList; |
313 314 std::map<::Event *, Tick> eventsToSchedule; |
315}; 316 317extern Scheduler scheduler; 318 319} // namespace sc_gem5 320 321#endif // __SYSTEMC_CORE_SCHEDULER_H__ |