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 --- 40 unchanged lines hidden (view full) --- 49 _numCycles(0), _current(nullptr), initDone(false), 50 runOnce(false) 51{} 52 53Scheduler::~Scheduler() 54{ 55 // Clear out everything that belongs to us to make sure nobody tries to 56 // clear themselves out after the scheduler goes away. |
57 clear(); 58} |
59 |
60void 61Scheduler::clear() 62{ |
63 // Delta notifications. 64 for (auto &e: deltas) 65 e->deschedule(); |
66 deltas.clear(); |
67 68 // Timed notifications. |
69 for (auto &tsp: timeSlots) { 70 TimeSlot *&ts = tsp.second; 71 for (auto &e: ts->events) |
72 e->deschedule(); |
73 eq->deschedule(ts); |
74 } |
75 timeSlots.clear(); |
76 77 // gem5 events. 78 if (readyEvent.scheduled()) 79 eq->deschedule(&readyEvent); 80 if (pauseEvent.scheduled()) 81 eq->deschedule(&pauseEvent); 82 if (stopEvent.scheduled()) 83 eq->deschedule(&stopEvent); --- 191 unchanged lines hidden (view full) --- 275} 276 277void 278Scheduler::stop() 279{ 280 _stopped = true; 281 kernel->stop(); 282 |
283 clear(); |
284 285 runOnce = false; 286 scMain->run(); 287} 288 289void 290Scheduler::start(Tick max_tick, bool run_to_time) 291{ --- 47 unchanged lines hidden (view full) --- 339 340void 341Scheduler::scheduleStop(bool finish_delta) 342{ 343 if (stopEvent.scheduled()) 344 return; 345 346 if (!finish_delta) { |
347 // If we're not supposed to finish the delta cycle, flush all 348 // pending activity. 349 clear(); |
350 } 351 eq->schedule(&stopEvent, eq->getCurTick()); 352} 353 354Scheduler scheduler; 355 356} // namespace sc_gem5 |