commit_impl.hh (3957:37329de528a9) commit_impl.hh (3970:d54945bab95d)
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
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()) {
390 std::list<unsigned>::iterator threads = activeThreads->begin();
391 std::list<unsigned>::iterator end = activeThreads->end();
392
393 while (threads != end) {
392 unsigned tid = *threads++;
394 unsigned tid = *threads++;
395
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
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
419 std::list<unsigned>::iterator threads = (*activeThreads).begin();
422 std::list<unsigned>::iterator threads = activeThreads->begin();
423 std::list<unsigned>::iterator end = activeThreads->end();
420
424
421 while (threads != (*activeThreads).end()) {
425 while (threads != 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{
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{
442 std::list<unsigned>::iterator threads = (*activeThreads).begin();
446 std::list<unsigned>::iterator threads = activeThreads->begin();
447 std::list<unsigned>::iterator end = activeThreads->end();
443
448
444 while (threads != (*activeThreads).end()) {
449 while (threads != end) {
445 unsigned tid = *threads++;
446
447 if (changedROBNumEntries[tid]) {
448 return true;
449 }
450 }
451
452 return false;

--- 106 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
450 unsigned tid = *threads++;
451
452 if (changedROBNumEntries[tid]) {
453 return true;
454 }
455 }
456
457 return false;

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

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

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

593 }
594 }
595 }
596
597 commit();
598
599 markCompletedInsts();
600
595 threads = (*activeThreads).begin();
601 threads = activeThreads->begin();
596
602
597 while (threads != (*activeThreads).end()) {
603 while (threads != 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 ////////////////////////////////////
604 unsigned tid = *threads++;
605
606 if (!rob->isEmpty(tid) && rob->readHeadInst(tid)->readyToCommit()) {
607 // The ROB has more instructions it can commit. Its next status
608 // will be active.
609 _nextStatus = Active;
610
611 DynInstPtr inst = rob->readHeadInst(tid);

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

693 }
694 }
695
696#endif // FULL_SYSTEM
697
698 ////////////////////////////////////
699 // Check for any possible squashes, handle them first
700 ////////////////////////////////////
695 std::list<unsigned>::iterator threads = (*activeThreads).begin();
701 std::list<unsigned>::iterator threads = activeThreads->begin();
702 std::list<unsigned>::iterator end = activeThreads->end();
696
703
697 while (threads != (*activeThreads).end()) {
704 while (threads != 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) {

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

797 commitInsts();
798 } else {
799#if ISA_HAS_DELAY_SLOT
800 skidInsert();
801#endif
802 }
803
804 //Check for any activity
705 unsigned tid = *threads++;
706
707 // Not sure which one takes priority. I think if we have
708 // both, that's a bad sign.
709 if (trapSquash[tid] == true) {
710 assert(!tcSquash[tid]);
711 squashFromTrap(tid);
712 } else if (tcSquash[tid] == true) {

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

804 commitInsts();
805 } else {
806#if ISA_HAS_DELAY_SLOT
807 skidInsert();
808#endif
809 }
810
811 //Check for any activity
805 threads = (*activeThreads).begin();
812 threads = activeThreads->begin();
806
813
807 while (threads != (*activeThreads).end()) {
814 while (threads != end) {
808 unsigned tid = *threads++;
809
810 if (changedROBNumEntries[tid]) {
811 toIEW->commitInfo[tid].usedROB = true;
812 toIEW->commitInfo[tid].freeROBEntries = rob->numFreeEntries(tid);
813
814 if (rob->isEmpty(tid)) {
815 toIEW->commitInfo[tid].emptyROB = true;

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

966 head_inst->isStoreConditional() ||
967 head_inst->isMemBarrier() ||
968 head_inst->isWriteBarrier()) {
969
970 DPRINTF(Commit, "Encountered a barrier or non-speculative "
971 "instruction [sn:%lli] at the head of the ROB, PC %#x.\n",
972 head_inst->seqNum, head_inst->readPC());
973
815 unsigned tid = *threads++;
816
817 if (changedROBNumEntries[tid]) {
818 toIEW->commitInfo[tid].usedROB = true;
819 toIEW->commitInfo[tid].freeROBEntries = rob->numFreeEntries(tid);
820
821 if (rob->isEmpty(tid)) {
822 toIEW->commitInfo[tid].emptyROB = true;

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

973 head_inst->isStoreConditional() ||
974 head_inst->isMemBarrier() ||
975 head_inst->isWriteBarrier()) {
976
977 DPRINTF(Commit, "Encountered a barrier or non-speculative "
978 "instruction [sn:%lli] at the head of the ROB, PC %#x.\n",
979 head_inst->seqNum, head_inst->readPC());
980
974#if !FULL_SYSTEM
975 // Hack to make sure syscalls/memory barriers/quiesces
976 // aren't executed until all stores write back their data.
977 // This direct communication shouldn't be used for
978 // anything other than this.
981 // Hack to make sure syscalls/memory barriers/quiesces
982 // aren't executed until all stores write back their data.
983 // This direct communication shouldn't be used for
984 // anything other than this.
979 if (inst_num > 0 || iewStage->hasStoresToWB())
980#else
981 if ((head_inst->isMemBarrier() || head_inst->isWriteBarrier() ||
982 head_inst->isQuiesce()) &&
983 iewStage->hasStoresToWB())
985 if ((head_inst->isMemBarrier() || head_inst->isWriteBarrier() ||
986 head_inst->isQuiesce()) &&
987 iewStage->hasStoresToWB())
984#endif
985 {
986 DPRINTF(Commit, "Waiting for all stores to writeback.\n");
987 return false;
988 {
989 DPRINTF(Commit, "Waiting for all stores to writeback.\n");
990 return false;
991 } else if (inst_num > 0 || iewStage->hasStoresToWB()) {
992 DPRINTF(Commit, "Waiting to become head of commit.\n");
993 return false;
988 }
989
990 toIEW->commitInfo[tid].nonSpecSeqNum = head_inst->seqNum;
991
992 // Change the instruction so it won't try to commit again until
993 // it is executed.
994 head_inst->clearCanCommit();
995

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

1249 }
1250 }
1251}
1252
1253template <class Impl>
1254bool
1255DefaultCommit<Impl>::robDoneSquashing()
1256{
994 }
995
996 toIEW->commitInfo[tid].nonSpecSeqNum = head_inst->seqNum;
997
998 // Change the instruction so it won't try to commit again until
999 // it is executed.
1000 head_inst->clearCanCommit();
1001

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

1255 }
1256 }
1257}
1258
1259template <class Impl>
1260bool
1261DefaultCommit<Impl>::robDoneSquashing()
1262{
1257 std::list<unsigned>::iterator threads = (*activeThreads).begin();
1263 std::list<unsigned>::iterator threads = activeThreads->begin();
1264 std::list<unsigned>::iterator end = activeThreads->end();
1258
1265
1259 while (threads != (*activeThreads).end()) {
1266 while (threads != end) {
1260 unsigned tid = *threads++;
1261
1262 if (!rob->isDoneSquashing(tid))
1263 return false;
1264 }
1265
1266 return true;
1267}

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

1330
1331 case OldestReady:
1332 return oldestReady();
1333
1334 default:
1335 return -1;
1336 }
1337 } else {
1267 unsigned tid = *threads++;
1268
1269 if (!rob->isDoneSquashing(tid))
1270 return false;
1271 }
1272
1273 return true;
1274}

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

1337
1338 case OldestReady:
1339 return oldestReady();
1340
1341 default:
1342 return -1;
1343 }
1344 } else {
1338 int tid = (*activeThreads).front();
1345 assert(!activeThreads->empty());
1346 int tid = activeThreads->front();
1339
1340 if (commitStatus[tid] == Running ||
1341 commitStatus[tid] == Idle ||
1342 commitStatus[tid] == FetchTrapPending) {
1343 return tid;
1344 } else {
1345 return -1;
1346 }

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

1377
1378template<class Impl>
1379int
1380DefaultCommit<Impl>::oldestReady()
1381{
1382 unsigned oldest = 0;
1383 bool first = true;
1384
1347
1348 if (commitStatus[tid] == Running ||
1349 commitStatus[tid] == Idle ||
1350 commitStatus[tid] == FetchTrapPending) {
1351 return tid;
1352 } else {
1353 return -1;
1354 }

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

1385
1386template<class Impl>
1387int
1388DefaultCommit<Impl>::oldestReady()
1389{
1390 unsigned oldest = 0;
1391 bool first = true;
1392
1385 std::list<unsigned>::iterator threads = (*activeThreads).begin();
1393 std::list<unsigned>::iterator threads = activeThreads->begin();
1394 std::list<unsigned>::iterator end = activeThreads->end();
1386
1395
1387 while (threads != (*activeThreads).end()) {
1396 while (threads != end) {
1388 unsigned tid = *threads++;
1389
1390 if (!rob->isEmpty(tid) &&
1391 (commitStatus[tid] == Running ||
1392 commitStatus[tid] == Idle ||
1393 commitStatus[tid] == FetchTrapPending)) {
1394
1395 if (rob->isHeadReady(tid)) {

--- 19 unchanged lines hidden ---
1397 unsigned tid = *threads++;
1398
1399 if (!rob->isEmpty(tid) &&
1400 (commitStatus[tid] == Running ||
1401 commitStatus[tid] == Idle ||
1402 commitStatus[tid] == FetchTrapPending)) {
1403
1404 if (rob->isHeadReady(tid)) {

--- 19 unchanged lines hidden ---