Multi-layer reorder buffer

WO2024098080A3PCT designated stage expired Publication Date: 2024-11-14HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
PCT/US2024/017125
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-02-23
Publication Date
2024-11-14

AI Technical Summary

Technical Problem

Modern CPU designs face challenges in efficiently using chip space due to the redundancy in storing instruction addresses in reorder buffers (ROBs), leading to limited capacity and potential stalling of CPU operations when the ROB is full.

Method used

A multi-layer reorder buffer architecture that separates instruction addresses into base addresses and offsets, allowing for efficient storage by reusing existing base addresses and storing only offsets, along with pointers, thereby reducing redundant information and increasing capacity without increasing chip area or power consumption.

Benefits of technology

This approach enables a higher number of in-flight instructions to be stored within a given chip area, reducing power consumption and preventing CPU stalling by optimizing storage efficiency in the ROB.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US2024017125_14112024_PF_FP_ABST
    Figure US2024017125_14112024_PF_FP_ABST
Patent Text Reader

Abstract

An apparatus comprising a reorder buffer (ROB) and a controller in communication with the ROB. The controller is configured to access addresses of in-flight program instructions and dispatch the in-flight program instructions to the ROB in a program order. The controller is configured to search at least one location in the ROB for a base address of an in-flight instruction presently being dispatched. Responsive to a determination that the base address of the in-flight instruction presently being dispatched is already stored in the searched at least one location in the ROB the controller stores the offset of the instruction presently being dispatched but not the base address of the instruction presently being dispatched in the ROB. And the controller stores a pointer in the ROB in association with the offset. The pointer points to the already stored base address in the ROB.
Need to check novelty before this filing date? Find Prior Art

Description

MULTI-LAYER REORDER BUFFERInventorsSAI PRANEETH MADDURIMINGXUAN HESANG WOOK STEPHEN DOFANGPING LIUFIELD

[0001] The disclosure generally relates to reorder buffers in computing systems.BACKGROUND

[0002] Modern CPU cores are designed to execute multiple processor executable instructions (more briefly, “program instructions” or “instructions”) simultaneously to improve the performance. Instructions are fetched in a program order (“in-order”) from memory, executed out-of-order and retired in-order. The performance improvement comes from the out-of-order execution by allowing independent instructions to be executed while other instructions are blocked and waiting for events such as loading data from the memory. The in-order retirement of instructions guarantees correctness by enabling re-execution of instructions in the program order starting from the instruction causing an error. A reorder buffer (ROB) in modern CPU designs guarantees such in-order retirement by storing the memory addresses or PC (Program Counter) values of in-flight instructions being executed in the program order and using the ROB to re-fetch instructions to be re-executed.

[0003] The ROB is a hardware unit that typically has a fixed amount of storage to track the in-flight instructions. Modem CPUs have a limited amount of chip space for implementing the ROB. When the ROB is full, the entire CPU could be stalled until instructions retire from ROB to leave room for newly fetched instructions in ROB.BRIEF SUMMARY

[0004] According to one aspect of the present disclosure, an apparatus comprising a reorder buffer (ROB) is coupled to communicate with a controller. The controller is configured to access addresses of in-flight program instructions. The in-flight program instructions has a program order. Each instruction address has a first number of upper order bits that form a base address and a second number of lower order bits that form an offset. The number of bits in the addresses equals the first number plus the second number. The controller is configured to dispatch the in-flight program instructions to the ROB in the program order. The controller is configured to search at least one location in the ROB for the base address of an in-flight instruction presently being dispatched. Responsive to a determination that the base address of the in-flight instruction presently being dispatched is already stored in the searched at least one location in the ROB the controller stores the offset of the instruction presently being dispatched but not the base address of the instruction presently being dispatched in the ROB and stores a pointer in the ROB in association with the offset, wherein the pointer points to the already stored base address in the ROB.

[0005] Optionally, in any of the preceding aspects, the controller is further configured to: responsive to a determination that the base address of the in-flight instruction presently being dispatched is not already stored in the searched at least one location: store the base address of the in-flight instruction presently being dispatched in the ROB; store the offset of the in-flight instruction presently being dispatched in the ROB; and store a pointer in the ROB in association with the offset, wherein the pointer points to the base address stored in the ROB.

[0006] Optionally, in any of the preceding aspects, the ROB comprises a base address buffer having a first plurality of fields, each field of the first plurality of fields having a size equal to the first number of bits in the base address. And the ROB comprises an offset buffer having a second plurality of fields, each field of the second plurality of fields having a size equal to the second number of bits in the offset.

[0007] Optionally, in any of the preceding aspects the offset buffer further comprises a third plurality of fields. Each field of the third plurality of field has a size configured to hold a pointer to a field in the first plurality of fields.

[0008] Optionally, in any of the preceding aspects the base address buffer comprises a circular buffer and the controller is further configured to store the base addresses of the in-flight instructions in the circular buffer in the program order.

[0009] Optionally, in any of the preceding aspects the at least one location for which the controller searches for the base address of the in-flight instruction presently being dispatched contains the base address of an in-flight instruction that was dispatched immediately prior to the in-flight instruction presently being dispatched to the ROB.

[0010] Optionally, in any of the preceding aspects the base address buffer comprises a content addressable memory (CAM). The CAM has a plurality of entries with each CAM entry having one of the first plurality of fields and a count field. The controller is further configured to maintain a count in the count field of a particular entry of the CAM that indicates how many in-flight instructions stored in the ROB have the base address in the particular entry.

[0011] Optionally, in any of the preceding aspects the base address buffer comprises a content addressable memory (CAM). The CAM has a plurality of entries with each CAM entry having one of the first plurality of fields and a count field. The controller is further configured to increment a count in the count field of a particular entry of the CAM by 1 in response to the base address of a newly dispatched in-flight instruction matching the base address in the particular entry.

[0012] Optionally, in any of the preceding aspects the at least one location for which the controller searches for the base address of the instruction presently beingdispatched comprises all entries in the CAM that store a valid base address of an inflight instruction.

[0013] Optionally, in any of the preceding aspects the controller is further configured to access the offset from the ROB for a target instruction for which a program counter is to be determined. The controller is further configured to access the pointer associated with the offset for the target instruction. The pointer points to the base address of the target instruction. The controller is further configured to access the base address for the target instruction from the ROB. The controller is further configured to concatenate the base address for the target instruction with the offset for the target instruction to form a final program counter for the target instruction.

[0014] Optionally, in any of the preceding aspects the controller is further configured to determine whether the base address of a first program instruction being committed and the base address of a second program instruction that was committed immediately prior to the first program instruction match. The controller is further configured to free an entry in the ROB containing the base address of the second program instruction responsive to a determination that the base addresses of the first program instruction and the second program instruction do not match.

[0015] Optionally, in any of the preceding aspects the ROB comprises a unified structure having plurality of entries. The controller is further configured to store either a base address or alternatively an offset and program instruction information in an open entry in the unified structure. Each entry in the unified structure has a field that indicates whether the entry stores a base address or alternatively stores an offset and program instruction information.

[0016] Optionally, in any of the preceding aspects the at least one location for which the controller searches for the base address of the in-flight instruction presently being dispatched comprises all entries in the unified structure that store a valid base address of an in-flight program instruction stored in the ROB.

[0017] According to one other aspect of the present disclosure, there is provided a method for maintaining a reorder buffer (ROB). The method comprises accessing addresses of in-flight program instructions. The in-flight program instructions have aprogram order. Each instruction address has a first number of upper order bits that form a base address and a second number of lower order bits that form an offset. Each program instruction address has a number of bits equal to the first number plus the second number. The method comprises dispatching the in-flight program instructions to a ROB in the program order, including searching at least one location in the ROB for the base address of a first in-flight instruction presently being dispatched. Responsive to a determination that the base address of the first in-flight instruction is already stored in the searched at least one location in the ROB the method includes storing the offset of the first in-flight instruction but not the base address of the first instruction in the ROB; and storing a pointer in the ROB in association with the offset of the first in-flight instruction. The pointer points to the already stored base address in the ROB.

[0018] Optionally, in any of the preceding aspects dispatching the in-flight program instructions to the ROB in the program order further includes: responsive to a determination that the base address of a second in-flight instruction presently being dispatched is not already stored in the searched at least one location: storing the base address of the second in-flight instruction in the ROB; storing the offset of the second in-flight instruction in the ROB; and storing a pointer in the ROB in association with the offset of the second in-flight instruction, wherein the pointer points to the base address of the second in-flight instruction stored in the ROB.

[0019] Optionally, in any of the preceding aspects storing the base address of the second in-flight instruction presently being dispatched in the ROB comprises storing the base address of the second in-flight instruction presently being dispatched in an open entry in a first circular buffer. Storing the offset of the second in-flight instruction presently being dispatched in the ROB comprises storing the offset in an open entry in a second circular buffer.

[0020] Optionally, in any of the preceding aspects searching the at least one location in the ROB for the base address of the first in-flight instruction presently being dispatched includes searching a base address buffer having a first plurality of fields. Each field of the first plurality of fields has a size equal to the first number of upper order bits.

