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; --- 373 unchanged lines hidden (view full) --- 382 rob->takeOverFrom(); 383} 384 385template <class Impl> 386void 387DefaultCommit<Impl>::updateStatus() 388{ 389 // reset ROB changed variable |
390 std::list<unsigned>::iterator threads = activeThreads->begin(); 391 std::list<unsigned>::iterator end = activeThreads->end(); 392 393 while (threads != end) { |
394 unsigned tid = *threads++; |
395 |
396 changedROBNumEntries[tid] = false; 397 398 // Also check if any of the threads has a trap pending 399 if (commitStatus[tid] == TrapPending || 400 commitStatus[tid] == FetchTrapPending) { 401 _nextStatus = Active; 402 } 403 } --- 10 unchanged lines hidden (view full) --- 414} 415 416template <class Impl> 417void 418DefaultCommit<Impl>::setNextStatus() 419{ 420 int squashes = 0; 421 |
422 std::list<unsigned>::iterator threads = activeThreads->begin(); 423 std::list<unsigned>::iterator end = activeThreads->end(); |
424 |
425 while (threads != end) { |
426 unsigned tid = *threads++; 427 428 if (commitStatus[tid] == ROBSquashing) { 429 squashes++; 430 } 431 } 432 433 squashCounter = squashes; --- 4 unchanged lines hidden (view full) --- 438 _nextStatus = Active; 439 } 440} 441 442template <class Impl> 443bool 444DefaultCommit<Impl>::changedROBEntries() 445{ |
446 std::list<unsigned>::iterator threads = activeThreads->begin(); 447 std::list<unsigned>::iterator end = activeThreads->end(); |
448 |
449 while (threads != end) { |
450 unsigned tid = *threads++; 451 452 if (changedROBNumEntries[tid]) { 453 return true; 454 } 455 } 456 457 return false; --- 56 unchanged lines hidden (view full) --- 514 515 // Send back the rob squashing signal so other stages know that 516 // the ROB is in the process of squashing. 517 toIEW->commitInfo[tid].robSquashing = true; 518 519 toIEW->commitInfo[tid].branchMispredict = false; 520 521 toIEW->commitInfo[tid].nextPC = PC[tid]; |
522} 523 524template <class Impl> 525void 526DefaultCommit<Impl>::squashFromTrap(unsigned tid) 527{ 528 squashAll(tid); 529 --- 33 unchanged lines hidden (view full) --- 563 _nextStatus = Inactive; 564 565 if (drainPending && rob->isEmpty() && !iewStage->hasStoresToWB()) { 566 cpu->signalDrained(); 567 drainPending = false; 568 return; 569 } 570 |
571 if (activeThreads->empty()) |
572 return; 573 |
574 std::list<unsigned>::iterator threads = activeThreads->begin(); 575 std::list<unsigned>::iterator end = activeThreads->end(); |
576 577 // Check if any of the threads are done squashing. Change the 578 // status if they are done. |
579 while (threads != end) { |
580 unsigned tid = *threads++; 581 582 if (commitStatus[tid] == ROBSquashing) { 583 584 if (rob->isDoneSquashing(tid)) { 585 commitStatus[tid] = Running; 586 } else { 587 DPRINTF(Commit,"[tid:%u]: Still Squashing, cannot commit any" --- 4 unchanged lines hidden (view full) --- 592 } 593 } 594 } 595 596 commit(); 597 598 markCompletedInsts(); 599 |
600 threads = activeThreads->begin(); |
601 |
602 while (threads != end) { |
603 unsigned tid = *threads++; 604 605 if (!rob->isEmpty(tid) && rob->readHeadInst(tid)->readyToCommit()) { 606 // The ROB has more instructions it can commit. Its next status 607 // will be active. 608 _nextStatus = Active; 609 610 DynInstPtr inst = rob->readHeadInst(tid); --- 81 unchanged lines hidden (view full) --- 692 } 693 } 694 695#endif // FULL_SYSTEM 696 697 //////////////////////////////////// 698 // Check for any possible squashes, handle them first 699 //////////////////////////////////// |
700 std::list<unsigned>::iterator threads = activeThreads->begin(); 701 std::list<unsigned>::iterator end = activeThreads->end(); |
702 |
703 while (threads != end) { |
704 unsigned tid = *threads++; 705 706 // Not sure which one takes priority. I think if we have 707 // both, that's a bad sign. 708 if (trapSquash[tid] == true) { 709 assert(!tcSquash[tid]); 710 squashFromTrap(tid); 711 } else if (tcSquash[tid] == true) { --- 18 unchanged lines hidden (view full) --- 730 731 commitStatus[tid] = ROBSquashing; 732 733 // If we want to include the squashing instruction in the squash, 734 // then use one older sequence number. 735 InstSeqNum squashed_inst = fromIEW->squashedSeqNum[tid]; 736 737#if ISA_HAS_DELAY_SLOT |
738 InstSeqNum bdelay_done_seq_num; 739 bool squash_bdelay_slot; |
740 |
741 if (fromIEW->branchMispredict[tid]) { 742 if (fromIEW->branchTaken[tid] && 743 fromIEW->condDelaySlotBranch[tid]) { 744 DPRINTF(Commit, "[tid:%i]: Cond. delay slot branch" 745 "mispredicted as taken. Squashing after previous " 746 "inst, [sn:%i]\n", 747 tid, squashed_inst); 748 bdelay_done_seq_num = squashed_inst; 749 squash_bdelay_slot = true; 750 } else { 751 DPRINTF(Commit, "[tid:%i]: Branch Mispredict. Squashing " 752 "after delay slot [sn:%i]\n", tid, squashed_inst+1); 753 bdelay_done_seq_num = squashed_inst + 1; 754 squash_bdelay_slot = false; 755 } 756 } else { 757 bdelay_done_seq_num = squashed_inst; 758 squash_bdelay_slot = true; 759 } |
760#endif 761 762 if (fromIEW->includeSquashInst[tid] == true) { 763 squashed_inst--; 764#if ISA_HAS_DELAY_SLOT 765 bdelay_done_seq_num--; 766#endif 767 } --- 21 unchanged lines hidden (view full) --- 789 790 toIEW->commitInfo[tid].branchMispredict = 791 fromIEW->branchMispredict[tid]; 792 793 toIEW->commitInfo[tid].branchTaken = 794 fromIEW->branchTaken[tid]; 795 796 toIEW->commitInfo[tid].nextPC = fromIEW->nextPC[tid]; |
797 798 toIEW->commitInfo[tid].mispredPC = fromIEW->mispredPC[tid]; 799 800 if (toIEW->commitInfo[tid].branchMispredict) { 801 ++branchMispredicts; 802 } 803 } 804 --- 9 unchanged lines hidden (view full) --- 814 commitInsts(); 815 } else { 816#if ISA_HAS_DELAY_SLOT 817 skidInsert(); 818#endif 819 } 820 821 //Check for any activity |
822 threads = activeThreads->begin(); |
823 |
824 while (threads != end) { |
825 unsigned tid = *threads++; 826 827 if (changedROBNumEntries[tid]) { 828 toIEW->commitInfo[tid].usedROB = true; 829 toIEW->commitInfo[tid].freeROBEntries = rob->numFreeEntries(tid); 830 831 if (rob->isEmpty(tid)) { 832 toIEW->commitInfo[tid].emptyROB = true; --- 286 unchanged lines hidden (view full) --- 1119 head_inst->traceData->setFetchSeq(head_inst->seqNum); 1120 head_inst->traceData->setCPSeq(thread[tid]->numInst); 1121 head_inst->traceData->finalize(); 1122 head_inst->traceData = NULL; 1123 } 1124 1125 // Update the commit rename map 1126 for (int i = 0; i < head_inst->numDestRegs(); i++) { |
1127 renameMap[tid]->setEntry(head_inst->destRegIdx(i), |
1128 head_inst->renamedDestRegIdx(i)); 1129 } 1130 1131 if (head_inst->isCopy()) 1132 panic("Should not commit any copy instructions!"); 1133 1134 // Finally clear the head ROB entry. 1135 rob->retireHead(tid); --- 130 unchanged lines hidden (view full) --- 1266 } 1267 } 1268} 1269 1270template <class Impl> 1271bool 1272DefaultCommit<Impl>::robDoneSquashing() 1273{ |
1274 std::list<unsigned>::iterator threads = activeThreads->begin(); 1275 std::list<unsigned>::iterator end = activeThreads->end(); |
1276 |
1277 while (threads != end) { |
1278 unsigned tid = *threads++; 1279 1280 if (!rob->isDoneSquashing(tid)) 1281 return false; 1282 } 1283 1284 return true; 1285} --- 62 unchanged lines hidden (view full) --- 1348 1349 case OldestReady: 1350 return oldestReady(); 1351 1352 default: 1353 return -1; 1354 } 1355 } else { |
1356 assert(!activeThreads->empty()); 1357 int tid = activeThreads->front(); |
1358 1359 if (commitStatus[tid] == Running || 1360 commitStatus[tid] == Idle || 1361 commitStatus[tid] == FetchTrapPending) { 1362 return tid; 1363 } else { 1364 return -1; 1365 } --- 30 unchanged lines hidden (view full) --- 1396 1397template<class Impl> 1398int 1399DefaultCommit<Impl>::oldestReady() 1400{ 1401 unsigned oldest = 0; 1402 bool first = true; 1403 |
1404 std::list<unsigned>::iterator threads = activeThreads->begin(); 1405 std::list<unsigned>::iterator end = activeThreads->end(); |
1406 |
1407 while (threads != end) { |
1408 unsigned tid = *threads++; 1409 1410 if (!rob->isEmpty(tid) && 1411 (commitStatus[tid] == Running || 1412 commitStatus[tid] == Idle || 1413 commitStatus[tid] == FetchTrapPending)) { 1414 1415 if (rob->isHeadReady(tid)) { --- 19 unchanged lines hidden --- |