Deleted Added
sdiff udiff text old ( 3795:60ecc96c3cee ) new ( 3867:807483cfab77 )
full compact
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 while (threads != (*activeThreads).end()) {
392 unsigned tid = *threads++;
393 changedROBNumEntries[tid] = false;
394
395 // Also check if any of the threads has a trap pending
396 if (commitStatus[tid] == TrapPending ||
397 commitStatus[tid] == FetchTrapPending) {
398 _nextStatus = Active;
399 }
400 }

--- 10 unchanged lines hidden (view full) ---

411}
412
413template <class Impl>
414void
415DefaultCommit<Impl>::setNextStatus()
416{
417 int squashes = 0;
418
419 std::list<unsigned>::iterator threads = (*activeThreads).begin();
420
421 while (threads != (*activeThreads).end()) {
422 unsigned tid = *threads++;
423
424 if (commitStatus[tid] == ROBSquashing) {
425 squashes++;
426 }
427 }
428
429 squashCounter = squashes;

--- 4 unchanged lines hidden (view full) ---

434 _nextStatus = Active;
435 }
436}
437
438template <class Impl>
439bool
440DefaultCommit<Impl>::changedROBEntries()
441{
442 std::list<unsigned>::iterator threads = (*activeThreads).begin();
443
444 while (threads != (*activeThreads).end()) {
445 unsigned tid = *threads++;
446
447 if (changedROBNumEntries[tid]) {
448 return true;
449 }
450 }
451
452 return false;

--- 56 unchanged lines hidden (view full) ---

509
510 // Send back the rob squashing signal so other stages know that
511 // the ROB is in the process of squashing.
512 toIEW->commitInfo[tid].robSquashing = true;
513
514 toIEW->commitInfo[tid].branchMispredict = false;
515
516 toIEW->commitInfo[tid].nextPC = PC[tid];
517 toIEW->commitInfo[tid].nextNPC = nextPC[tid];
518}
519
520template <class Impl>
521void
522DefaultCommit<Impl>::squashFromTrap(unsigned tid)
523{
524 squashAll(tid);
525

--- 33 unchanged lines hidden (view full) ---

559 _nextStatus = Inactive;
560
561 if (drainPending && rob->isEmpty() && !iewStage->hasStoresToWB()) {
562 cpu->signalDrained();
563 drainPending = false;
564 return;
565 }
566
567 if ((*activeThreads).size() <= 0)
568 return;
569
570 std::list<unsigned>::iterator threads = (*activeThreads).begin();
571
572 // Check if any of the threads are done squashing. Change the
573 // status if they are done.
574 while (threads != (*activeThreads).end()) {
575 unsigned tid = *threads++;
576
577 if (commitStatus[tid] == ROBSquashing) {
578
579 if (rob->isDoneSquashing(tid)) {
580 commitStatus[tid] = Running;
581 } else {
582 DPRINTF(Commit,"[tid:%u]: Still Squashing, cannot commit any"

--- 4 unchanged lines hidden (view full) ---

587 }
588 }
589 }
590
591 commit();
592
593 markCompletedInsts();
594
595 threads = (*activeThreads).begin();
596
597 while (threads != (*activeThreads).end()) {
598 unsigned tid = *threads++;
599
600 if (!rob->isEmpty(tid) && rob->readHeadInst(tid)->readyToCommit()) {
601 // The ROB has more instructions it can commit. Its next status
602 // will be active.
603 _nextStatus = Active;
604
605 DynInstPtr inst = rob->readHeadInst(tid);

--- 81 unchanged lines hidden (view full) ---

687 }
688 }
689
690#endif // FULL_SYSTEM
691
692 ////////////////////////////////////
693 // Check for any possible squashes, handle them first
694 ////////////////////////////////////
695 std::list<unsigned>::iterator threads = (*activeThreads).begin();
696
697 while (threads != (*activeThreads).end()) {
698 unsigned tid = *threads++;
699
700 // Not sure which one takes priority. I think if we have
701 // both, that's a bad sign.
702 if (trapSquash[tid] == true) {
703 assert(!tcSquash[tid]);
704 squashFromTrap(tid);
705 } else if (tcSquash[tid] == true) {

--- 18 unchanged lines hidden (view full) ---

724
725 commitStatus[tid] = ROBSquashing;
726
727 // If we want to include the squashing instruction in the squash,
728 // then use one older sequence number.
729 InstSeqNum squashed_inst = fromIEW->squashedSeqNum[tid];
730
731#if ISA_HAS_DELAY_SLOT
732 InstSeqNum bdelay_done_seq_num = squashed_inst;
733 bool squash_bdelay_slot = fromIEW->squashDelaySlot[tid];
734
735 if (!squash_bdelay_slot)
736 bdelay_done_seq_num++;
737#endif
738
739 if (fromIEW->includeSquashInst[tid] == true) {
740 squashed_inst--;
741#if ISA_HAS_DELAY_SLOT
742 bdelay_done_seq_num--;
743#endif
744 }

--- 21 unchanged lines hidden (view full) ---

766
767 toIEW->commitInfo[tid].branchMispredict =
768 fromIEW->branchMispredict[tid];
769
770 toIEW->commitInfo[tid].branchTaken =
771 fromIEW->branchTaken[tid];
772
773 toIEW->commitInfo[tid].nextPC = fromIEW->nextPC[tid];
774 toIEW->commitInfo[tid].nextNPC = fromIEW->nextNPC[tid];
775
776 toIEW->commitInfo[tid].mispredPC = fromIEW->mispredPC[tid];
777
778 if (toIEW->commitInfo[tid].branchMispredict) {
779 ++branchMispredicts;
780 }
781 }
782

--- 9 unchanged lines hidden (view full) ---

792 commitInsts();
793 } else {
794#if ISA_HAS_DELAY_SLOT
795 skidInsert();
796#endif
797 }
798
799 //Check for any activity
800 threads = (*activeThreads).begin();
801
802 while (threads != (*activeThreads).end()) {
803 unsigned tid = *threads++;
804
805 if (changedROBNumEntries[tid]) {
806 toIEW->commitInfo[tid].usedROB = true;
807 toIEW->commitInfo[tid].freeROBEntries = rob->numFreeEntries(tid);
808
809 if (rob->isEmpty(tid)) {
810 toIEW->commitInfo[tid].emptyROB = true;

--- 286 unchanged lines hidden (view full) ---

1097 head_inst->traceData->setFetchSeq(head_inst->seqNum);
1098 head_inst->traceData->setCPSeq(thread[tid]->numInst);
1099 head_inst->traceData->finalize();
1100 head_inst->traceData = NULL;
1101 }
1102
1103 // Update the commit rename map
1104 for (int i = 0; i < head_inst->numDestRegs(); i++) {
1105 renameMap[tid]->setEntry(head_inst->flattenedDestRegIdx(i),
1106 head_inst->renamedDestRegIdx(i));
1107 }
1108
1109 if (head_inst->isCopy())
1110 panic("Should not commit any copy instructions!");
1111
1112 // Finally clear the head ROB entry.
1113 rob->retireHead(tid);

--- 130 unchanged lines hidden (view full) ---

1244 }
1245 }
1246}
1247
1248template <class Impl>
1249bool
1250DefaultCommit<Impl>::robDoneSquashing()
1251{
1252 std::list<unsigned>::iterator threads = (*activeThreads).begin();
1253
1254 while (threads != (*activeThreads).end()) {
1255 unsigned tid = *threads++;
1256
1257 if (!rob->isDoneSquashing(tid))
1258 return false;
1259 }
1260
1261 return true;
1262}

--- 62 unchanged lines hidden (view full) ---

1325
1326 case OldestReady:
1327 return oldestReady();
1328
1329 default:
1330 return -1;
1331 }
1332 } else {
1333 int tid = (*activeThreads).front();
1334
1335 if (commitStatus[tid] == Running ||
1336 commitStatus[tid] == Idle ||
1337 commitStatus[tid] == FetchTrapPending) {
1338 return tid;
1339 } else {
1340 return -1;
1341 }

--- 30 unchanged lines hidden (view full) ---

1372
1373template<class Impl>
1374int
1375DefaultCommit<Impl>::oldestReady()
1376{
1377 unsigned oldest = 0;
1378 bool first = true;
1379
1380 std::list<unsigned>::iterator threads = (*activeThreads).begin();
1381
1382 while (threads != (*activeThreads).end()) {
1383 unsigned tid = *threads++;
1384
1385 if (!rob->isEmpty(tid) &&
1386 (commitStatus[tid] == Running ||
1387 commitStatus[tid] == Idle ||
1388 commitStatus[tid] == FetchTrapPending)) {
1389
1390 if (rob->isHeadReady(tid)) {

--- 19 unchanged lines hidden ---