[0021] Optionally, in any of the preceding aspects storing the offset of the first inflight instruction but not the base address of the first instruction in the ROB includes storing the offset of the first in-flight instruction in offset buffer having a second plurality of fields. Each field of the second plurality of fields has a size equal to the second number of bits in the offset.

[0022] Optionally, in any of the preceding aspects searching the at least one location in the ROB for the base address of the first in-flight instruction presently being dispatched includes searching a location in a circular buffer that contains an in-flight instruction that was dispatched immediately prior to the in-flight instruction presently being dispatched to the ROB.

[0023] Optionally, in any of the preceding aspects searching the at least one location in the ROB for the base address of the first in-flight instruction presently being dispatched includes searching a plurality of entries in a content addressable memory (CAM).

[0024] Optionally, in any of the preceding aspects the method further comprises maintaining a count in a count field of a particular entry of the CAM that indicates how many in-flight instructions stored in the ROB have the base address in the particular entry.

[0025] Optionally, in any of the preceding aspects the method further comprises incrementing a count in a count field of a particular entry of the CAM by 1 in response to the base address of a newly dispatched in-flight instruction matching the base address in the particular entry.

[0026] Optionally, in any of the preceding aspects the method further comprises: accessing the offset from the ROB for a target instruction for which a program counter is to be determined; accessing the pointer associated with the offset for the target instruction, wherein the pointer points to the base address of the target instruction; accessing the base address for the target instruction from the ROB; and concatenating the base address for the target instruction with the offset for the target instruction to form a final program counter for the target instruction.

[0027] Optionally, in any of the preceding aspects the method further comprises: determining whether the base address of a first in-flight program instruction being committed and the base address of a second in-flight program instruction that was committed immediately prior to the first in-flight program instruction match; and freeing an entry in the ROB containing the base address of the second in-flight program instruction responsive to a determination that the base addresses of the first in-flight program instruction and the second in-flight program instruction do not match.

[0028] According to still one other aspect of the present disclosure, there is provided a computing system comprising a first storage having a first plurality of entries. The first plurality of entries each have a first field having a first size configured to store an m bit base address of an in-flight program instruction. The computing system comprises second storage having a second plurality of entries. The second plurality of entries each have a second field having a second size configured to store an n bit offset of an in-flight program instruction. Each in-flight program instruction has an n+m bit address. The second plurality of entries each have a third field configured to store a pointer to an entry in the first storage. The computing system comprises a controller in communication with the first storage and the second storage. The controller is configured to access addresses of in-flight program instructions. The inflight program instructions have a program order. The controller is configured to dispatch the in-flight program instructions in the program order, including: responsive to a determination that the base address of an in-flight program instruction presently being dispatched is already stored in an entry in the first storage: store the offset of the in-flight program instruction presently being dispatched in the second field in an open entry in the second storage; and store a pointer in the third field in the open entry in the second storage to the entry in the first storage that already contains the base address of the in-flight program instruction presently being dispatched.

[0029] Optionally, in any of the preceding aspects the controller is further configured to: responsive to a determination that the base address of the in-flight program instruction presently being dispatched is not located in the first storage: store the base address of the in-flight program instruction presently being dispatched in an open entry in the first storage; store the offset of the in-flight program instructionpresently being dispatched in a second open entry in the second storage; and store a pointer in the third field in the second open entry in the second storage to the open entry in the first storage.

[0030] Optionally, in any of the preceding aspects the first storage comprises a circular first-in first out (FIFO) buffer; and the controller is further configured to search the entry in the circular FIFO having the base address of the in-flight program instruction dispatched immediately prior to the instruction presently being dispatched for the base address of the in-flight program instruction presently being dispatched.

[0031] Optionally, in any of the preceding aspects the first storage comprises a content addressable memory (CAM). The controller is further configured to search the CAM for the base address of the in-flight program instruction presently being dispatched.

[0032] Optionally, in any of the preceding aspects controller is further configured to: access the offset from the second field in a first particular entry in the second storage for a target instruction for which a program counter is to be determined; access the pointer from the third field of the first particular entry in the second storage, wherein the pointer points to a second particular entry in the first storage; access the base address for the target instruction from the second particular entry in the first storage; and concatenate the base address from the second particular entry with the offset from the first particular entry to form a final program counter for the target instruction.

[0033] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter. The claimed subject matter is not limited to implementations that solve any or all disadvantages noted in the Background.BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Aspects of the present disclosure are illustrated by way of example and are not limited by the accompanying figures (FIGs.) for which like references indicate elements.

[0035] FIG. 1A depicts a PC address divided into a PC base address and a PC offset in accordance with an embodiment.

[0036] FIG. 1 B depicts an embodiment of a reorder buffer (ROB) system.

[0037] FIG. 1 C is a graph pertaining to chip area reduction of embodiments of a multi-layer ROB relative to a conventional ROB.

[0038] FIG. 2A is a flowchart of one embodiment of a process of a dispatch stage.

[0039] FIG. 2B is a flowchart of one embodiment of a process of freeing a ROB entry containing a PC base address in a commit stage.

[0040] FIG. 2C is a flowchart of another embodiment of a process freeing a ROB entry containing a PC base address in a commit stage.

[0041] FIG. 3 depicts one embodiment that includes a ROB having a circular buffer that stores the PC base addresses.

[0042] FIG. 4 is a flowchart of one embodiment of a process of a dispatch stage in which the ROB has a circular buffer that stores the PC base addresses.

[0043] FIG. 5 is a flowchart of one embodiment of a process of a freeing a buffer entry in a commit stage in which the ROB has a circular buffer that stores the PC base addresses.

[0044] FIG. 6 is a flowchart of one embodiment of a process of computing the PC in a commit stage in which the ROB has a circular buffer that stores the PC base addresses.

[0045] FIG. 7 is a flowchart of one embodiment of a process of a squashing on exception in which the ROB has a circular buffer that stores the PC base addresses.

[0046] FIG. 8 is a flowchart of one embodiment of a process of a selective squash on mis-prediction in which the ROB has a circular buffer that stores the PC base addresses.

[0047] FIG. 9 depicts one embodiment that includes a ROB having a content addressable memory (CAM) that stores the PC base addresses.

[0048] FIG. 10 is a flowchart of one embodiment of a process of a dispatch stage in which the ROB has a CAM that stores the PC base addresses.

[0049] FIG. 11 is a flowchart of one embodiment of a process of a freeing a buffer entry in a commit stage in which the ROB has a CAM that stores the PC base addresses.

[0050] FIG. 12 is a flowchart of one embodiment of a process of a computing the PC in a commit stage in which the ROB has a CAM that stores the PC base addresses.

[0051] FIG. 13 depicts one embodiment that includes a ROB having a unified PC base address and PC offset buffer.

[0052] FIG. 14 is a flowchart of one embodiment of a process of a dispatch stage in which the ROB has a unified PC base address and PC offset buffer.

[0053] FIG. 15 is a flowchart of one embodiment of a process of a freeing a buffer entry in a commit stage in which the ROB has a unified PC base address and PC offset buffer.

[0054] FIG. 16 is a flowchart of one embodiment of a process of a computing the PC in a commit stage in which the ROB has a unified PC base address and PC offset buffer.

[0055] FIG. 17A is a diagram showing one embodiment of the ROB controller.

[0056] FIG. 17B depicts another embodiment of the ROB controller.

[0057] FIG. 18 depicts an example of a compute system in which the ROB controller and optionally the ROB may be implemented.DETAILED DESCRIPTION

[0058] The present disclosure will now be described with reference to the Figures, which in general relate to a reorder buffer (ROB). Existing ROB structures store redundant information, which does not efficiently use the allocated space in CPU designs. An embodiment includes a multi-layer ROB, which removes the redundancy in the storage of information thereby enabling higher capacity for a given chip area. Performance may be increased by accommodating more in-flight instructions in the given chip area and / or reducing the chip area without reducing in the number of inflight instructions that may be stored in the multi-layer ROB. Power consumption can be reduced by reducing the number of transistors used to implement the ROB without reducing the number of in-flight instructions that may be stored in the ROB. Therefore, power consumption and / or chip area may be reduced without reducing the number of ROB entries. Alternatively, more instructions can be accommodated in the ROB without using additional chip area and / or power.

[0059] It is understood that the present embodiments of the disclosure may be implemented in many different forms and that claim scope should not be construed as being limited to the embodiments set forth herein. Rather, these embodiments are provided to convey the inventive embodiment concepts to those skilled in the art. Indeed, the disclosure is intended to cover alternatives, modifications, and equivalents of these embodiments, which are included within the scope and spirit of the disclosure as defined by the appended claims. Furthermore, in the following detailed description of the present embodiments of the disclosure, numerous specific details are set forth in order to provide a thorough understanding. However, it will be clear to those of ordinary skill in the art that the present embodiments of the disclosure may be practiced without such specific details.

