IP Library Granted Patent US 10,209,992
Granted Patent B2
US 10,209,992 · App. 14/530,038 · Granted Feb 19, 2019

System and method for branch prediction using two branch history tables and presetting a global branch history register

Inventors: Sophie Wilson (Cambridge, GB); Geoffrey Barrett (Bristol, GB)
Assignee: Avago Technologies International Sales Pte. Limited
G06F9/3806G06F9/3844G06F9/3848
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,209,992
App. No.
14/530,038
Granted
Feb 19, 2019
Kind
B2
Abstract

A method and system for branch prediction are provided herein. The method includes executing a program, wherein the program comprising multiple procedures, and setting bits in a taken branch history register to indicate whether a branch is taken or not taken during execution of instructions in the program. The method further includes the steps of calling a procedure in the program and overwriting, responsive to calling the procedure, the contents of the taken branch history register to a start address for the procedure.

Claims (57)

1. A method, comprising:

providing a program to be executed in accordance with a speculative address;

executing the program, the program comprising a procedure;

setting bits in a taken branch history register to indicate whether a branch is taken or not taken during execution of instructions in the program;

calling the procedure in the program; and

overwriting, responsive to calling the procedure, contents of the taken branch history register to a start address for the procedure;

accessing, using a hash block, a first branch history table based on contents of the taken branch history register for a first prediction of whether a current branch will be taken or not taken;

accessing, using the hash block, a second branch history table based on the contents of the taken branch history register for a second prediction of whether the current branch will be taken or not taken; and

determining whether the first prediction or the second prediction is used based on whether a selection value in a selection entry of a selector table is equal to or greater than a threshold value.

2. The method of claim 1 , wherein accessing the first branch history table further comprises:

accessing the first branch history table based on the contents of the taken branch history register and a program counter register.

3. The method of claim 2 , wherein accessing the first branch history table further comprises:

generating an index based on the contents of the taken branch history register and the program counter register to access an entry in the first branch history table, wherein the entry includes the first prediction.

4. The method of claim 3 , wherein generating the index further comprises:

hashing the contents of the taken branch history register to produce a result having a number of bits that is less than a number of bits in the taken branch history register.

5. The method of claim 2 , further comprising:

accessing the second branch history table based on the contents of the taken branch history register and the program counter register, wherein the first branch history table has more entries than the second branch history table.

6. The method of claim 5 , wherein accessing the second branch history table further comprises:

generating an index based on the contents of the taken branch history register and the program counter register to access an entry in the second branch history table, wherein the entry includes the second prediction.

7. The method of claim 6 , wherein generating the index further comprises:

hashing contents of the program counter register to produce a result having a number of bits that is less than a number of bits in the program counter register.

8. The method of claim 7 , further comprising:

using the index to access the selection entry in the selection table.

9. The method of claim 6 , further comprising:

using the index to access an update entry in an update table that stores an update value that indicates whether the first branch history table or the second branch history table is more accurate in a prediction of whether the branch will be taken, and

suppressing updating a prediction value, corresponding to the branch, in the first branch history table based on the update value indicating that the second branch history table is more accurate than the first branch history table in the prediction of whether the branch is taken.

10. The method of claim 1 , wherein the procedure comprises:

a section of code within the program that is accessed upon execution of a call instruction and has an instruction that returns program execution to a next instruction after the call instruction.

11. An apparatus, comprising:

an instruction cache; and

a branch prediction unit configured to supply a speculative address to the instruction cache, the branch prediction unit comprising:

a taken branch history register configured to store bits that indicate whether a branch is taken during execution of instructions in a program, wherein the program includes a procedure;

a preset circuit configured to overwrite contents of the taken branch history register to a start address for the procedure;

a first branch history table including a first prediction of whether a current branch will be taken or not taken;

a second branch history table including a second prediction of whether the current branch will be taken or not taken;

a selector table including a selection value in a selection entry; and

a hash block configured to determine whether the first prediction or the second prediction is used based on whether the selection value is equal to or greater than a threshold value.

12. The apparatus of claim 11 , wherein the hash block is further configured to access an entry in the first branch history table based on the contents of the taken branch history register and a program counter register.

