|
gem5
v21.2.1.1
|
#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 () |
| const PCStateBase * | 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 inst_pc, const PCStateBase &target_pc, 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... | |
| gem5::branch_prediction::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 41 of file btb.cc.
References btb, DPRINTF, fatal, gem5::floorLog2(), gem5::ArmISA::i, idxMask, instShiftAmt, gem5::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 79 of file btb.cc.
References idxMask, instShiftAmt, log2NumThreads, and tagShiftAmt.
| const PCStateBase * gem5::branch_prediction::DefaultBTB::lookup | ( | Addr | instPC, |
| ThreadID | tid | ||
| ) |
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 116 of file btb.cc.
References btb, getIndex(), getTag(), numEntries, and valid().
Referenced by gem5::branch_prediction::BPredUnit::BTBLookup(), and gem5::branch_prediction::BPredUnit::predict().
| void gem5::branch_prediction::DefaultBTB::reset | ( | ) |
Definition at line 70 of file btb.cc.
References btb, gem5::ArmISA::i, and numEntries.
| void gem5::branch_prediction::DefaultBTB::update | ( | Addr | inst_pc, |
| const PCStateBase & | target_pc, | ||
| ThreadID | tid | ||
| ) |
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 134 of file btb.cc.
References btb, getIndex(), getTag(), and numEntries.
Referenced by gem5::branch_prediction::BPredUnit::BTBUpdate(), and gem5::branch_prediction::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 95 of file btb.cc.
References btb, getIndex(), getTag(), and numEntries.
Referenced by gem5::branch_prediction::BPredUnit::BTBValid(), lookup(), and gem5::branch_prediction::BPredUnit::predict().
|
private |
|
private |
|
private |
Number of bits to shift PC when calculating index.
Definition at line 123 of file btb.hh.
Referenced by DefaultBTB(), and getIndex().
|
private |
Log2 NumThreads used for hashing threadid.
Definition at line 129 of file btb.hh.
Referenced by getIndex().
|
private |
|
private |
The number of tag bits per entry.
Definition at line 117 of file btb.hh.
Referenced by DefaultBTB().
|
private |
|
private |
Number of bits to shift PC when calculating tag.
Definition at line 126 of file btb.hh.
Referenced by DefaultBTB(), getIndex(), and getTag().