|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmars.tools.BHTEntry
public class BHTEntry
Represents a single entry of the Branch History Table.
The entry holds the information about former branch predictions and outcomes.
The number of past branch outcomes can be configured and is called the history.
The semantics of the history of size n is as follows.
The entry will change its prediction, if it mispredicts the branch n times in series.
The prediction of the entry can be obtained by the getPrediction()
method.
Feedback of taken or not taken branches is provided to the entry via the updatePrediction(boolean)
method.
This causes the history and the prediction to be updated.
Additionally the entry keeps track about how many times the prediction was correct or incorrect.
The statistics can be obtained by the methods getStatsPredCorrect()
, getStatsPredIncorrect()
and getStatsPredPrecision()
.
Constructor Summary | |
---|---|
BHTEntry(int historySize,
boolean initVal)
Constructs a BHT entry with a given history size. |
Method Summary | |
---|---|
String |
getHistoryAsStr()
Builds a string representation of the BHT entry's history. |
boolean |
getPrediction()
Returns the branch prediction based on the history. |
String |
getPredictionAsStr()
Returns a string representation of the BHT entry's current prediction. |
int |
getStatsPredCorrect()
Get the absolute number of correct predictions. |
int |
getStatsPredIncorrect()
Get the absolute number of mispredictions. |
double |
getStatsPredPrecision()
Get the percentage of correct predictions. |
void |
updatePrediction(boolean branchTaken)
Updates the entry's history and prediction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BHTEntry(int historySize, boolean initVal)
historySize
- number of past branch outcomes to rememberinitVal
- the initial value of the entry (take or do not take)Method Detail |
---|
public boolean getPrediction()
public void updatePrediction(boolean branchTaken)
branchTaken
- signals if the branch was taken (true) or not (false)public int getStatsPredIncorrect()
public int getStatsPredCorrect()
public double getStatsPredPrecision()
public String getHistoryAsStr()
public String getPredictionAsStr()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |