@@ -135,6 +135,7 @@ Commit::Commit(CPU *_cpu, branch_prediction::BPredUnit *_bp, const BaseO3CPUPara
135135 }, " CommitStuckCheckEvent" ),
136136 cpu (_cpu),
137137 bp(_bp),
138+ valuePred(params.valuePred),
138139 iewToCommitDelay(params.iewToCommitDelay),
139140 commitToIEWDelay(params.commitToIEWDelay),
140141 renameToROBDelay(params.renameToROBDelay),
@@ -294,6 +295,8 @@ Commit::CommitStats::CommitStats(CPU *cpu, Commit *commit)
294295 "Number of squash due to branch"),
295296 ADD_STAT(squashDueToOrderViolation, statistics::units::Count::get(),
296297 "Number of squash due to order violation"),
298+ ADD_STAT(squashDueToValuePrediction, statistics::units::Count::get(),
299+ "Number of squash due to value prediction"),
297300 ADD_STAT(squashDueToTrap, statistics::units::Count::get(),
298301 "Number of squash due to trap"),
299302 ADD_STAT(squashDueToTC, statistics::units::Count::get(),
@@ -691,6 +694,9 @@ Commit::squashAll(ThreadID tid)
691694 rob->squash (squashed_inst, tid);
692695 changedROBNumEntries[tid] = true ;
693696
697+ if (valuePred)
698+ valuePred->squash (squashed_inst);
699+
694700 // Send back the sequence number of the squashed instruction.
695701 toIEW->commitInfo [tid].doneSeqNum = squashed_inst;
696702 toIEW->commitInfo [tid].doneMemSeqNum = squashed_inst;
@@ -1034,6 +1040,11 @@ Commit::commit()
10341040 fromIEW->mispredictInst [tid]->pcState ().instAddr (),
10351041 fromIEW->squashedSeqNum [tid]);
10361042 stats.squashDueToBranch ++;
1043+ } else if (fromIEW->valuePredictionError [tid]) {
1044+ DPRINTF (Commit,
1045+ " [tid:%i] Squashing due to value prediction error [sn:%llu]\n " ,
1046+ tid, fromIEW->squashedSeqNum [tid]);
1047+ stats.squashDueToValuePrediction ++;
10371048 } else {
10381049 DPRINTF (Commit,
10391050 " [tid:%i] Squashing due to order violation [sn:%llu]\n " ,
@@ -1061,6 +1072,9 @@ Commit::commit()
10611072 rob->squash (squashed_inst, tid);
10621073 changedROBNumEntries[tid] = true ;
10631074
1075+ if (valuePred)
1076+ valuePred->squash (squashed_inst);
1077+
10641078 toIEW->commitInfo [tid].doneSeqNum = squashed_inst;
10651079 toIEW->commitInfo [tid].doneMemSeqNum = squashed_inst;
10661080
@@ -1815,6 +1829,25 @@ Commit::commitHead(const DynInstPtr &head_inst, unsigned inst_num)
18151829 if (head_inst->isHtmStart ())
18161830 iewStage->setLastRetiredHtmUid (tid, head_inst->getHtmTransactionUid ());
18171831
1832+ if (valuePred && head_inst->canLVP () && (inst_fault == NoFault)) {
1833+ valuepred::VPUpdateMetaData *updateMetaData = valuepred::
1834+ VPDataStructFactory::buildUpdateMetaData (valuePred->getValuePredictorType ());
1835+ updateMetaData->pc = head_inst->getPC ();
1836+ updateMetaData->seq_no = head_inst->seqNum ;
1837+ updateMetaData->actualValue = head_inst->actualValue ;
1838+ updateMetaData->isMisprediction = head_inst->vpMisprediction ;
1839+ valuePred->updateValuePredictor (updateMetaData);
1840+ valuePred->stats .VPsupported ++;
1841+ if (head_inst->vpResult .speculative ) {
1842+ valuePred->stats .VPpredicted ++;
1843+ if (!head_inst->vpMisprediction ) {
1844+ valuePred->stats .VPcorrected ++;
1845+ }
1846+ }
1847+
1848+ delete updateMetaData;
1849+ }
1850+
18181851 // Finally clear the head ROB entry.
18191852 rob->retireHead (tid);
18201853
0 commit comments