scheduler.hh (13182:9e030f636a8c) | scheduler.hh (13186:1ebc6c729311) |
---|---|
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 --- 304 unchanged lines hidden (view full) --- 313 if (pendingCurr()) 314 return 0; 315 if (pendingFuture()) 316 return timeSlots.begin()->first - getCurTick(); 317 return MaxTick - getCurTick(); 318 } 319 320 // Run scheduled channel updates. | 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 --- 304 unchanged lines hidden (view full) --- 313 if (pendingCurr()) 314 return 0; 315 if (pendingFuture()) 316 return timeSlots.begin()->first - getCurTick(); 317 return MaxTick - getCurTick(); 318 } 319 320 // Run scheduled channel updates. |
321 void update(); | 321 void runUpdate(); |
322 | 322 |
323 // Run delta events. 324 void runDelta(); 325 |
|
323 void setScMainFiber(Fiber *sc_main) { scMain = sc_main; } 324 325 void start(Tick max_tick, bool run_to_time); 326 void oneCycle(); 327 328 void schedulePause(); 329 void scheduleStop(bool finish_delta); 330 | 326 void setScMainFiber(Fiber *sc_main) { scMain = sc_main; } 327 328 void start(Tick max_tick, bool run_to_time); 329 void oneCycle(); 330 331 void schedulePause(); 332 void scheduleStop(bool finish_delta); 333 |
331 bool paused() { return _paused; } 332 bool stopped() { return _stopped; } | 334 enum Status 335 { 336 StatusOther = 0, 337 StatusDelta, 338 StatusUpdate, 339 StatusTiming, 340 StatusPaused, 341 StatusStopped 342 }; |
333 | 343 |
344 bool paused() { return status() == StatusPaused; } 345 bool stopped() { return status() == StatusStopped; } 346 bool inDelta() { return status() == StatusDelta; } 347 bool inUpdate() { return status() == StatusUpdate; } 348 bool inTiming() { return status() == StatusTiming; } 349 |
|
334 uint64_t changeStamp() { return _changeStamp; } 335 336 void throwToScMain(const ::sc_core::sc_report *r=nullptr); 337 | 350 uint64_t changeStamp() { return _changeStamp; } 351 352 void throwToScMain(const ::sc_core::sc_report *r=nullptr); 353 |
354 Status status() { return _status; } 355 void status(Status s) { _status = s; } 356 |
|
338 private: 339 typedef const EventBase::Priority Priority; 340 static Priority DefaultPriority = EventBase::Default_Pri; 341 342 static Priority StopPriority = DefaultPriority - 1; 343 static Priority PausePriority = DefaultPriority + 1; 344 static Priority MaxTickPriority = DefaultPriority + 2; 345 static Priority ReadyPriority = DefaultPriority + 3; --- 44 unchanged lines hidden (view full) --- 390 updateList.empty() && deltas.empty() && 391 (timeSlots.empty() || timeSlots.begin()->first > maxTick) && 392 initList.empty()); 393 } 394 EventWrapper<Scheduler, &Scheduler::pause> starvationEvent; 395 void scheduleStarvationEvent(); 396 397 bool _started; | 357 private: 358 typedef const EventBase::Priority Priority; 359 static Priority DefaultPriority = EventBase::Default_Pri; 360 361 static Priority StopPriority = DefaultPriority - 1; 362 static Priority PausePriority = DefaultPriority + 1; 363 static Priority MaxTickPriority = DefaultPriority + 2; 364 static Priority ReadyPriority = DefaultPriority + 3; --- 44 unchanged lines hidden (view full) --- 409 updateList.empty() && deltas.empty() && 410 (timeSlots.empty() || timeSlots.begin()->first > maxTick) && 411 initList.empty()); 412 } 413 EventWrapper<Scheduler, &Scheduler::pause> starvationEvent; 414 void scheduleStarvationEvent(); 415 416 bool _started; |
398 bool _paused; 399 bool _stopped; | |
400 bool _stopNow; 401 | 417 bool _stopNow; 418 |
419 Status _status; 420 |
|
402 Tick maxTick; 403 Tick lastReadyTick; 404 void 405 maxTickFunc() 406 { 407 if (lastReadyTick != getCurTick()) 408 _changeStamp++; 409 pause(); --- 21 unchanged lines hidden (view full) --- 431 std::map<::Event *, Tick> eventsToSchedule; 432}; 433 434extern Scheduler scheduler; 435 436inline void 437Scheduler::TimeSlot::process() 438{ | 421 Tick maxTick; 422 Tick lastReadyTick; 423 void 424 maxTickFunc() 425 { 426 if (lastReadyTick != getCurTick()) 427 _changeStamp++; 428 pause(); --- 21 unchanged lines hidden (view full) --- 450 std::map<::Event *, Tick> eventsToSchedule; 451}; 452 453extern Scheduler scheduler; 454 455inline void 456Scheduler::TimeSlot::process() 457{ |
458 scheduler.status(StatusTiming); 459 |
|
439 while (!events.empty()) 440 events.front()->run(); | 460 while (!events.empty()) 461 events.front()->run(); |
462 463 scheduler.status(StatusOther); |
|
441 scheduler.completeTimeSlot(this); 442} 443 444const ::sc_core::sc_report *reportifyException(); 445 446} // namespace sc_gem5 447 448#endif // __SYSTEMC_CORE_SCHEDULER_H__ | 464 scheduler.completeTimeSlot(this); 465} 466 467const ::sc_core::sc_report *reportifyException(); 468 469} // namespace sc_gem5 470 471#endif // __SYSTEMC_CORE_SCHEDULER_H__ |