[0060] FIG. 1A depicts a program counter (PC) 100. The PC 100 contains a memory address of a program instruction, as is known to those of ordinary skill in the art. In an embodiment, the PC address is divided into a PC base (PCB) Address and a PC Offset (PCO). The PCO (or more briefly “offset”) is formed from the lowest order n bits (bit 0 to bit n-1 ). The PCB Address (or more briefly “base address”) is formed from the highest order m bits (bit n to m+n-1 ). The values of “n” and “m” can vary according to implementation. As an example, the PC Address is 64 bits. As an example, the PCO is 8 bits and the PCB Address is 56 bits.

[0061] FIG. 1 B depicts an embodiment of a ROB system. The in-flight instruction addresses 130 are the memory addresses of program instructions. The ROB system has a Reorder buffer (ROB) 110 and a Reorder buffer controller 120. The term “reorder buffer” (ROB) as used herein refers to the storage that contain entries. In an embodiment the ROB 110 is implemented by volatile memory such as SRAM, DRAM, etc. The term “reorder buffer controller” (or more simply “controller”) as used herein refers to logic used to manage the entries in the ROB 110. In an embodiment, the ROB controller 110 is implemented by or within a memory controller that controls the ROB 110. The term “ROB system,” as used throughout this document, refers to a combination that includes both a ROB 110 and a ROB controller 120. The reorder buffer controller 120 dispatches in-flight instructions to the ROB 110. Dispatching an in-flight instruction includes storing at least the PCO of the in-flight instruction in the ROB 110. Various program instruction information may also be stored in the ROB 110, as is known to those of ordinary skill in the art. In an embodiment, the ROB controller 120 is activated by a CPUs dispatch unit.

[0062] The ROB 110 has PC Base (PCB) Address storage 112, PC Offset (PCO) storage 114, and Pointer storage 116. The PCB Address storage 112 stores PCB Addresses. The PC Offset storage 114 stores the PCO. The Pointer storage 116 stores pointers to entries in the PCB Address storage 112. The ROB 110 may be referred to as a multi-layer ROB due to the separate storage of the PC Addresses and the PCO. The term “buffer” may be used to refer to the ROB 110 in that the ROB 110 temporarily holds information (e.g., addresses, data, etc.). In an embodiment, the ROB 110 is implemented in a fixed location in hardware.

[0063] When the ROB controller 120 stores an address of an in-flight instruction in the ROB 110, the PCO will be stored in the PCO storage 114. However, if the PCB Address portion of the in-flight instruction is already stored in the ROB 110 then space can be saved in the ROB 110 by not saving an additional copy of the PCB Address portion in the ROB 110 again. Instead the ROB controller 120 may add a pointer in Pointer storage 116 that points to an entry in the PCB Address storage 112 that already contains the PCB Address. FIG. 1 B shows a simplified address example in which the instruction address is 24 bits, the PCO is 8 bits and the PCB Address is 16 bits. However, typically there may be more bits in the instruction address and in the PCB Address.

[0064] A few examples will now be discussed to provide a general overview of principles of operation of an embodiment of a ROB system. The in-flight instructions 130 have a program order from older to younger. The ROB controller 120 dispatches the in-flight instructions 130 to the ROB 110 in the program order from older to younger. The term “dispatch,” as used herein, refers to allocation of at least the PCO of the in-flight instruction address to the ROB 110, along with other information about the in-flight instruction. Also, during dispatch the ROB controller 120 either verifies that the PCB Address portion of the in-flight instruction address is already stored in the ROB 110, or alternatively adds the PCB Address portion to the ROB 110. Note that herein either the phrase “dispatches the in-flight instructions 130 to the ROB 110” or “dispatches the addresses of the in-flight instructions 130 to the ROB 110” may be used to refer to the dispatch process. As is understood by those of ordinary skill in the art, the program instructions may be executed out of order. The ROB controller 120 de-allocates the instructions 130 in the program order from older to younger. The deallocation occurs in connection with a “commit” stage.

[0065] Assuming the PCB Address of the oldest instruction (0x402a98) is not yet in the ROB 110, then 0x402a gets stored in entry 0 of the PCB Address storage 112. Also, 0x98 gets stored in the first entry in the PCO storage 114. Furthermore, the pointer “0” is stored in the first entry in the Pointer storage 116 to point to entry 0 in the PCB Address storage 112. However, for the next instruction (0x402a9c) the ROB controller 120 determines that 0x402a is already in the PCB Address storage 112.Therefore, there is no need to store the PCB Address again. However, 0x9c is stored in the second entry of the PCO storage 114. Furthermore, the pointer “0” is stored in the second entry in the Pointer storage 116 to point to entry 0 in the PCB Address storage 112. The third through sixth in-flight instructions 130 get processed in a similar manner as the second in-flight instruction 130. Thus, the first six entries in the PCO storage 114 all have pointers to entry 0 in the PCB Address storage 112.

[0066] When the seventh in-flight instruction (0x4f9caa) is processed, the ROB controller 120 determines that 0x4f9c is not in the PCB Address storage 112. Therefore, 0x4f9c is added as entry “1” in the PCB Address storage 112. Also, Oxaa gets stored in the seventh entry in the PCO storage 114. Furthermore, the pointer “1” is stored in the seventh entry in the Pointer storage 116 to point to entry 1 in the PCB Address storage 112. In the interest of brevity processing of the younger in-flight instructions will not be discussed at this time.

[0067] As one example, the PCB Address may be 56 bits, leaving 8 bits for the PCO. As one example, the pointer is two bits. Therefore, in the example in FIG. 1 B, the 13 in-flight instructions may be stored in 298 bits. Note that it would require 832 bits if the entire 64 bit address of each of the 13 in-flight instructions were to be stored in a ROB. For simplicity, the example instructions in FIG.1 B are only 24 bits, with 16 bits for the PCB Address and 8 bits for the PCO.

[0068] FIG. 1 C is a graph depicting chip area benefits of embodiments of a multilayer ROB. The graph illustrates how significantly more in-flight instructions can be stored in embodiments of a multi-layer ROB 110 for a given chip area compared to a conventional ROB. Four hypothetical cases are presented along the horizontal axis, each for a different chip area devoted to the ROB. Those cases are labeled A1 , A2, A3, and A4 in increasing chip area. The vertical axis indicates the total number of inflight instructions that may be stored in the ROB. The black bars 152, 156, 160, 164 each represent the number of in-flight instructions that could be stored in a conventional ROB for the given area. The white bars 154, 158, 162, 166 each represent the number of in-flight instructions that could be stored in an embodiment of a ROB for the given area. For each case, a significantly greater number of in-flight instructions can be stored in embodiments of a multi-layer ROB than the conventionalROB. Therefore, one option is to store more in-flight instructions in the same chip area. Another option is to store the same number of in-flight instructions in both the conventional ROB and an embodiment of a multi-layer ROB, but to use significantly less chip area for the embodiment of the multi-layer ROB. Both options can be pursued in which an embodiment of the multi-layer ROB uses less chip area and stores more in-flight instructions than a conventional ROB. Also note that using less chip area allows the use of fewer transistors, which saves power.

[0069] FIG. 2A is a flowchart of one embodiment of a process 200 of allocating instructions to a ROB 110. In an embodiment, the process 200 is performed by the ROB controller 120. Process 200 may be performed during a dispatch stage. Step 202 includes accessing an address of an in-flight instruction being dispatched to the ROB 110. Step 204 includes dividing the instruction address into a PC Base (PCB) Address and a PC Offset (PCO).

[0070] Step 206 includes searching at least one entry in the ROB 110 for the PCB Address of the in-flight instruction. In one embodiment, only the entry with the most recently added PCB Address is searched. Searching only the entry with the most recently added PCB Address is time and power efficient. Moreover, the most recently added entry may have a high hit rate assuming that instructions having the same PCB Address are consecutive in the program order. In one embodiment, all entries that may contain a valid PCB Address are searched.

[0071] Step 208 is a determination of whether the PCB Address was located in the ROB 110. If the PCB Address is located in the ROB 110, then there is no need to store the PCB Address in the ROB 110 again. Thus, in step 212 the PCO is stored in the ROB 110. However, the PCB Address is not stored in the ROB 110. Step 212 may also include adding additional information about the in-flight instruction to the ROB 110. Additionally, in step 214 a pointer is stored in the ROB 110 to the PCB Address that already exists in the ROB 110. This pointer is stored in association with the PCO, which therefore links the PCO to the PCB Address.

[0072] If the PCB Address is not located in the ROB 110, then in step 210 the PCB Address and the PCO are stored in the ROB 110. The PCB Address and the PCO may be stored in different regions of the ROB 110, such as in the example in FIG. 1 B.Additionally, a pointer may be stored in the ROB 110 to link the PCO with the PCB Address.

[0073] FIG. 2B is a flowchart of one embodiment of a process 220 of de-allocating instructions from a ROB 110. In an embodiment, the process 220 is performed by the ROB controller 120. Process 220 may be performed during a commit stage and may be used to free a ROB entry. Step 222 includes accessing a PCB Address pointer of the most recently committed instruction. Step 224 includes accessing the PCB Address pointer for the most recently committed instruction. Step 226 is a determination of whether the PCB Address pointers match. If so, then the process 220 ends without any freeing of an entry having a PCB Address. Note, however, that an entry in the ROB having a PCO may be freed. However, if the PCB Address pointers do not match then in step 228 the entry in the ROB 110 with the PCB Address for the most recently committed instruction is freed. Note that not freeing the PCB Address entry when the pointers do match prevents the PCB Address entry from being over-written. Therefore, the PCB Address entry remains available if the next instruction shares the same PCB Address and the PC for the next instruction needs to be restored due to an exception.

