Branch instruction prediction and skipping method using addresses of precedent instructions
AssigneeFaraday Technology Corp.
InventorHong-Men Su
Life of this patent
Estimating the term…
Abstract
A method of predicting branch instructions and a method of skipping branch instructions for pipelines which need more than one cycle to predict branch direction and branch target addresses in microprocessors and digital signal processors are provided. The address of an instruction executed before the predicted branch is used as an index to enable early branch prediction so that the address of the instruction predicted to be executed immediately after the branch is available earlier, thereby reducing the number of idle or wasted clock cycles.
Claims11
A method of predicting branch instruction, comprising:
- fetching and executing a current instruction;
- wherein if the current instruction is a branch instruction, an address of a previously executed precedent instruction is used as an index to record a related information required for prediction;
- using the address of the precedent instruction as an index for a prediction unit to search the related information so as to predict the target address of the branch instruction;
- and
- wherein if the related information exists and the predicted direction is taken, the predicted target address of the branch instruction is used to fetch the next instruction;
- otherwise, an address of the sequential instruction is used to fetch the next instruction.
A method of skipping branch instruction, comprising:
- fetching and executing a current instruction, wherein if the current instruction is an unconditional fixed-target branch instruction and a previous instruction immediately before the current instruction is not a branch instruction, an address of an nth previously executed instruction before the current instruction is used as an index to record a related information required for predicting, wherein n is a number of cycles required for a time period from receiving the index to the completion of predicting the branch direction and the target address of the branch instruction;
- and
- using the address of the nth previously executed instruction before the current instruction as an index to search the related information so as to predict the branch direction and the target address of the branch instruction, wherein if the related information exists and the prediction direction is taken, the predicted target address of the branch instruction is used to fetch the next instruction, otherwise, the address of the sequential instruction is used to fetch the next instruction.
Dependencies are inferred from the claim text.