gem5
|
#include <btb.hh>
Classes | |
struct | BTBEntry |
Public Member Functions | |
DefaultBTB (unsigned numEntries, unsigned tagBits, unsigned instShiftAmt, unsigned numThreads) | |
Creates a BTB with the given number of entries, number of bits per tag, and instruction offset amount. More... | |
void | reset () |
TheISA::PCState | lookup (Addr instPC, ThreadID tid) |
Looks up an address in the BTB. More... | |
bool | valid (Addr instPC, ThreadID tid) |
Checks if a branch is in the BTB. More... | |
void | update (Addr instPC, const TheISA::PCState &targetPC, ThreadID tid) |
Updates the BTB with the target of a branch. More... | |
Private Member Functions | |
unsigned | getIndex (Addr instPC, ThreadID tid) |
Returns the index into the BTB, based on the branch's PC. More... | |
Addr | getTag (Addr instPC) |
Returns the tag bits of a given address. More... | |
Private Attributes | |
std::vector< BTBEntry > | btb |
The actual BTB. More... | |
unsigned | numEntries |
The number of entries in the BTB. More... | |
unsigned | idxMask |
The index mask. More... | |
unsigned | tagBits |
The number of tag bits per entry. More... | |
unsigned | tagMask |
The tag mask. More... | |
unsigned | instShiftAmt |
Number of bits to shift PC when calculating index. More... | |
unsigned | tagShiftAmt |
Number of bits to shift PC when calculating tag. More... | |
unsigned | log2NumThreads |
Log2 NumThreads used for hashing threadid. More... | |
DefaultBTB::DefaultBTB | ( | unsigned | numEntries, |
unsigned | tagBits, | ||
unsigned | instShiftAmt, | ||
unsigned | numThreads | ||
) |
Creates a BTB with the given number of entries, number of bits per tag, and instruction offset amount.
numEntries | Number of entries for the BTB. |
tagBits | Number of bits for each tag in the BTB. |
instShiftAmt | Offset amount for instructions to ignore alignment. |
Definition at line 37 of file btb.cc.
References btb, DPRINTF, fatal, floorLog2(), ArmISA::i, idxMask, instShiftAmt, isPowerOf2(), numEntries, tagBits, tagMask, and tagShiftAmt.
Returns the index into the BTB, based on the branch's PC.
inst_PC | The branch to look up. |
Definition at line 75 of file btb.cc.
References idxMask, instShiftAmt, log2NumThreads, and tagShiftAmt.
Looks up an address in the BTB.
Must call valid() first on the address.
inst_PC | The address of the branch to look up. |
tid | The thread id. |
Definition at line 112 of file btb.cc.
References btb, getIndex(), getTag(), numEntries, and valid().
Referenced by BPredUnit::BTBLookup(), and BPredUnit::predict().
void DefaultBTB::reset | ( | ) |
Definition at line 66 of file btb.cc.
References btb, ArmISA::i, and numEntries.
Updates the BTB with the target of a branch.
inst_PC | The address of the branch being updated. |
target_PC | The target address of the branch. |
tid | The thread id. |
Definition at line 130 of file btb.cc.
References btb, getIndex(), getTag(), and numEntries.
Referenced by BPredUnit::BTBUpdate(), and BPredUnit::squash().
Checks if a branch is in the BTB.
inst_PC | The address of the branch to look up. |
tid | The thread id. |
Definition at line 91 of file btb.cc.
References btb, getIndex(), getTag(), and numEntries.
Referenced by BPredUnit::BTBValid(), lookup(), and BPredUnit::predict().
|
private |
|
private |
|
private |
Number of bits to shift PC when calculating index.
Definition at line 124 of file btb.hh.
Referenced by DefaultBTB(), and getIndex().
|
private |
Log2 NumThreads used for hashing threadid.
Definition at line 130 of file btb.hh.
Referenced by getIndex().
|
private |
|
private |
The number of tag bits per entry.
Definition at line 118 of file btb.hh.
Referenced by DefaultBTB().
|
private |
|
private |
Number of bits to shift PC when calculating tag.
Definition at line 127 of file btb.hh.
Referenced by DefaultBTB(), getIndex(), and getTag().