[0074] FIG. 2C is a flowchart of one embodiment of a process 240 of de-allocating instructions to a ROB 110. In an embodiment, the process 240 is performed by the ROB controller 120. Process 240 may be performed during a commit stage. Step 242 includes accessing the PCB Address of the instruction being committed. Step 244 includes accessing the PCB Address for the most recently committed instruction. Step 246 is a determination of whether the PCB Addresses match. If so, then the process 240 ends without further action with respect to PCB Adress entries. However, an entry having a PCO could be freed. However, if the PCB Addresses do not match then in step 248 the entry in the ROB 110 with the PCB Address for the most recently committed instruction is freed.

[0075] FIG. 3 depicts an embodiment that includes a ROB 110 having a circular buffer for storing the PCB Addresses. The ROB 110 has a circular buffer 312 that stores PCB Addresses 102. The circular buffer 312 may be a first-in first-out (FIFO) buffer. A head index register 332 contains a head index that points to the entry havingthe PCB Address of the oldest in-flight instruction. A tail index register 334 contains a tail index that points to the first available entry in the circular buffer 312. Thus, the tail index is one entry past the entry having the PCB Address of the youngest in-flight instruction. If the tail index equals the head index this indicates that the circular buffer 312 is full. The circular buffer 312 is one implementation of the PCB Address storage 112 in FIG. 1 B. The circular buffer 312 is one embodiment of a “base address buffer.”

[0076] The ROB 110 has a ROB structure 330 having a number of rows and columns. Each row pertains to one in-flight instruction, if valid. Each entry in the PC Offset (PCO) field 314 stores a PCO 104. The PCO field 314 is one embodiment of PCO storage 114 in FIG. 1 B. Each entry in the PC Based Index (PCBI) field 316 stores a pointer to an entry in the circular buffer 312. The PCBI field 316 is one embodiment of Pointer storage 116 in FIG. 1 B. The valid field 318 indicates whether the row contains a valid PCO. There are also other fields in the ROB entry 320. These other fields 320 may include, for example, flags for processing the in-flight instruction, a physical register associated with the in-flight instruction, etc. Note that fields 320 may contain information about the in-flight instruction that are typically stored in a conventional ROB, as is understood by those of ordinary skill in the art. The ROB structure 330 is one embodiment of an offset buffer.

[0077] FIG. 3 depicts an example of how the PC Address may be obtained from the ROB 110. ROB structure 330 may operate as a circular buffer with a head pointer and a tail pointer. The term “ROB pointer” will be used herein to refer to a pointer associated with an entry in the ROB that has a PCO 104 and other instruction information. Thus, there is a ROB head pointer that points to the entry in ROB structure 330 associated with the oldest in-flight instruction. There is a ROB tail pointer that points one entry beyond the entry in ROB structure 330 associated with the youngest in-flight instruction. The PCO 104 of a specific in-flight instruction may be obtained from an entry in the PCO field 314. The PCBI in that row of ROB structure 330 points to the entry in circular buffer 312 that stores the corresponding PCB Address 102. The PCB Address 102 is concatenated with the PCO 104 to form the PC Address of the in-flight instruction.

[0078] Note that the number of entries in the circular buffer 312 is typically significantly fewer than the number of entries in ROB structure 330. This is due to the possibility of storing significantly fewer PCB Addresses than in-flight instructions. Therefore, the total storage of circular buffer 312 is typically significantly less than if there was a field in ROB structure 330 for storing the PCB Addresses. A suitable size for the circular buffer 312 may be determined empirically by, for example, analyzing typical program execution. In an embodiment, the size of the circular buffer 312 is fixed.

[0079] FIG. 4 is a flowchart of one embodiment of a process 400 of a dispatch stage in which the ROB 110 has a circular buffer 312 for storing the PCB Addresses. In an embodiment, the process 400 is performed by the ROB controller 120. Process 400 may be used in connection with the ROB 110 of FIG. 3, but is not limited thereto. Step 402 includes accessing the address of an in-flight program instruction in a dispatch stage. Step 402 may further include dividing the address into a PCB address 102 and a PCO 104.

[0080] Step 404 is a determination of whether the ROB 110 and issue queue are full. If so, the dispatch stage is stalled in step 406. Stalling the dispatch stage may stall the entire CPU. However, embodiments of a multi-layer ROB 110 are less likely to be full, thereby decreasing the chance of stalling the dispatch stage. Otherwise, in step 408 the PCB Address 102 of the previously dispatched program instruction, which is pointed to by the tail index 334, is accessed. Step 410 includes a determination of whether the PCB Addresses of the current and previous (next older) program instruction match. Note that the ROB controller 120 performs a quick search of the ROB 110 that only needs to check one entry in the circular buffer 312. If the PCB Address of the current in-flight instruction matches the PCB Address of the previous in-flight instruction then there is no need to again store the PCB Address. However, in step 412 the PCO 104 is stored in an open entry in the PCO field 314 of ROB structure 330. In step 414, the PCBI is set to point to the entry in the circular buffer 312 that contains the matching PCB Address. In one embodiment, the PCBI entry for the current in-flight instruction is set to the same value of the PCBI entry for the previous in-flight instruction. Step 414 may also include setting the valid field 318 toindicate this entry is valid. Also additional information about the instruction may be added to field 320. Step 416 includes incrementing the ROB tail pointer.

[0081] Returning again to the discussion of step 410, if the PCB Address of the current in-flight instruction does not match the PCB Address of the previous in-flight instruction, then the PCB Address of the current in-flight instruction will be added to the ROB 110. In step 418 a determination is made whether the circular buffer 312 is full. In one embodiment, the Head Index (of circular buffer 312) is compared to the Tail Index (of circular buffer 312), with a match indicating that the circular buffer 312 is presently full. If the circular buffer 312 is full, then the dispatch stage is temporarily stalled in step 420. However, note that the circular buffer 312 can be appropriately sized to have a very low likelihood of the circular buffer 312, while still occupying a small chip area. When the circular buffer 312 is not full, in step 422 the PCB Address 102 is stored at the entry of the Tail Index of the circular buffer 312. Recall that the Tail Index points to the next open entry past the youngest entry in the circular buffer 312. In step 424 the Tail Index of the circular buffer 312 is incremented. Then, steps 412 - 414 are performed to store the PCO 104 and PCB I in ROB structure 330.

[0082] FIGs. 5 and 6 are flowcharts that pertain to embodiments of a commit stage in which the ROB has a circular buffer 312 for storing the PCB Addresses 102. Reference will be made to an embodiment of the ROB depicted in FIG. 3 when discussing FIGs. 5 and 6. FIG. 5 is a flowchart of an embodiment of a process 500 of de-allocating an instruction that is being retired. In an embodiment, the process 500 is performed by the ROB controller 120. Step 502 includes accessing the PCBI of the retiring instruction. The PCBI may be accessed based on the ROB head pointer. For example, the ROB head pointer points to the entry in ROB structure 330 having the instruction being retired. The PCBI is accessed from the PCBI field 316 in ROB structure 330. Note that by the end of process 500 the ROB head pointer may be incremented to point to the next entry in ROB structure 330 to, in effect, de-allocate the PCO of the instruction address.

[0083] Step 504 includes accessing the value in the head index 332. Note that, in an embodiment, the head index 332 is updated after an instruction that doesn’t share it retires. For example, in FIG. 1 B, if the current Head Index in PCB Address storage112 were 0, the Head index value 0 will be updated to 1 when the seventh instruction 0x4f9caa retires. In other words, a row entry in ROB structure 330 is invalid as the corresponding instruction retires while the Head index 332 is valid until all the instructions sharing the entry in the circular buffer 312 plus the next instruction that does not share the entry retires.

[0084] Step 506 includes a determination of whether the PCBI of the instruction presently being retired matches the value in the head index 332. Referring back to FIG. 3, the PBCI 316 points to an entry in the circular buffer 312. Likewise, the Head Index 332 points to an entry in the circular buffer 312. Note that if these entries in the circular buffer 312 match then the PCB Addresses will also match. If the PCB Addresses do match then no action is needed with respect to the circular buffer 312. However, as noted above the ROB head pointer may be incremented in step 508 to point to the next entry in ROB structure 330 to, in effect, de-allocate the PCO portion of the instruction address.

[0085] If the PCB Addresses do not match then in step 510 the entry in the circular buffer 312 associated with the previous instruction is located based on the head index 332. Moreover, that entry of the circular buffer 312 is freed. In an embodiment, the entry is freed by incrementing the head index 322 to the next entry in circular buffer 312.

[0086] FIG. 6 is a flowchart of an embodiment of a process 600 determining a PC Address for an instruction. In an embodiment, process 600 is used to read the PC of an instruction that will retire when ready. In an embodiment, the process 600 is performed by the ROB controller 120. Step 602 includes accessing the PCBI of the instruction. The PCBI may be accessed from ROB structure 330 based on the ROB head pointer. Step 604 includes using the PCBI to access the PCB Address from the circular buffer 312. Step 606 includes using the ROB head pointer to access the PCO from ROB structure 330. Step 608 includes concatenating the PCB Address with the PCO to form the final PC.

