How to handle unresolved conditional branch processing policies in computer architecture?

Computer ArchitectureComputer ScienceNetwork

A conditional branch cannot be computed earlier than the referenced conditional is known. For instance, if the specified condition defines the sign of the outcome of the previous instruction, the precondition of the computation is that the previous instruction has been performed.

Until the referenced condition will become known, the conditional branch is stated to unresolved. There are three basic elements utilized by processors to cope with unresolved conditional branches such as blocking branch processing, speculative execution, and multiway branching, as shown in the figure −

Blocking branch processing is the trivial element to cope with unresolved conditional branches. Execution of the conditional branch is interrupted just before the determined condition can be resolved. Early pipelined microprocessors such as the MC 68020, MC 68030, and 80386 are examples of blocking branch processing. This approach causes long penalties due to pipeline stalling as shown in the table. Therefore advanced processors employ a more favorable policy, called speculative execution.

Branch penalties in blocking branch processing

Processor typeTaken Penalty CyclesNot-taken penalty cycles
MC 68020 (1984)53
MC 68030 (1987)53
80386 (1985)82

With speculative branch processing pipeline interrupt because of the unresolved branch, conditions are prevented. After detection of an unresolved conditional branch, a guess is built as to the result of the condition, and execution remains speculatively along the guessed path.

As shown in the diagram, speculative execution contains three key elements such as the branch prediction scheme used, the extent of speculative execution, and the recovery scheme used in the case of a misprediction.

The branch prediction can be fixed or a true prediction. In a fixed prediction a similar guess is continually made, either ‘taken’ or ‘not-taken’. A true prediction has two possible outcomes, either ‘taken’ or ‘not-taken’ (fall through, sequential path).

In speculative execution, a processor continues to implement instructions speculatively until the condition is determined. But, the time interval between the beginning of the conditional execution and the resolution of the equivalent condition can change significantly.

In the case of misprediction, there are two basic elements to be implemented such as the discard the outcome of the speculative execution and continue the execution of the other, such as the correct path. When there is higher than one pending conditional branch, the corresponding alternative path should be chosen and followed.

Finally, multiway branching is the most enthusiastic scheme to cope with unresolved conditional branches. Therefore, in the case of an unresolved conditional branch, both achievable paths are followed. When the particularized condition is computed the right path is persistent. This path is accepted and the improper path is removed.

Published on 23-Jul-2021 08:14:50