cpu.cc (2818:a2b6429690b6) | cpu.cc (2829:f354c00bba05) |
---|---|
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> | 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> |
|
89FullO3CPU<Impl>::FullO3CPU(Params *params) 90 : BaseO3CPU(params), 91 tickEvent(this), 92 removeInstsThisCycle(false), 93 fetch(params), 94 decode(params), 95 rename(params), 96 iew(params), --- 155 unchanged lines hidden (view full) --- 252 } 253 rename.setFreeList(&freeList); 254 255 // Setup the ROB for whichever stages need it. 256 commit.setROB(&rob); 257 258 lastRunningCycle = curTick; 259 | 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 |
|
260 contextSwitch = false; 261} 262 263template <class Impl> 264FullO3CPU<Impl>::~FullO3CPU() 265{ 266} 267 --- 301 unchanged lines hidden (view full) --- 569 570 //do waitlist 571 cpuWaitList.push_back(tid); 572 } 573} 574 575template <class Impl> 576void | 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 |
577FullO3CPU<Impl>::activateContext(int tid, int delay) | 608FullO3CPU<Impl>::activateThread(unsigned int tid) |
578{ | 609{ |
579 // Needs to set each stage to running as well. | |
580 list<unsigned>::iterator isActive = find( 581 activeThreads.begin(), activeThreads.end(), tid); 582 583 if (isActive == activeThreads.end()) { | 610 list<unsigned>::iterator isActive = find( 611 activeThreads.begin(), activeThreads.end(), tid); 612 613 if (isActive == activeThreads.end()) { |
584 //May Need to Re-code this if the delay variable is the 585 //delay needed for thread to activate 586 DPRINTF(O3CPU, "Adding Thread %i to active threads list\n", | 614 DPRINTF(O3CPU, "[tid:%i]: Adding to active threads list\n", |
587 tid); 588 589 activeThreads.push_back(tid); 590 } | 615 tid); 616 617 activeThreads.push_back(tid); 618 } |
619} |
|
591 | 620 |
592 assert(_status == Idle || _status == SwitchedOut); | |
593 | 621 |
594 scheduleTickEvent(delay); | 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 } |
595 | 634 |
596 // Be sure to signal that there's some activity so the CPU doesn't 597 // deschedule itself. 598 activityRec.activity(); 599 fetch.wakeFromQuiesce(); | 635 if(lastActivatedCycle < curTick) { 636 scheduleTickEvent(delay); |
600 | 637 |
601 _status = Running; | 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 } |
602} 603 604template <class Impl> 605void 606FullO3CPU<Impl>::suspendContext(int tid) 607{ 608 DPRINTF(O3CPU,"[tid: %i]: Suspended ...\n", tid); 609 unscheduleTickEvent(); --- 605 unchanged lines hidden --- | 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 --- |