[0087] FIGs. 7 and 8 are flowcharts that pertain to exception handling in embodiments in which the ROB 110 has a circular buffer 312 for storing PCB Addresses 102. Reference will be made to the ROB 110 in FIG. 3 when discussingFIGs. 7 and 8. In an embodiment, the exception is assumed to be handled after all the prior instructions to the instruction causing the exception have been retired. In general, when an instruction is dispatched with an entry allocated in ROB, the index or location of the allocated ROB entry may be stored and carried with the dispatched instruction. This index may be used to locate an instruction causing an event such as branch misprediction to selectively squash instructions in ROB instead of using the ROB head pointer, which points to the oldest instruction. Alternatively branch misprediction can be handled until the mis-predicted branch becomes the oldest instruction in ROB. In this case, the ROB head pointer can be used. FIG. 7 is a flowchart of an embodiment of a process 700 of squashing an exception. In an embodiment, the process 700 is performed by the ROB controller 120. Process 700 may be used to flush all instructions from the ROB 110 after the instruction having the exception. Step 702 includes access the Program Counter (PC) for target instruction. The process 600 in FIG. 6 may be used to access the PC when the ROB 110 has a circular buffer 312 for storing PCB Addresses 102. Step 704 includes copying the PC to the Extended Instruction Pointer (EIP) register. The EIP is known to those of ordinary skill in the art. Step 706 includes updating the tail index of the circular buffer 312. Step 706 may include setting the value of the tail index in tail index register 334 to be equal to the value of the head index in head index register 332. Step 706 may further include incrementing the value in the tail index register 334. Thus, the tail index now points one entry in the circular buffer 312 past the head index. Note that process 700 covers handling of the circular buffer 312. Further steps may be taken to flush entries in the ROB structure 330.

[0088] FIG. 8 is a flowchart of an embodiment of a process 800 of selective squash on mis-prediction. In an embodiment, the process 800 is performed by the ROB controller 120. Process 800 may be used to selectively roll back the tail pointer in the tail index register 334, which points to the circular buffer 312. Step 802 includes accessing the Program Counter (PC) for the target instruction. The process 600 in FIG. 6 may be used to access the PC when the ROB 110 has a circular buffer 312 for storing PCB Addresses 102. Step 804 includes computing the correct next PC based on the address in the EIP. Step 806 includes updating the PCBI. Step 806 mayinclude copying the PCBI to the entry in ROB structure 330 that is pointed to by the ROB tail pointer. Step 806 may also include incrementing the ROB tail pointer.

[0089] FIG. 9 depicts an embodiment that includes a ROB 110 having a content addressable memory (CAM) for storing the PCB Addresses. The ROB 110 has a CAM 912 that stores PCB Addresses 102. Unlike an embodiment in which a circular buffer 312 is used to store the PCB Addresses there is no head index or tail index associated with the CAM 912. Each entry (or row) in the CAM 912 has a PCB Address field 902 and a PCB count field 904. The value in the PCB count field 904 indicates how many valid in-flight instructions have the PCB Address in that entry. Thus, the ROB controller 120 increments the value in the PCB count field 904 when another in-flight instruction having the PCB Address in that entry is allocated to the ROB. The ROB controller 120 decrements the value in the PCB count field 904 when the in-flight instruction having the PCB Address in that entry is de-allocated from the ROB 110. In an embodiment, a value of zero in the PCB count field 904 indicates that the entry is free. However, another option is to add another field to the CAM buffer 912 to store a valid / invalid bit for each entry. The CAM buffer 912 is one embodiment of a “base address buffer.”

[0090] The ROB 110 has a ROB structure 930 having a number of rows and columns. The ROB structure 930 is similar to the ROB structure 330 in FIG. 3 for an embodiment in which the PCB Addresses 102 are stored in the circular buffer 312. Each entry in the PC Offset (PCO) field 914 stores a PCO 104. The PCO field 914 is one embodiment of PCO storage 114 in FIG. 1 B. Each entry in the PC Based Index (PCBI) field 916 stores a pointer to an entry in the CAM 912. The PCBI field 916 is one embodiment of Pointer storage 116 in FIG. 1 B. The valid field 918 indicates whether the row contains a valid PCO. There are also other fields in the ROB entry 920. These other fields 920 may include, for example, flags for processing the in-flight instruction, a physical register associated with the in-flight instruction, etc. The ROB structure 930 is one embodiment of an offset buffer.

[0091] FIG. 9 depicts an example of how the PC Address may be obtained from the ROB 110. ROB structure 930 may operate as a circular buffer with a head pointer and a tail pointer. Thus, there is a ROB head pointer that points to the entry in ROBstructure 930 associated with the oldest in-flight instruction. There is a ROB tail pointer that points to the entry in ROB structure 930 past the entry with the youngest in-flight instruction. The PCO 104 of a specific in-flight instruction may be obtained from an entry in the PCO field 914. The PCBI in that row of ROB structure 930 points to the entry in CAM 912 that stores the corresponding PCB Address 102. The PCB Address 102 is concatenated with the PCO 104 to form the PC Address of the in-flight instruction.

[0092] Note that the number of entries in the CAM 912 is typically significantly fewer than the number of entries in ROB structure 930. Therefore, the total storage of CAM 912 is typically significantly less than if there was a field in ROB structure 930 for storing the PCB Addresses. A suitable size for the CAM 912 may be determined empirically by, for example, analyzing typical program execution. In an embodiment, the size of the CAM 912 is fixed.

[0093] FIG. 10 is a flowchart of one embodiment of a process 1000 of a dispatch stage in which the ROB 110 has a CAM buffer 912 for storing the PCB Addresses. Process 1000 may be used in connection with the ROB of FIG. 9, but is not limited thereto. In an embodiment, the process 1000 is performed by the ROB controller 120. Step 1002 includes accessing the address of an in-flight instruction in a dispatch stage. Step 1004 include dividing the address into a PCB address 102 and a PCO 104.

[0094] Step 1006 is a determination of whether the PCB Address of the current inflight instruction is already in the CAM 912. Each PCB Address field 902 in the CAM buffer 912 may be searched for the PCB Address. The search may be terminated early in the event that the PCB Address is found in the CAM buffer 912. If the PCB Address is found in the CAM buffer 912 then in step 1008 the PCB count is incremented in the entry in the CAM buffer 912 having the PCB Address. Therefore, the CAM buffer 912 tracks how many in-flight instructions have this PCB Address.

[0095] In step 1010 the PCO 104 is stored in the PCO field 914 in an open entry in ROB structure 930. The ROB tail pointer may be used to determine the open entry in ROB structure 930 that should be modified to add the PCO 104. In step 1012, the PCBI field 916 of the entry in ROB structure 930 to which the PCO 104 was just added is set to point to the entry in the CAM buffer 912 that contains the PCB Address. Step1014 includes incrementing the ROB tail pointer. Recall that the ROB tail pointer points to an entry in ROB structure 930.

[0096] Returning again to the discussion of step 1006, if the PCB Address of the current in-flight instruction is not found in the CAM buffer 912, then the PCB Address of the current in-flight instruction will be added to the CAM buffer 912. In step 1016 a determination is made whether the CAM buffer 912 is full. If the CAM buffer 912 is full, then the dispatch stage is temporarily stalled in step 1018. However, note that the CAM can be appropriately sized to have a very low likelihood of the CAM being full, while still occupying a small chip area. When the CAM is not full, in step 1020 the PCB Address 102 is stored at an open entry of the CAM buffer 912. The open entry may be identified by the PCB count field 904 being zero. Then, steps 1008 - 1014 are performed to store the PCO 104 and PCBI in ROB structure 930.

[0097] FIGs. 11 and 12 are flowcharts that pertain to embodiments of a commit stage in which the ROB has a CAM buffer 912 for storing the PCB Addresses 102. Reference will be made to an embodiment of the ROB depicted in FIG. 9 when discussing FIGs. 11 and 12. FIG. 11 is a flowchart of an embodiment of a process 1100 of de-allocating an instruction that is being retired. In an embodiment, the process 1100 is performed by the ROB controller 120. Step 1102 includes accessing the PCBI of the retiring instruction. The PCBI may be accessed based on the ROB head pointer. For example, the ROB head pointer points to the entry in ROB structure 930 having the instruction being retired. The PCBI is accessed from the PCBI field 916 in ROB structure 930.

[0098] Step 1104 includes decrementing the PCB count in the entry in the CAM buffer 912 pointed to by the PCBI. Step 1106 is a determination of whether the PCB count has hit zero. If not, then no further action is taken with respect to the CAM buffer 912. However, the ROB head pointer may be incremented in step 1108 to point to the next entry in ROB structure 930 to, in effect, de-allocate the PCO segment of the instruction address.

