# US 2010/0169627 A1 · System and method for repairing a speculative global history record

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2010/0169627 A1
- Document ID: US20100169627A1
- Status: Published application
- Kind: A1
- Application number: 12/722,220
- Filed: 2010-03-11
- Published: 2010-07-01
- Earliest claimed: 2007-11-13
- Assignees: Applied Micro Circuits Corporation
- Inventors: Timothy A. Olson; Terrence Matthew Potter; Jon A. Loschke
- Web page: https://patentgrep.com/patent/US20100169627A1

## CPC

- G06F 9/3806: {using address prediction, e.g. return stack, branch history buffer}
- G06F 9/3848: {using hybrid branch prediction, e.g. selection between prediction techniques}
- G06F 9/3863: {using multiple copies of the architectural state, e.g. shadow registers}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system and method are provided for updating a speculative global history prediction record in a microprocessor system using pipelined instruction processing. The method accepts microprocessor instructions with consecutive operations, including a conditional branch operation with an associated first branch address. A speculative global history record (SGHR) of conditional branch resolutions and predictions is accessed and hashed with the first branch address, creating a first hash result. The first hash result is used to index a branch history table (BHT) of previous first branch resolutions. As a result, a first branch prediction is made, and the SGHR is updated with the first branch prediction. A non-speculative global history record (NSGHR) of branch resolutions is updated with the resolution of the first branch operation, and if the first branch prediction is incorrect, the SGHR is corrected using the NSGHR.

## Claims

### Claim at position 1

1-23. (canceled)

### Claim 24

In a microprocessor system using pipelined instruction processing, a method for repairing a speculative global history prediction record, the method comprising:
accepting a first microprocessor instruction of consecutive operations, including a first conditional branch operation with an associated first branch address, at a first stage in a pipelined microprocessor execution process;
making a first branch prediction in response to using a speculative global history record (SGHR) of conditional branch resolutions and predictions, and a branch history table (BHT) of pervious first conditional branch resolutions;
resolving the first conditional branch operation; and,
in response to the first branch prediction being incorrect, correcting the SGHR using the non-speculative global history record.

### Claim 25 (depends on 24)

The method of claim 24 further comprising:
updating a non-speculative global history record (NSGHR) of branch resolutions with the resolution of the first conditional branch operation; and,
wherein correcting the speculative global history record includes copying a value from the non-speculative global history record into the speculative global history record.

### Claim 26 (depends on 25)

The method of claim 25 wherein updating the non-speculative global history record of branch resolutions includes entering a value representing the first branch resolution into a non-speculative global history shift register.

### Claim 27 (depends on 24)

The method of claim 24 further comprising:
in response to the first branch prediction being incorrect, flushing subsequently accepted microprocessor instructions that were processed in dependence upon the first branch prediction in the speculative global history record.

### Claim 28 (depends on 24)

The method of claim 24 wherein making the first branch prediction in response to using the SGHR and the BHT includes:
accessing the SGHR;
hashing the speculative global history record with the first conditional branch address, creating a first hash result;
using the first hash result to index the BHT; and,
in response to indexing the BHT, making the first branch prediction.

### Claim 29 (depends on 28)

The method of claim 28 further comprising:
updating the speculative global history record with the first branch prediction.

### Claim 30 (depends on 29)

The method of claim 29 wherein updating the speculative global history record with the first branch prediction includes entering a value representing the first branch prediction into a speculative global history shift register.

### Claim 31 (depends on 28)

The method of claim 28 wherein hashing the speculative global history record with the first branch address includes performing an exclusive-OR (XOR) operation between a value representing the speculative global history record and a value representing the first branch address.

### Claim 32 (depends on 28)

The method of claim 28 wherein using the first hash result to index the BHT includes indexing a count of the n-most recent first branch resolutions.

### Claim 33 (depends on 28)

The method of claim 28 further comprising:
updating the BHT with the first branch resolution.

### Claim 34 (depends on 33)

The method of claim 33 wherein updating the BHT with the first branch resolution includes:
incrementing the count in response to the first branch being taken, clamping the count to a maximum value of m=2n−1, where M and N are variables; and,
decrementing the count in response to the first branch not being taken, clamping the count to a minimum value of zero.

### Claim 35

A pipelined instruction microprocessor system with a repairable speculative global history prediction record, the system comprising:
a pipeline including a plurality of sequential stages for parallel processing microprocessor instructions, each microprocessor instruction including a plurality of consecutive operations, the pipeline including a first stage for processing a first conditional branch operation from a first microprocessor instruction;
a sequencer with an interface for accessing the pipelined stages and processing the operations;
a first address register containing a first branch address associated with the first conditional branch operation;
a speculative global history record (SGHR) to provide a first vector representing a combination of resolved branch decisions and predicted branch decisions executed immediately before the first conditional branch operation; and,
a non-speculative global history record (NSGHR) of branch resolutions having an input to accept a first branch resolution and an output for updating the SGHR in response to a first branch prediction being incorrect.

### Claim 36 (depends on 35)

The system of claim 35 wherein the pipeline flushes microprocessor instructions accepted subsequent to the first microprocessor instruction in response to the subsequently accepted microprocessor instructions being processed using the incorrect first branch prediction in the speculative global history.

### Claim 37 (depends on 35)

The system of claim 35 wherein the speculative global history record is a shift register.

### Claim 38 (depends on 35)

The system of claim 35 wherein the non-speculative global history record is a shift register.

### Claim 39 (depends on 35)

The system of claim 35 further comprising:
a hashing circuit having an input to accept the first vector from the SGHR and an input to accept the first branch address, the hashing circuit performing an exclusive-OR (XOR) operation between a value representing the first vector and a value representing the first branch address, to provide a first hash result at an output;
a branch history table (BHT) having an input to accept the first hash result, the BHT indexing previous first branch resolutions associated with the first hash result and providing the first branch prediction; and,
wherein the SGHR is updated with the first branch prediction.

### Claim 40 (depends on 39)

The system of claim 39 wherein the BHT includes a count of the n-most recent first branch resolutions.

### Claim 41 (depends on 39)

The system of claim 39 wherein the BHT increments the count in response to the first branch resolution being a branch taken and decrements the count in response to the first branch resolution being a branch not taken.

### Claim 42 (depends on 41)

The system of claim 41 wherein the BHT clamps the count to a maximum value of m=2n−1 and clamps the count to a minimum value of zero.

### Claim 43 (depends on 41)

The system of claim 41 wherein BHT first branch prediction indicates a degree of confidence in the assumption that the first branch is taken.