13. The apparatus of claim 12 , wherein the hash block is further configured to generate an index based on the contents of the taken branch history register and the program counter register to access the entry in the first branch history table, wherein the entry includes the first prediction.

14. The apparatus of claim 13 , wherein the hash block is further configured to generate the index by hashing the contents of the taken branch history register to produce a result having a number of bits that is less than a number of bits in the taken branch history register.

15. The apparatus of claim 12 , wherein the hash block is further configured to access the second branch history table based on the contents of the taken branch history register and the program counter register.

16. The apparatus of claim 15 , wherein the hash block is further configured to generate an index based on the contents of the taken branch history register and the program counter register to access an entry in the second branch history table that includes the second prediction.

17. The apparatus of claim 16 , wherein the hash block is further configured to generate the index by hashing contents of the program counter register to produce a result having a number of bits that is less than a number of bits in the program counter register.

18. The apparatus of claim 17 , wherein the hash block is further configured to use the index to access an entry in the selection table.

19. The apparatus of claim 18 , further comprising:

an update table, wherein the hash block is configured to access an update entry in an update table that stores an update value that indicates whether the first branch history table or the second branch history table is more accurate in a prediction of whether the current branch will be taken, and

logic circuits configured to suppress an update of a prediction value, corresponding to the current branch, in the first branch history table based on the update value indicating that the second branch history table is more accurate than the first branch history table in the prediction of whether the current branch is taken.

20. The apparatus of claim 11 , wherein the procedure comprises:

a section of code within the program that is accessed upon execution of a call instruction; and

an instruction that returns program execution to a next instruction after the call instruction.

21. An apparatus, comprising:

a taken branch history register configured to store bits that indicate whether a branch is taken during execution of instructions in a program, wherein the program includes a procedure;

a preset circuit configured to overwrite contents of the taken branch history register to a start address for the procedure;

a first branch history table including a first prediction of whether a current branch will be taken or not taken;

a second branch history table including a second prediction of whether the current branch will be taken or not taken;

a selector table including a selection value in a selection entry; and

a hash block configured to determine whether the first prediction or the second prediction is used based on whether the selection value is equal to or greater than a threshold value.

Assignments (6)
CORRECTIVE ASSIGNMENT TO CORRECT THE EXECUTION DATE OF THE MERGER AND APPLICATION NOS. 13/237,550 AND 16/103,107 FROM THE MERGER PREVIOUSLY RECORDED ON REEL 047231 FRAME 0369. ASSIGNOR(S) HEREBY CONFIRMS THE MERGER. Recorded Mar 8, 2019
From: AVAGO TECHNOLOGIES GENERAL IP (SINGAPORE) PTE. LTD.
To: AVAGO TECHNOLOGIES INTERNATIONAL SALES PTE. LIMITED
Reel/Frame 048549/0113 →
MERGER Recorded Oct 4, 2018
From: AVAGO TECHNOLOGIES GENERAL IP (SINGAPORE) PTE. LTD.
To: AVAGO TECHNOLOGIES INTERNATIONAL SALES PTE. LIMITED
Reel/Frame 047231/0369 →
TERMINATION AND RELEASE OF SECURITY INTEREST IN PATENTS Recorded Feb 3, 2017
From: BANK OF AMERICA, N.A., AS COLLATERAL AGENT
To: BROADCOM CORPORATION
Reel/Frame 041712/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 1, 2017
From: BROADCOM CORPORATION
To: AVAGO TECHNOLOGIES GENERAL IP (SINGAPORE) PTE. LTD.
Reel/Frame 041706/0001 →
PATENT SECURITY AGREEMENT Recorded Feb 11, 2016
From: BROADCOM CORPORATION
To: BANK OF AMERICA, N.A., AS COLLATERAL AGENT
Reel/Frame 037806/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 31, 2014
From: WILSON, SOPHIE; BARRETT, GEOFFREY
To: BROADCOM CORPORATION
Reel/Frame 034083/0336 →
Continuity (2)
Provisional Application 61984711 · Apr 25, 2014
Related Publication 20150309794A1 · Oct 29, 2015