[0099] If the PCB count has hit zero, then in step 1110 the CAM buffer entry pointed to by the PCBI is freed. In an embodiment, the entry is freed by the action of setting the PCB count to zero. In one embodiment, the entry in the CAM buffer is freed bysetting a valid / invalid bit in the entry to invalid. The ROB head pointer may be incremented in step 1108 to point to the next entry in ROB structure 930 to, in effect, de-allocate the PCO segment of the instruction address.

[0100] FIG. 12 is a flowchart of an embodiment of a process 1200 of determining a PC address for an instruction when the PCB Addresses are stored in a CAM buffer 912. In an embodiment, the process 1200 is performed by the ROB controller 120. Step 1202 includes accessing the PCBI of the instruction. In some cases, the PCBI may be accessed based on the ROB head pointer. Step 1204 includes accessing the PCB Address from the PCB Address field 902 in the entry of the CAM buffer 912 pointed to by the PCBI. Step 1206 includes accessing the PCO from the PCO field 914 of the entry in ROB structure 930 associated with the in-flight instruction for which the PC is being determined. Step 1208 includes concatenating the PCB Address with the PCO to form the final PC.

[0101] As has been discussed above, in an embodiment in which the ROB 110 has a circular buffer 312 the ROB controller 120 may change the value in the tail index register 334 in connection with exception handling. Moving the tail index may be used to, in effect, squash entries in the circular buffer 312. In an embodiment in which the ROB has a CAM buffer 912 one option to squash an entry in the CAM buffer 912 is to set the PCB count to zero. If each entry in the CAM buffer 912 has a valid / invalid bit, then this bit may be set to invalid to squash an entry in the CAM buffer 912. In an embodiment, rolling back instructions involves determining which entry in the CAM 912 corresponds to the next oldest instruction and decrementing the PCB count for that entry in the CAM 912. This procedure is then repeated for the next oldest instruction to decrement the PCB count for the next oldest instruction. If the PCB count for an entry hits zero, then that entry in the CAM buffer 912 is freed.

[0102] FIG. 13 depicts an embodiment that includes a ROB 110 having a unified structure 1330 for storing both the PCB Addresses and the PCOs. A given entry in the unified structure 1330 could hold either a PCB address or, alternatively, the PCO and other instruction information. Recall that in an embodiment depicted in FIG. 3, the ROB 110 includes two structures (circular buffer 312, ROB structure 330) and in in an embodiment depicted in FIG. 9, the ROB 110 includes two structures (CAM 912,ROB structure 930). However, the ROB 110 in FIG. 13 has a unified structure 1330 for storing both the PCB Addresses and the PCOs. Elements in FIG. 13 other than the unified structure 1330 may be considered to be part of the ROB controller 120. The ROB bit field 1340 indicates whether the entry (row) contains a PCB Address or the PCO and other instruction information. As one example, a ROB bit of 0 indicates that the entry has a PC Base Address field 1350. There may also be some unused bits 1352. In one example, a ROB bit of 1 indicates that the entry has a PCO field 1314, a ROB Index (ROBI) field 1316, a valid field 1318, and other ROB entry fields 1320. The PC Offset (PCO) field 1314 stores a PCO 104. The PCO field 1314 is one embodiment of PCO storage 114 in FIG. 1 B. The ROBI field 1316 stores a pointer to an entry in the unified structure 1330 that contains a PC Base Address. The ROBI field 1316 is one embodiment of Pointer storage 116 in FIG. 1 B. The valid field 1318 indicates whether the row contains a valid PCO. There are also other fields in 1320 for holding other instruction information. These other fields 1320 may include, for example, flags for processing the in-flight instruction, a physical register associated with the in-flight instruction, etc. The term ROB entry will be used to refer to entry having a valid PCO. For example, the term ROB entry refers to an entry having a “1” in the ROB bit field 1340 and with the valid bit set to the valid state. The term PCB entry will be used to refer to an entry having a valid PCB Address. For example, the term PCB entry refers to an entry having a “0” in the ROB bit field 1340.

[0103] The unified structure 1330 may operate, at least in part, as a circular buffer with a head pointer and a tail pointer. Specifically, the valid PCO entries having a “1” in the ROB bit field 1340 may operate as a circular buffer with a ROB head pointer and a ROB tail pointer. Note that the PCB entries having a “0” in the ROB bit field 1340 are not part of this circular buffer, as those entries have the PCB Addresses. The ROB head pointer points to the ROB entry in unified structure 1330 associated with the oldest in-flight instruction. The ROB tail pointer points to the next open entry in unified structure 1330 past the ROB entry with the youngest in-flight instruction. It is possible that there may be a PCB entry between the ROB entry with the youngest in-flight instruction and the entry pointed to by the ROB tail pointer.

[0104] A most recently allocated address (MRAA) register 1304 stores the PCB Address that was most recently allocated to a PCB entry in the unified structure 1330. A ROBIA register 1302 stores a pointer to the PCB entry in the unified structure 1330 having the aforementioned most recently allocated PCB Address.

[0105] A most recently deallocated address (MRDA) register 1308 stores the PCB Address that was most recently deallocated from a PCB entry in the unified structure 1330. A ROBID register 1306 stores a pointer to the PCB entry in the unified structure 1330 that was used to store the aforementioned most recently deallocated PCB Address.

[0106] The PCO 104 of a specific in-flight instruction may be obtained from an entry in the PCO field 1314. The ROBI in that row of unified structure 1330 points to the entry in unified structure 1330 that stores the corresponding PCB Address 102 (in PC Base Address Field 1350). The PCB Address 102 is concatenated with the PCO 104 to form the PC Address of the in-flight instruction.

[0107] Note that the number of entries used for the PCB Addresses is typically significantly fewer than the number of entries used for PCOs. Therefore, the unified structure 1330 need not have a large number of rows for the PCB Addresses. However, the width of the unified structure 1330 is significantly less than if the PCB Address were to be included in the PCO entries. Therefore, the overall size of unified structure 1330 may be made smaller without reducing the total number of in-flight instructions that may be accommodated. A suitable size for the unified structure 1330 may be determined empirically by, for example, analyzing typical program execution. Note that unified structure 1330 allows for some flexibility in the number of entries used for the PCB addresses.

[0108] FIG. 14 is a flowchart of one embodiment of a process 1400 of a dispatch stage in which the ROB 110 has a unified structure 1330 for storing both the PCB Addresses and the PCOs. Process 1400 may be used in connection with the ROB 110 of FIG. 13, but is not limited thereto. In an embodiment, the process 1400 is performed by the ROB controller 120. Step 1402 includes accessing the address of an in-flight instruction in a dispatch stage. Step 1404 includes dividing the address into a PCB address 102 and a PCO 104.

[0109] Step 1406 includes comparing the PCB Address with the most recently allocated PCB Address. The most recently allocated PCB Address is obtained from the MRAA register 1304. Comparison logic 1342 compares these two PCB Addresses. Step 1408 includes a determination of whether the two PCB Addresses match. If the two PCB Addresses match then there is no need to again store the PCB Address in the ROB 110. However, an entry is added for the PCO by performing steps 1410 - 1416. The open entry in the unified structure 1330 pointed to by the ROB tail pointer may be used as the new ROB entry.

[0110] Step 1410 includes storing the PCO in the PCO field 1314 in the new ROB entry in unified structure 1330. Step 1412 includes copying the ROBIA in the ROBIA register 1302 to the ROBI field 1316 in the new ROB entry. Step 1412 thus associates the PCO of the in-flight instruction with the PCB Address of the in-flight instruction. Step 1416 includes incrementing the ROB tail pointer to the next open entry in the unified structure 1330.

[0111] Returning again to the discussion of step 1408, if the PCB Addresses do not match, then the PCB Address of the current in-flight instruction will be added to the unified structure 1330. In step 1418 a determination is made whether the unified structure 1330 is full. If the unified structure 1330 is full, then the dispatch stage is temporarily stalled in step 1420. However, note that the unified structure 1330 can be appropriately sized to have a very low likelihood of the unified structure 1330 being full, while still occupying a small chip area. Moreover, the flexibility of using open entries in the unified structure 1330 as either PCB entries or ROB entries may reduce the likelihood that the unified structure 1330 is full. When the unified structure 1330 is not full, in step 1422 the PCB Address 102 is stored at a new PCB entry in the unified structure 1330. In step 1424 the ROBIA register 1302 is updated to point to the new PCB entry in the unified structure 1330. Step 1424 may also include updating the MRAA 1304 to store the PCB Address just allocated to the new PCB entry in the unified structure 1330. Then, steps 1410 - 1416 are performed to create a new PCB entry for the in-flight instruction being allocated to the unified structure 1330.

[0112] FIGs. 15 and 16 are flowcharts that pertain to embodiments of a commit stage in which the ROB has a unified structure 1330 for storing both the PCBAddresses 102 and the PCOs 104. Reference will be made to an embodiment of the ROB depicted in FIG. 13 when discussing FIGs. 15 and 16. FIG. 15 is a flowchart of an embodiment of a process 1500 of de-allocating an instruction that is being retired. In an embodiment, the process 1500 is performed by the ROB controller 120. Step 1502 includes accessing the ROB bit (from ROB bit field 1340) from the entry in the unified stricture pointed to by the ROB head pointer. Step 1504 includes a determination of whether the ROB bit is “1”. A ROB bit of “1” indicates that this entry is a ROB entry. A ROB bit of “0” indicates that this entry is a PCB entry. If the ROB bit is “1” then in step 1506 the ROB head pointer is incremented. Therefore, step 1506 will de-allocate the ROB entry associated with the instruction being retired.

