Electrical computers and digital processing systems: processing – Processing control – Branching
Reexamination Certificate
1998-12-02
2001-02-13
Chan, Eddie (Department: 2183)
Electrical computers and digital processing systems: processing
Processing control
Branching
C712S228000
Reexamination Certificate
active
06189091
ABSTRACT:
BACKGROUND OF THE INVENTION
1. Field of the Invention
This invention relates in general to the field of microprocessors, and more particularly to a method and apparatus for performing dynamic branch prediction by speculatively updating global branch history information.
2. Description of the Related Art Computer instructions are typically stored in successive addressable locations within a memory. When processed by a Central Processing Unit (CPU), the instructions are fetched from consecutive memory locations and executed. Each time an instruction is fetched from memory, a program counter within the CPU is incremented so that it contains the address of the next instruction in the sequence. This is the next sequential instruction pointer, or NSIP. Fetching of an instruction, incrementing of the program counter, and execution of the instruction continues linearly through memory until a program control instruction is encountered.
A program control instruction, when executed, changes the address in the program counter and causes the flow of control to be altered. In other words, program control instructions specify conditions for altering the contents of the program counter. The change in the value of the program counter as a result of the execution of a program control instruction causes a break in the sequence of instruction execution. This is an important feature in digital computers, as it provides control over the flow of program execution and a capability for branching to different portions of a program. Examples of program control instructions include Jump, Test and Jump conditionally, Call, and Return.
A Jump instruction causes the CPU to unconditionally change the contents of the program counter to a specific value, i.e., to the target address for the instruction where the program is to continue execution. A Test and Jump conditionally causes the CPU to test the contents of a status register, or possibly compare two values, and either continue sequential execution or jump to a new address, called the target address, based on the outcome of the test or comparison. A Call instruction causes the CPU to unconditionally jump to a new target address, but also saves the value of the program counter to allow the CPU to return to the program location it is leaving. A Return instruction causes the CPU to retrieve the value of the program counter that was saved by the last Call instruction, and return program flow back to the retrieved instruction address.
In early microprocessors, execution of program control instructions did not impose significant processing delays because such microprocessors were designed to execute only one instruction at a time. If the instruction being executed was a program control instruction, by the end of execution the microprocessor would know whether it should branch, and if it was supposed to branch, it would know the target address of the branch. Thus, whether the next instruction was sequential, or the result of a branch, it would be fetched and executed.
Modern microprocessors are not so simple. Rather, it is common for modern microprocessors to operate on several instructions at the same time, within different blocks or pipeline stages of the microprocessor. Hennessy and Patterson define pipelining as, “an implementation technique whereby multiple instructions are overlapped in execution.”
Computer Architecture: A Quantitative Approach,
2
nd
edition, by John L. Hennessy and David A. Patterson, Morgan Kaufmann Publishers, San Francisco, Calif., 1996. The authors go on to provide the following excellent illustration of pipelining:
A pipeline is like an assembly line. In an automobile assembly line, there are many steps, each contributing something to the construction of the car. Each step operates in parallel with the other steps, though on a different car. In a computer pipeline, each step in the pipeline completes a part of an instruction. Like the assembly line, different steps are completing different parts of the different instructions in parallel. Each of these steps is called a pipe stage or a pipe segment. The stages are connected one to the next to form a pipe—instructions enter at one end, progress through the stages, and exit at the other end, just as cars would in an assembly line.
Thus, as instructions are fetched, they are introduced into one end of the pipeline. They proceed through pipeline stages within a microprocessor until they complete execution. In such pipelined microprocessors it is often not known whether a branch instruction will alter program flow until it reaches a late stage in the pipeline. But, by this time, the microprocessor has already fetched other instructions and is executing them in earlier stages of the pipeline. If a branch causes a change in program flow, all of the instructions in the pipeline that followed the branch must be thrown out. In addition, the instruction specified by the target address of the branch instruction must be fetched. Throwing out the intermediate instructions, and fetching the instruction at the target address creates processing delays in such microprocessors.
To alleviate this delay problem, many pipelined microprocessors use branch prediction mechanisms in an early stage of the pipeline that predict the outcome of branch instructions, and then fetch subsequent instructions according to the branch prediction. Branch prediction schemes are commonly classified as either static or dynamic branch prediction schemes.
With a static branch predictor, the prediction remains the same for a given branch instruction throughout the entire execution of the program in which the branch instruction is contained. That is, if the static branch predictor predicts a given branch will be taken the first time the branch instruction is executed, the static branch predictor will predict the branch will be taken every time the branch instruction is executed throughout the execution of the program. Thus, the prediction made by a static branch predictor does not depend upon the dynamic behavior of the branch instruction.
In contrast, dynamic branch predictors keep a history of the outcome of branch instructions as a program executes and make predictions based upon the history. Dynamic branch predictors are effective because of the repetitive outcome patterns that branch instructions exhibit. Dynamic branch prediction implies that the prediction will change if the branch changes its behavior while the program is running. One time the branch instruction executes the dynamic branch predictor may predict the branch will be taken. But the next time the branch instruction executes, the dynamic branch predictor may predict the branch will not be taken, particularly if the branch was not taken the previous time.
Various dynamic branch prediction schemes have been proposed. See “A System Level Perspective on Branch Architecture Performance”, by Brad Calder, Dirk Grunwald and Joel Emer, from Proceedings of MICRO-28, Nov. 29-Dec. 1, 1995 at Ann Arbor, Mich. Also see “Alternative Implementations of Two-Level Adaptive Branch Prediction”, by Tse-Yu Yeh and Yale N. Patt, from
Proceedings of the
19
th
Annual Symposium on Computer Architecture,
ACM, New York, N.Y., 1992 incorporated by reference herein.
Perhaps the simplest dynamic branch prediction scheme is a simple array of one-bit storage elements, commonly referred to as a branch history table (BHT). The address of the branch instruction (or some portion thereof) whose outcome is being predicted is used to index into the BHT. The bit output by the BHT indicates the outcome of the last execution of the branch instruction (i.e., taken or not taken) and is used to predict the outcome of the current execution of the branch instruction. Each time the branch is executed, the BHT is updated with the outcome.
Improvements upon the simple scheme described have also been made. For example, a BHT may have more than one bit of history. Two-bit up-down saturating counters have been used as the contents of a BHT. Another improvement is commonly referred to as a Branch Target Buff
Col Gerard M.
Henry G. Glenn
Jain Dinesh K.
Chan Eddie
Davis E. Alan
Huffman James W.
IP First L.L.C.
Whitmore Stacy
LandOfFree
Apparatus and method for speculatively updating global... does not yet have a rating. At this time, there are no reviews or comments for this patent.
If you have personal experience with Apparatus and method for speculatively updating global..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Apparatus and method for speculatively updating global... will most certainly appreciate the feedback.
Profile ID: LFUS-PAI-O-2601848