cpu.hh (9436:4a0223da4924) | cpu.hh (9444:ab47fe7f03f0) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2011 ARM Limited | 2 * Copyright (c) 2011-2012 ARM Limited |
3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 317 unchanged lines hidden (view full) --- 328 { 329 if (deallocateContextEvent[tid].scheduled()) 330 deallocateContextEvent[tid].squash(); 331 } 332 333 /** The tick event used for scheduling CPU ticks. */ 334 DeallocateContextEvent deallocateContextEvent[Impl::MaxThreads]; 335 | 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 317 unchanged lines hidden (view full) --- 328 { 329 if (deallocateContextEvent[tid].scheduled()) 330 deallocateContextEvent[tid].squash(); 331 } 332 333 /** The tick event used for scheduling CPU ticks. */ 334 DeallocateContextEvent deallocateContextEvent[Impl::MaxThreads]; 335 |
336 /** 337 * Check if the pipeline has drained and signal the DrainManager. 338 * 339 * This method checks if a drain has been requested and if the CPU 340 * has drained successfully (i.e., there are no instructions in 341 * the pipeline). If the CPU has drained, it deschedules the tick 342 * event and signals the drain manager. 343 * 344 * @return False if a drain hasn't been requested or the CPU 345 * hasn't drained, true otherwise. 346 */ 347 bool tryDrain(); 348 349 /** 350 * Perform sanity checks after a drain. 351 * 352 * This method is called from drain() when it has determined that 353 * the CPU is fully drained when gem5 is compiled with the NDEBUG 354 * macro undefined. The intention of this method is to do more 355 * extensive tests than the isDrained() method to weed out any 356 * draining bugs. 357 */ 358 void drainSanityCheck() const; 359 360 /** Check if a system is in a drained state. */ 361 bool isDrained() const; 362 |
|
336 public: 337 /** Constructs a CPU with the given parameters. */ 338 FullO3CPU(DerivO3CPUParams *params); 339 /** Destructor. */ 340 ~FullO3CPU(); 341 342 /** Registers statistics. */ 343 void regStats(); --- 67 unchanged lines hidden (view full) --- 411 void activateWhenReady(ThreadID tid); 412 413 /** Add or Remove a Thread Context in the CPU. */ 414 void doContextSwitch(); 415 416 /** Update The Order In Which We Process Threads. */ 417 void updateThreadPriority(); 418 | 363 public: 364 /** Constructs a CPU with the given parameters. */ 365 FullO3CPU(DerivO3CPUParams *params); 366 /** Destructor. */ 367 ~FullO3CPU(); 368 369 /** Registers statistics. */ 370 void regStats(); --- 67 unchanged lines hidden (view full) --- 438 void activateWhenReady(ThreadID tid); 439 440 /** Add or Remove a Thread Context in the CPU. */ 441 void doContextSwitch(); 442 443 /** Update The Order In Which We Process Threads. */ 444 void updateThreadPriority(); 445 |
446 /** Is the CPU draining? */ 447 bool isDraining() const { return getDrainState() == Drainable::Draining; } 448 |
|
419 /** Serialize state. */ 420 virtual void serialize(std::ostream &os); 421 422 /** Unserialize from a checkpoint. */ 423 virtual void unserialize(Checkpoint *cp, const std::string §ion); 424 425 public: 426 /** Executes a syscall. 427 * @todo: Determine if this needs to be virtual. 428 */ 429 void syscall(int64_t callnum, ThreadID tid); 430 431 /** Starts draining the CPU's pipeline of all instructions in 432 * order to stop all memory accesses. */ 433 unsigned int drain(DrainManager *drain_manager); 434 435 /** Resumes execution after a drain. */ 436 void drainResume(); 437 | 449 /** Serialize state. */ 450 virtual void serialize(std::ostream &os); 451 452 /** Unserialize from a checkpoint. */ 453 virtual void unserialize(Checkpoint *cp, const std::string §ion); 454 455 public: 456 /** Executes a syscall. 457 * @todo: Determine if this needs to be virtual. 458 */ 459 void syscall(int64_t callnum, ThreadID tid); 460 461 /** Starts draining the CPU's pipeline of all instructions in 462 * order to stop all memory accesses. */ 463 unsigned int drain(DrainManager *drain_manager); 464 465 /** Resumes execution after a drain. */ 466 void drainResume(); 467 |
438 /** Signals to this CPU that a stage has completed switching out. */ 439 void signalDrained(); | 468 /** 469 * Commit has reached a safe point to drain a thread. 470 * 471 * Commit calls this method to inform the pipeline that it has 472 * reached a point where it is not executed microcode and is about 473 * to squash uncommitted instructions to fully drain the pipeline. 474 */ 475 void commitDrained(ThreadID tid); |
440 441 /** Switches out this CPU. */ 442 virtual void switchOut(); 443 444 /** Takes over from another CPU. */ 445 virtual void takeOverFrom(BaseCPU *oldCPU); 446 447 /** Get the current instruction sequence number, and increment it. */ --- 279 unchanged lines hidden (view full) --- 727 Checker<Impl> *checker; 728 729 /** Pointer to the system. */ 730 System *system; 731 732 /** DrainManager to notify when draining has completed. */ 733 DrainManager *drainManager; 734 | 476 477 /** Switches out this CPU. */ 478 virtual void switchOut(); 479 480 /** Takes over from another CPU. */ 481 virtual void takeOverFrom(BaseCPU *oldCPU); 482 483 /** Get the current instruction sequence number, and increment it. */ --- 279 unchanged lines hidden (view full) --- 763 Checker<Impl> *checker; 764 765 /** Pointer to the system. */ 766 System *system; 767 768 /** DrainManager to notify when draining has completed. */ 769 DrainManager *drainManager; 770 |
735 /** Counter of how many stages have completed draining. */ 736 int drainCount; 737 | |
738 /** Pointers to all of the threads in the CPU. */ 739 std::vector<Thread *> thread; 740 741 /** Is there a context switch pending? */ 742 bool contextSwitch; 743 744 /** Threads Scheduled to Enter CPU */ 745 std::list<int> cpuWaitList; --- 69 unchanged lines hidden --- | 771 /** Pointers to all of the threads in the CPU. */ 772 std::vector<Thread *> thread; 773 774 /** Is there a context switch pending? */ 775 bool contextSwitch; 776 777 /** Threads Scheduled to Enter CPU */ 778 std::list<int> cpuWaitList; --- 69 unchanged lines hidden --- |