[0113] If the ROB bit is “0” this indicates that this entry is a PCB entry, which will be de-allocated in steps 1508 - 1512. Step 1508 includes copying the PCB Address from the PCB entry to the MRDA register 1308. Step 1510 includes copying the value of the ROB head pointer to the ROBID register 1306. Step 1512 includes incrementing the ROB head pointer.

[0114] FIG. 16 is a flowchart of an embodiment of a process 1600 of determining a PC address for an instruction. In an embodiment, the process 1600 is performed by the ROB controller 120. Step 1602 includes accessing the PCO and ROBI from the ROB entry in the unified structure 1330 corresponding to the instruction. Step 1604 includes accessing the value in the ROBID register 1306. Step 1606 includes a determination of whether the ROBID equals the ROBI. If the ROBID equals the ROBI, then in step 1608 the value from the MRDA register 1308 selected by MUX 1332 and is concatenated with the PCO from PCO field 1314 to form the final PC. Returning to the discussion of step 1606, if the ROBID does not equal the ROBI, then in step 1610 the ROBI is used to access a PCB entry in the unified structure 1330. In step 1612 the PCB Address is obtained from this PCB entry in the unified structure 1330 and selected by MUX 1332. In step 1614 the PCB Address from this PCB entry is concatenated with the PCO to form the final PC.

[0115] FIG. 17A depicts one embodiment of a reorder buffer (ROB) controller 120. The ROB controller 120 depicted in FIG. 17A may be used to implement the reorder buffer controller 120 in FIG. 1 B. The ROB controller 120 depicted in FIG. 17A may beused to implement process 200, 220, 240, and / or 400, but is not limited thereto. The ROB controller 120 has several comparator / subtractors, each of which is configured to compare two values and output a result based on the comparison. The result indicates whether the two input values are equal or not equal. The output of a comparator / subtractor may be an analog or a digital value. In an embodiment, the equal or not equal output is represented by one of two values such as a “1” or “0”, a high voltage or a low voltage, etc. In an embodiment that will be discussed in connection with FIG. 17A, a value of “1” represents equal and “0” represents unequal. First comparator / subtractor 1702 inputs the PCB Head Index from the head index register 332 and the ROB Tail Index, compares the two values, and outputs a 1 if they are equal and a 0 if they are unequal. Second comparator / subtractor 1704 inputs the PCB Head Index from the head index register 332 and the PCB Tail Index from the tail index register 334, compares the two values, and outputs a 1 if they are equal and a 0 if they are unequal. Third comparator / subtractor 1706 inputs the PCB Address of the in-flight instruction (see step 402) and the PCB Address at the tail of the PCB, compares the two values, and outputs a 1 if they are equal and a 0 if they are unequal.

[0116] The ROB controller 120 has a number of logic gates that process the outputs of the comparator / subtractors. The logic gates produce outputs that indicate whether to stall the dispatch stage (see, for example, step 420 in FIG. 4), store the PCO (see, for example, step 412 in FIG. 4) or store the PCB (see, for example, step 422 in FIG. 4). The output of the third comparator / subtractor 1706 is input to first inverter 1718. The output of the second comparator / subtractor 1704 is input to first AND gate 1716, along with the output of the first invertor 1718. The output of the first comparator / subtractor 1702 is input to OR gate 1714, along with the output of the first AND gate 1716. The output of the OR gate 1714 is provided to the input of the second inverter 1722. The output of the first inverter 1718 and the output of the second inverter 1722 are provided to the input of the second AND gate 1722. The outputs of the OR gate 1714, the second inverter 1720, and the second AND gate 1722 are separate activate / deactivate signals. Each activate / deactivate signals has a first value for activate and a second value for deactivate. In the example being discussed in which “1 ” and “0” are used for equal and unequal for the comparator / subtractor outputs a value of “1” is activate and a value of “0” is deactivate. Thus, if the OR gate 1714outputs a “1” the dispatched stage is stalled. If the OR gate 1714 outputs a the dispatched stage is not stalled. If the second inverter gate 1720 outputs a “1” the PCO is stored. If the second inverter gate 1720 outputs a “0” the PCO is not stored. If the second AND gate 1722 outputs a “1” the PCB is stored, the second AND gate 1722 outputs a “0” the PCB is not stored. The ROB interface 1730 is configured to modify values in the ROB 110 in order to store the PCO and the PCB.

[0117] FIG. 17B depicts another embodiment of the ROB controller 120. The ROB controller 120 in FIG. 17B may be used to implement any of process 200, 220, 240, 400, 500, 600, 700, 800, 1000, 1100, 1200, 1400, 1500, and / or 1600. The ROB controller 120 has a memory interface 1750, comparison logic 1760, and actuation Iogic1770. The memory interface 1750 is configured to connect to memory including the ROB 110 to access values store in the memory and to store values in the memory. The comparison logic 1760 is configured to compare values (e.g., addresses) and output a result that indicates whether the values are equal. The actuation Iogic1770 is configured to process the values output by the comparison logic 1760 and to generate a result to drive an action (e.g., store PCB Address and PCO in ROB (see step 210), store PCO but not the PCB Address in ROB (see step 212) store a pointer in the ROB to the PCB Address in association with the PCO (see step 214). The comparator / subtractors 1702, 1704, 1706 are examples of comparison logic 1760; however, comparison logic 1760 is not limited thereto. The logic gates in FIG. 17A are examples of actuation logic 1770; however, actuation logic 1770 is not limited thereto. The ROB interface 1730 in FIG. 17A is an example of memory interface 1750; however, memory interface 1750 is not limited thereto. The comparison logic 1760 and actuation logic 1770 may be implemented in hardware, software, or a combination of hardware and software. In an embodiment, a hardware implementation is used for faster operation of the comparison logic 1760 and actuation logic 1770.

[0118] The technology described herein can be implemented using hardware, software, or a combination of both hardware and software. For example, the ROB controller 120 may be implemented using hardware, software, or a combination of both hardware and software. In an embodiments, the ROB controller 120 is implemented with dedicated hardware logic components. For example, and without limitation,illustrative types of hardware logic components that can be used include transistors, Field-programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), special purpose computers, etc.

[0119] In one embodiment, software (stored on a storage device) implementing one or more embodiments is used to program one or more processors to implement all or a portion of the ROB controller 120. FIG. 18 depicts one example of a compute system 1800 that may be used to implement all or a portion of the ROB controller 120. The one or more processors 1802 can be in communication with one or more computer readable storage devices 1804 via a bus 1806 or other communication link. In an embodiment, the compute system 1800 resides within a Central Processing Unit (CPU). The ROB 110 may be within or external to the compute system 1800. For example, ROB 110 could be implemented by one or more of the computer readable storage devices 1804. Optionally the compute system 1800 may include peripherals and / or communication interfaces. The software used is stored on one or more of the processor readable storage devices 1804 described above to program one or more of the processors 1802 to perform the functions described herein. The processor readable storage devices 1804 can include computer readable media such as volatile and non-volatile media, removable and non-removable media. Computer readable storage media may be implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer readable storage media include RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. A computer readable storage medium or media does (do) not include propagated, modulated or transitory signals.

[0120] The description of the present disclosure has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the disclosure in the form disclosed. Many modifications and variations will be apparentto those of ordinary skill in the art without departing from the scope and spirit of the disclosure. The aspects of the disclosure herein were chosen and described in order to best explain the principles of the disclosure and the practical application, and to enable others of ordinary skill in the art to understand the disclosure with various modifications as are suited to the particular use contemplated.

[0121] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

CLAIMSWhat is claimed is:

1. An apparatus, comprising: a reorder buffer (ROB); and a controller in communication with the ROB, the controller configured to: access addresses of in-flight program instructions, the in-flight program instructions having a program order, each instruction address having a first number of upper order bits that form a base address and a second number of lower order bits that form an offset, wherein the number of bits in the addresses equals the first number plus the second number; and dispatch the in-flight program instructions to the ROB in the program order, including: search at least one location in the ROB for the base address of an in-flight instruction presently being dispatched; and responsive to a determination that the base address of the inflight instruction presently being dispatched is already stored in the searched at least one location in the ROB: i) store the offset of the instruction presently being dispatched but not the base address of the instruction presently being dispatched in the ROB; and ii) store a pointer in the ROB in association with the offset, wherein the pointer points to the already stored base address in the ROB.

2. The apparatus of claim 1 , wherein the controller is further configured to: responsive to a determination that the base address of the in-flight instruction presently being dispatched is not already stored in the searched at least one location: i) store the base address of the in-flight instruction presently being dispatched in the ROB;ii) store the offset of the in-flight instruction presently being dispatched in the ROB; and iii) store a pointer in the ROB in association with the offset, wherein the pointer points to the base address stored in the ROB.

