Patent ID: 6385720
Filing Date: 2002-05-07
Classification: G06F

Abstract:
A branch prediction method comprising a first step wherein the result of branch by a branch instruction is recorded as history information in correspondence with the relative position of said instruction from an origin, and a second step wherein the result of branch by the next branch instruction is predicted by referring to said history information on the basis of the relative position of a pre-decoded instruction from said origin when said next branch instruction is pre-decoded before execution, wherein:said first step comprises an origin position storing step for storing the position of said instruction located at said origin, an execution decoding step for decoding an instruction for execution, an instruction position obtaining step for obtaining the relative position of said instruction decoded for execution on the basis of said position of said instruction stored by said origin position storing step, and a history recording step for recording the result of branch by said branch instruction as history information in correspondence with said relative position of said branch instruction when said decoded instruction is a branch instruction, said second step comprises a pre-decoding step for pre-decoding said instruction before said instruction is executed next time, a preceding instruction position obtaining step for obtaining said relative position of said pre-decoded instruction on the basis of said position of said instruction stored by said origin position storing step, a history reference step for referring to said history information corresponding to said relative position of said pre-decoded branch instruction when said instruction is a branch instruction, and a prediction step for predicting the result of the execution of said pre-decoded branch instruction by using the result of said reference to said history information, said instruction position obtaining step comprises a step for obtaining the number of instructions by counting the number of said instructions found to be branch instructions by decoding for execution, and said preceding instruction position obtaining step comprises a step for obtaining the number of instructions by counting said instructions found to be branch instructions by pre-decoding.