1/* 2 * Copyright (c) 2004-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 72 unchanged lines hidden (view full) --- 81template <class Impl> 82const char * 83FullO3CPU<Impl>::TickEvent::description() 84{ 85 return "FullO3CPU tick event"; 86} 87 88template <class Impl> |
89FullO3CPU<Impl>::ActivateThreadEvent::ActivateThreadEvent() 90 : Event(&mainEventQueue, CPU_Tick_Pri) 91{ 92} 93 94template <class Impl> 95void 96FullO3CPU<Impl>::ActivateThreadEvent::init(int thread_num, 97 FullO3CPU<Impl> *thread_cpu) 98{ 99 tid = thread_num; 100 cpu = thread_cpu; 101} 102 103template <class Impl> 104void 105FullO3CPU<Impl>::ActivateThreadEvent::process() 106{ 107 cpu->activateThread(tid); 108} 109 110template <class Impl> 111const char * 112FullO3CPU<Impl>::ActivateThreadEvent::description() 113{ 114 return "FullO3CPU \"Activate Thread\" event"; 115} 116 117template <class Impl> |
118FullO3CPU<Impl>::FullO3CPU(Params *params) 119 : BaseO3CPU(params), 120 tickEvent(this), 121 removeInstsThisCycle(false), 122 fetch(params), 123 decode(params), 124 rename(params), 125 iew(params), --- 155 unchanged lines hidden (view full) --- 281 } 282 rename.setFreeList(&freeList); 283 284 // Setup the ROB for whichever stages need it. 285 commit.setROB(&rob); 286 287 lastRunningCycle = curTick; 288 |
289 lastActivatedCycle = -1; 290 |
291 contextSwitch = false; 292} 293 294template <class Impl> 295FullO3CPU<Impl>::~FullO3CPU() 296{ 297} 298 --- 301 unchanged lines hidden (view full) --- 600 601 //do waitlist 602 cpuWaitList.push_back(tid); 603 } 604} 605 606template <class Impl> 607void |
608FullO3CPU<Impl>::activateThread(unsigned int tid) |
609{ |
610 list<unsigned>::iterator isActive = find( 611 activeThreads.begin(), activeThreads.end(), tid); 612 613 if (isActive == activeThreads.end()) { |
614 DPRINTF(O3CPU, "[tid:%i]: Adding to active threads list\n", |
615 tid); 616 617 activeThreads.push_back(tid); 618 } |
619} |
620 |
621 |
622template <class Impl> 623void 624FullO3CPU<Impl>::activateContext(int tid, int delay) 625{ 626 // Needs to set each stage to running as well. 627 if (delay){ 628 DPRINTF(O3CPU, "[tid:%i]: Scheduling thread context to activate " 629 "on cycle %d\n", tid, curTick + cycles(delay)); 630 scheduleActivateThreadEvent(tid, delay); 631 } else { 632 activateThread(tid); 633 } |
634 |
635 if(lastActivatedCycle < curTick) { 636 scheduleTickEvent(delay); |
637 |
638 // Be sure to signal that there's some activity so the CPU doesn't 639 // deschedule itself. 640 activityRec.activity(); 641 fetch.wakeFromQuiesce(); 642 643 lastActivatedCycle = curTick; 644 645 _status = Running; 646 } |
647} 648 649template <class Impl> 650void 651FullO3CPU<Impl>::suspendContext(int tid) 652{ 653 DPRINTF(O3CPU,"[tid: %i]: Suspended ...\n", tid); 654 unscheduleTickEvent(); --- 605 unchanged lines hidden --- |