3. The apparatus of claim 1 or 2, wherein the ROB comprises: a base address buffer having a first plurality of fields, each field of the first plurality of fields having a size equal to the first number of bits in the base address; and an offset buffer having a second plurality of fields, each field of the second plurality of fields having a size equal to the second number of bits in the offset.

4. The apparatus of claim 3, wherein the offset buffer further comprises a third plurality of fields, each field of the third plurality of field having a size configured to hold a pointer to a field in the first plurality of fields.

5. The apparatus of claim 3 or 4, wherein: the base address buffer comprises a circular buffer; and the controller is further configured to store the base addresses of the in-flight instructions in the circular buffer in the program order.

6. The apparatus of any of claims 1 to 5, wherein the at least one location for which the controller searches for the base address of the in-flight instruction presently being dispatched contains the base address of an in-flight instruction that was dispatched immediately prior to the in-flight instruction presently being dispatched to the ROB.

7. The apparatus of any of claims 3 or 4, wherein: the base address buffer comprises a content addressable memory (CAM), the CAM having a plurality of entries with each CAM entry having one of the first plurality of fields and a count field; andthe controller is further configured to maintain a count in the count field of a particular entry of the CAM that indicates how many in-flight instructions stored in the ROB have the base address in the particular entry.

8. The apparatus of any of claims 3, 4 or 7, wherein: the base address buffer comprises a content addressable memory (CAM), the CAM having a plurality of entries with each CAM entry having one of the first plurality of fields and a count field; and the controller is further configured to increment a count in the count field of a particular entry of the CAM by 1 in response to the base address of a newly dispatched in-flight instruction matching the base address in the particular entry.

9. The apparatus of claim 7 or 8, wherein the at least one location for which the controller searches for the base address of the instruction presently being dispatched comprises all entries in the CAM that store a valid base address of an inflight instruction.

10. The apparatus of any of claims 1 to 9, wherein the controller is further configured to: access the offset from the ROB for a target instruction for which a program counter is to be determined; access the pointer associated with the offset for the target instruction, wherein the pointer points to the base address of the target instruction; access the base address for the target instruction from the ROB; and concatenate the base address for the target instruction with the offset for the target instruction to form a final program counter for the target instruction.11 . The apparatus of any of claims 1 to 10, wherein the controller is further configured to: determine whether the base address of a first program instruction being committed and the base address of a second program instruction that was committed immediately prior to the first program instruction match; andfree an entry in the ROB containing the base address of the second program instruction responsive to a determination that the base addresses of the first program instruction and the second program instruction do not match.

12. The apparatus of any of claims 1 , 2, 10, or 11 , wherein: the ROB comprises a unified structure having plurality of entries; and the controller is further configured to store either a base address or alternatively an offset and program instruction information in an open entry in the unified structure, each entry in the unified structure having a field that indicates whether the entry stores a base address or alternatively stores an offset and program instruction information.

13. The apparatus of claim 12, wherein the at least one location for which the controller searches for the base address of the in-flight instruction presently being dispatched comprises all entries in the unified structure that store a valid base address of an in-flight program instruction stored in the ROB.

14. A method for maintaining a reorder buffer (ROB), the method comprising: accessing addresses of in-flight program instructions, the in-flight program instructions having a program order, each instruction address having a first number of upper order bits that form a base address and a second number of lower order bits that form an offset, each program instruction address having a number of bits equal to the first number plus the second number; and dispatching the in-flight program instructions to a ROB in the program order, including: searching at least one location in the ROB for the base address of a first in-flight instruction presently being dispatched; and responsive to a determination that the base address of the first in-flight instruction is already stored in the searched at least one location in the ROB: i) storing the offset of the first in-flight instruction but not the base address of the first instruction in the ROB; andii) storing a pointer in the ROB in association with the offset of the first in-flight instruction, wherein the pointer points to the already stored base address in the ROB.

15. The method of claim 14, wherein dispatching the in-flight program instructions to the ROB in the program order further includes: responsive to a determination that the base address of a second inflight instruction presently being dispatched is not already stored in the searched at least one location: i) storing the base address of the second in-flight instruction in the ROB; ii) storing the offset of the second in-flight instruction in the ROB; and iii) storing a pointer in the ROB in association with the offset of the second in-flight instruction, wherein the pointer points to the base address of the second in-flight instruction stored in the ROB.

16. The method of claim 14, wherein: storing the base address of the second in-flight instruction presently being dispatched in the ROB comprises storing the base address of the second in-flight instruction presently being dispatched in an open entry in a first circular buffer; and storing the offset of the second in-flight instruction presently being dispatched in the ROB comprises storing the offset in an open entry in a second circular buffer.

17. The method of any of claims 14 to 16, wherein searching the at least one location in the ROB for the base address of the first in-flight instruction presently being dispatched includes searching a base address buffer having a first plurality of fields, each field of the first plurality of fields having a size equal to the first number of upper order bits.

18. The method of any of claims 14 to 17, wherein storing the offset of the first inflight instruction but not the base address of the first instruction in the ROB includes storing the offset of the first in-flight instruction in offset buffer having a second plurality of fields, each field of the second plurality of fields having a size equal to the second number of bits in the offset.

19. The method of any of claims 14 to 8, wherein searching the at least one location in the ROB for the base address of the first in-flight instruction presently being dispatched includes searching a location in a circular buffer that contains an in-flight instruction that was dispatched immediately prior to the in-flight instruction presently being dispatched to the ROB.

20. The method of claim 14 or 15, wherein searching the at least one location in the ROB for the base address of the first in-flight instruction presently being dispatched includes searching a plurality of entries in a content addressable memory (CAM).

21. The method of claim 20, further comprising maintaining a count in a count field of a particular entry of the CAM that indicates how many in-flight instructions stored in the ROB have the base address in the particular entry.

22. The method of claim 20 or 21 , further comprising incrementing a count in a count field of a particular entry of the CAM by 1 in response to the base address of a newly dispatched in-flight instruction matching the base address in the particular entry.

23. The method of any of claims 14 to 22, further comprising: accessing the offset from the ROB for a target instruction for which a program counter is to be determined; accessing the pointer associated with the offset for the target instruction, wherein the pointer points to the base address of the target instruction;accessing the base address for the target instruction from the ROB; and concatenating the base address for the target instruction with the offset for the target instruction to form a final program counter for the target instruction.

24. The method of any of claims 14 to 23, further comprising: determining whether the base address of a first in-flight program instruction being committed and the base address of a second in-flight program instruction that was committed immediately prior to the first in-flight program instruction match; and freeing an entry in the ROB containing the base address of the second in-flight program instruction responsive to a determination that the base addresses of the first in-flight program instruction and the second in-flight program instruction do not match.

25. A computing system, comprising: first storage having a first plurality of entries, the first plurality of entries each having a first field having a first size configured to store an m bit base address of an in-flight program instruction; second storage having a second plurality of entries, the second plurality of entries each having a second field having a second size configured to store an n bit offset of an in-flight program instruction, wherein each in-flight program instruction has an n+m bit address, the second plurality of entries each having a third field configured to store a pointer to an entry in the first storage; and a controller in communication with the first storage and the second storage, the controller configured to: access addresses of in-flight program instructions, the in-flight program instructions having a program order; and dispatch the in-flight program instructions in the program order, including: responsive to a determination that the base address of an inflight program instruction presently being dispatched is already stored in an entry in the first storage:i) store the offset of the in-flight program instruction presently being dispatched in the second field in an open entry in the second storage; and ii) store a pointer in the third field in the open entry in the second storage to the entry in the first storage that already contains the base address of the in-flight program instruction presently being dispatched.

26. The computing system of claim 25, wherein the controller is further configured to: responsive to a determination that the base address of the in-flight program instruction presently being dispatched is not located in the first storage: i) store the base address of the in-flight program instruction presently being dispatched in an open entry in the first storage; ii) store the offset of the in-flight program instruction presently being dispatched in a second open entry in the second storage; and iii) store a pointer in the third field in the second open entry in the second storage to the open entry in the first storage.

27. The computing system of claim 25 or 26, wherein: the first storage comprises a circular first-in first out (FIFO) buffer; and the controller is further configured to search the entry in the circular FIFO having the base address of the in-flight program instruction dispatched immediately prior to the instruction presently being dispatched for the base address of the in-flight program instruction presently being dispatched.

28. The computing system of claim 25 or 26, wherein: the first storage comprises a content addressable memory (CAM); and the controller is further configured to search the CAM for the base address of the in-flight program instruction presently being dispatched.

29. The computing system of any of claims 25 to 28, wherein the controller is further configured to: access the offset from the second field in a first particular entry in the second storage for a target instruction for which a program counter is to be determined; access the pointer from the third field of the first particular entry in the second storage, wherein the pointer points to a second particular entry in the first storage; access the base address for the target instruction from the second particular entry in the first storage; and concatenate the base address from the second particular entry with the offset from the first particular entry to form a final program counter for the target instruction.

Citation Information

Patent Citations

  • Banked physical register data flow architecture in out-of-order processors

    US10007521B1

  • Method and apparatus for reordering in a non-uniform compute device

    US10445094B2