There are two different approaches for expressing the history of branches as shown in the figure. In the explicit dynamic technique, branch history is explicitly stated in the form of history bits. The actual implementation of this technique using one, two, or three bits for expressing the history. The second approach is the implicit dynamic technique, in which branch history is implicitly stated by the existence of an entry for a predicted branch target access path.
1-bit dynamic prediction − This is the simplest dynamic technique. In a 1-bit prediction, a single bit per branch can define whether the final occurrence of the branch was taken or not. Accordingly, this technique maintains a straightforward two-state history (‘taken’ or ‘not-taken’) for several branches.
After evaluating the branches, its associated history is updated as a one-bit saturating counter. In this case, the prediction is the same as the last outcome of the associative branch. There are only a few processors which use the 1-bit dynamic prediction, such as the α21064 as an available option and the R8000 as one of the prediction technique used.
2-bit dynamic prediction − When multiple bits are available for recording the history of branches, a considerably longer branch history can be taken into account. This results in a better guess than in the case of a 1-bit prediction. A 2-bit prediction operates like a 4-state FSM (Finite State Machine). It is characterized by the declared states and by its state transition diagram.
3-bit prediction − In a 3-bit prediction, the result of the last three occurrences of the branch instruction is saved. For instance, if two of the last three-branch outcomes were taken, the guess will be ‘taken’. Subsequently, after the outcome of the branch becomes known, the corresponding entry is updated. This is done on a FIFO basis, writing a ‘0’ into the entry if the branch has not been taken or a ‘1’ if it has.
Implicit dynamic technique − This scheme will be used for accessing the branch target path. These are so-called BTAC (Branch Target Access Cache) and BTIC (Branch Target Instruction Cache) schemes.
The implicit prediction technique is a special kind of 1-bit prediction. At the same time, the implicit prediction is a specific variant of the BTAC or BTIC scheme. Its specialty is that for not-taken branches no entries are maintained in the BTAC or BTIC scheme. This type of entry management is more efficient than retaining entries for both taken and not-taken branches in a BTAC or BTIC.