Deleted Added
sdiff udiff text old ( 13454:19a5b4fb1f1f ) new ( 13455:56e25a5f9603 )
full compact
1/*
2 * Copyright (c) 2014 The University of Wisconsin
3 *
4 * Copyright (c) 2006 INRIA (Institut National de Recherche en
5 * Informatique et en Automatique / French National Research Institute
6 * for Computer Science and Applied Mathematics)
7 *
8 * All rights reserved.

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

343 bi->longestMatchPred =
344 gtable[bi->hitBank][tableIndices[bi->hitBank]].ctr >= 0;
345 bi->pseudoNewAlloc =
346 abs(2 * gtable[bi->hitBank][bi->hitBankIndex].ctr + 1) <= 1;
347
348 //if the entry is recognized as a newly allocated entry and
349 //useAltPredForNewlyAllocated is positive use the alternate
350 //prediction
351 if ((useAltPredForNewlyAllocated < 0) || ! bi->pseudoNewAlloc) {
352 bi->tagePred = bi->longestMatchPred;
353 bi->provider = TAGE_LONGEST_MATCH;
354 } else {
355 bi->tagePred = bi->altTaken;
356 bi->provider = bi->altBank ? TAGE_ALT_MATCH
357 : BIMODAL_ALT_MATCH;
358 }
359 } else {
360 bi->altTaken = getBimodePred(pc, bi);
361 bi->tagePred = bi->altTaken;
362 bi->longestMatchPred = bi->altTaken;
363 bi->provider = BIMODAL_ONLY;
364 }
365 //end TAGE prediction
366
367 pred_taken = (bi->tagePred);
368 DPRINTF(Tage, "Predict for %lx: taken?:%d, tagePred:%d, altPred:%d\n",
369 branch_pc, pred_taken, bi->tagePred, bi->altTaken);
370 }
371 bi->branchPC = branch_pc;

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

388 squash(tid, taken, bp_history);
389 return;
390 }
391
392 int nrand = random_mt.random<int>(0,3);
393 if (bi->condBranch) {
394 DPRINTF(Tage, "Updating tables for branch:%lx; taken?:%d\n",
395 branch_pc, taken);
396 updateStats(taken, bi);
397 condBranchUpdate(branch_pc, taken, bi, nrand);
398 }
399 if (!squashed) {
400 delete bi;
401 }
402}
403
404void

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

601{
602 DPRINTF(Tage, "UnConditionalBranch: %lx\n", br_pc);
603 predict(tid, br_pc, false, bp_history);
604 updateHistories(tid, br_pc, true, bp_history);
605 assert(threadHistory[tid].gHist ==
606 &threadHistory[tid].globalHistory[threadHistory[tid].ptGhist]);
607}
608
609void
610TAGE::updateStats(bool taken, TageBranchInfo* bi)
611{
612 if (taken == bi->tagePred) {
613 // correct prediction
614 switch (bi->provider) {
615 case BIMODAL_ONLY: tageBimodalProviderCorrect++; break;
616 case TAGE_LONGEST_MATCH: tageLongestMatchProviderCorrect++; break;
617 case BIMODAL_ALT_MATCH: bimodalAltMatchProviderCorrect++; break;
618 case TAGE_ALT_MATCH: tageAltMatchProviderCorrect++; break;
619 }
620 } else {
621 // wrong prediction
622 switch (bi->provider) {
623 case BIMODAL_ONLY: tageBimodalProviderWrong++; break;
624 case TAGE_LONGEST_MATCH:
625 tageLongestMatchProviderWrong++;
626 if (bi->altTaken == taken) {
627 tageAltMatchProviderWouldHaveHit++;
628 }
629 break;
630 case BIMODAL_ALT_MATCH:
631 bimodalAltMatchProviderWrong++;
632 break;
633 case TAGE_ALT_MATCH:
634 tageAltMatchProviderWrong++;
635 break;
636 }
637
638 switch (bi->provider) {
639 case BIMODAL_ALT_MATCH:
640 case TAGE_ALT_MATCH:
641 if (bi->longestMatchPred == taken) {
642 tageLongestMatchProviderWouldHaveHit++;
643 }
644 }
645 }
646
647 switch (bi->provider) {
648 case TAGE_LONGEST_MATCH:
649 case TAGE_ALT_MATCH:
650 tageLongestMatchProvider[bi->hitBank]++;
651 tageAltMatchProvider[bi->altBank]++;
652 break;
653 }
654}
655
656void
657TAGE::regStats()
658{
659 BPredUnit::regStats();
660
661 tageLongestMatchProviderCorrect
662 .name(name() + ".tageLongestMatchProviderCorrect")
663 .desc("Number of times TAGE Longest Match is the provider and "
664 "the prediction is correct");
665
666 tageAltMatchProviderCorrect
667 .name(name() + ".tageAltMatchProviderCorrect")
668 .desc("Number of times TAGE Alt Match is the provider and "
669 "the prediction is correct");
670
671 bimodalAltMatchProviderCorrect
672 .name(name() + ".bimodalAltMatchProviderCorrect")
673 .desc("Number of times TAGE Alt Match is the bimodal and it is the "
674 "provider and the prediction is correct");
675
676 tageBimodalProviderCorrect
677 .name(name() + ".tageBimodalProviderCorrect")
678 .desc("Number of times there are no hits on the TAGE tables "
679 "and the bimodal prediction is correct");
680
681 tageLongestMatchProviderWrong
682 .name(name() + ".tageLongestMatchProviderWrong")
683 .desc("Number of times TAGE Longest Match is the provider and "
684 "the prediction is wrong");
685
686 tageAltMatchProviderWrong
687 .name(name() + ".tageAltMatchProviderWrong")
688 .desc("Number of times TAGE Alt Match is the provider and "
689 "the prediction is wrong");
690
691 bimodalAltMatchProviderWrong
692 .name(name() + ".bimodalAltMatchProviderWrong")
693 .desc("Number of times TAGE Alt Match is the bimodal and it is the "
694 "provider and the prediction is wrong");
695
696 tageBimodalProviderWrong
697 .name(name() + ".tageBimodalProviderWrong")
698 .desc("Number of times there are no hits on the TAGE tables "
699 "and the bimodal prediction is wrong");
700
701 tageAltMatchProviderWouldHaveHit
702 .name(name() + ".tageAltMatchProviderWouldHaveHit")
703 .desc("Number of times TAGE Longest Match is the provider, "
704 "the prediction is wrong and Alt Match prediction was correct");
705
706 tageLongestMatchProviderWouldHaveHit
707 .name(name() + ".tageLongestMatchProviderWouldHaveHit")
708 .desc("Number of times TAGE Alt Match is the provider, the "
709 "prediction is wrong and Longest Match prediction was correct");
710
711 tageLongestMatchProvider
712 .init(nHistoryTables + 1)
713 .name(name() + ".tageLongestMatchProvider")
714 .desc("TAGE provider for longest match");
715
716 tageAltMatchProvider
717 .init(nHistoryTables + 1)
718 .name(name() + ".tageAltMatchProvider")
719 .desc("TAGE provider for alt match");
720}
721
722TAGE*
723TAGEParams::create()
724{
725 return new TAGE(this);
726}