1. Field of the Invention
This invention relates to the field of data processing systems. More particularly, this invention relates to data processing systems using register renaming to map between architectural registers and physical registers.
2. Description of the Prior Art
It is known to provide data processing systems which utilize register renaming to map architectural register specifiers within instructions of a program stream into physical register specifiers for execution using a set of physical registers. Such register renaming is useful in facilitating techniques such as out-of-order processing when seeking high performance operation. Within systems employing register renaming in this way, it is also known that at least some of the program instructions to be executed will be speculative in the sense that, at the time when register renaming is performed, whether or not those instructions will be properly executed depends upon some unresolved condition. As an example, a conditional branch instruction may be encountered and a branch prediction made with program instructions from the predicted branch target then being speculatively executed. If it turns out that the branch was mispredicted, then those speculatively executed post-branch instructions should not have been executed and it is necessary to recover the processor state to that preceding the branch instruction such that the appropriate proper program instruction sequence can be followed. In order to achieve this when register remapping mechanisms are used, it is known to store recovery data to enable the previous state to be retrieved.
An independent technique known within data processing systems, particularly those requiring high reliability, is the use of an error correcting code (ECC) mechanism in respect of data values returned from memory. Physical or soft errors can arise resulting in corruption of data values and these can be detected, and possibly corrected, by techniques such as ECC or parity checking. If such errors are detected, then incorrect processing based upon the corrupted data value can be prevented.
Viewed from one aspect the present invention provides apparatus for processing data, said apparatus comprising:
a physical set of registers;
a register renaming circuit for mapping from register specifiers of an architectural set of register specifiers to registers of said physical set of registers to generate physical register specifiers, said architectural set of register specifiers representing registers as specified by instructions within an instruction set and said physical set of registers being physical registers for use in executing instructions of said instruction set;
at least one execution circuit responsive to instructions and associated physical register specifiers to execute said instructions using said physical set of registers, at least some of said instructions being speculatively executed based upon respective predicted outcomes of at least one unresolved instruction, said instructions being speculatively executed including load instructions respectively for loading a data value from a memory to a physical register;
a register renaming recovery circuit responsive to detection of a mispredicted speculatively executed instruction as having a mispredicted outcome to return to a mapping from said set of architectural registers to said set of physical registers that reverses changes made in said mapping that are dependent upon said mispredicted speculatively executed instruction such that said physical registers to which said set of architectural registers are mapped correspond to and contain values of said physical registers to which said architectural registers were mapped prior to execution of said mispredicted speculative executed instruction; and
an error detecting circuit responsive to load instructions to generate an error signal indicative whether or not an error is detected for said load instructions; wherein
a data value loaded from said memory and stored within a physical register in response to a load instruction is made available for use for further processing before said error detecting circuit has been able to generate said error signal;
said load instruction is handled by said register renaming recovery circuit as a speculative instruction until at least said error detecting circuit has been able to generate said error signal; and
if said error signal indicates an error, then said register renaming recovery circuit reverses any changes in said mapping made that are dependent upon said load instruction such that said physical registers to which said set of architectural registers are mapped correspond to and contain values of said physical registers to which said architectural registers were mapped prior to execution of said load instruction.
The present technique recognises that in a system employing register renaming and speculatively executed instructions there is normally already provided a register renaming recovery mechanism that is able to restore the state of the system to that preceding an incorrectly predicted speculative instruction. Additional use of this mechanism can be made to significant advantage with little added hardware cost by using the recovery mechanism to enable recovery from an error associated with a load instruction after the data value associated with that load instruction has already been made available for use. Thus, timing restrictions in being able to identify any error (e.g. by ECC, parity checking, access permission failure etc) are eased permitting higher performance operation whilst still allowing precise hardware-based recovery from an error associated with a load instruction. Thus, the need to delay use of a data value returned from memory until, for example, an ECC checking for that data value has been completed, is removed. The present technique also avoids any need to rely upon imprecise or software supported error recovery which would be disadvantageously slow in the case of late detection of an error associated with a load instruction.
It will be appreciated that the error detection circuit can take a variety of different forms, such as, for example, an ECC-based error detection circuit, a parity-based error detection circuit, a memory management unit returning an access permission violation result or a memory protection unit returning an access permission violation result.
The error signal received after the data value has been released for use may not be the only error signal associated with that data value. As an example, access permissions, such as from a memory management unit or a memory protection unit, may be determined early and available at the same time as the data value itself, whereas a signal indicative of corruption of the data value may only be available later. The recovery mechanism can be used to recover from an access permission violation as well as a data corruption error without having to wait until the presence or absence of data corruption is known. Alternatively, the access permission result could be combined with the data corruption result to form of a combined error indicating signal which is available later after the data value was released for use but nevertheless provides for recovery from either type of error using the recovery mechanism provided.
The unresolved predicted outcome upon which the load instruction depends could take a variety of different forms. The unresolved outcome could relate to previous instructions or could relate to the instruction itself. As an example, the load instruction could follow a predicted branch which may or may not be predicted correctly. Alternatively, the unresolved outcome could be whether or not the load instruction will be subject to a permission or data corruption abort. Examples of unresolved predicted outcome results include a memory access permission violation, an alignment error, a precise external abort (e.g. an external access to a device returning an indication that the access was not permitted or completed) or the data value itself having an error therein.
The register renaming recovery logic can store memory mapping recovery data indicative of the changes in register mappings needed to reverse changes in the register mappings made in dependence upon speculatively executed instructions. In this context, the register mapping data can be stored in a first-in-first-out memory which also permits the ordered sequence of changes to be taken from such an ordered memory structure.
It will be appreciated that the above technique can permit the availability for use of a data value returned from a memory to be decoupled from a determination of whether or not the data value is in error.
Viewed from another aspect the present invention provides a method of processing data, said method comprising the steps of:
mapping from register specifiers of an architectural set of register specifiers to registers of a physical set of registers to generate physical register specifiers, said architectural set of register specifiers representing registers as specified by instructions within an instruction set and said physical set of registers being physical registers for use in executing instructions of said instruction set;
executing said instructions using said physical set of registers, at least some of said instructions being speculatively executed based upon respective predicted outcomes of at least one unresolved instruction, said instructions being speculatively executed including load instructions respectively for loading a data value from a memory to a physical register;
in response to detection of a mispredicted speculatively executed instruction as having a mispredicted outcome, returning to a mapping from said set of architectural registers to said set of physical registers that reverses changes made in said mapping that are dependent upon said mispredicted speculatively executed instruction such that said physical registers to which said set of architectural registers are mapped correspond to and contain values of said physical registers to which said architectural registers were mapped prior to execution of said mispredicted speculative executed instruction; and
generating an error signal indicative whether or not an error is detected for said load instructions; wherein
a data value loaded from said memory and stored within a physical register in response to a load instruction is made available for use for further processing before said generating of said error signal;
said load instruction is handled as a speculative instruction until at least said error signal has been generated; and
if said error signal indicates an error, then reversing any changes in said mapping made that are dependent upon said load instruction such that said physical registers to which said set of architectural registers are mapped correspond to and contain values of said physical registers to which said architectural registers were mapped prior to execution of said load instruction.
Viewed from a further aspect the present invention provides apparatus for processing data, said apparatus comprising:
a physical set of registers;
register renaming means for mapping from register specifiers of an architectural set of register specifiers to registers of said physical set of registers to generate physical register specifiers, said architectural set of register specifiers representing registers as specified by instructions within an instruction set and said physical set of registers being physical registers for use in executing instructions of said instruction set;
at least one execution means responsive to instructions and associated physical register specifiers for executing said instructions using said physical set of registers, at least some of said instructions being speculatively executed based upon respective predicted outcomes of at least one unresolved instruction, said instructions being speculatively executed including load instructions respectively for loading a data value from a memory to a physical register;
register renaming recovery means responsive to detection of a mispredicted speculatively executed instruction as having a mispredicted outcome for returning to a mapping from said set of architectural registers to said set of physical registers that reverses changes made in said mapping that are dependent upon said mispredicted speculatively executed instruction such that said physical registers to which said set of architectural registers are mapped correspond to and contain values of said physical registers to which said architectural registers were mapped prior to execution of said mispredicted speculative executed instruction; and
error detecting means responsive to load instructions for generating an error signal indicative whether or not an error is detected for said load instructions; wherein
a data value loaded from said memory and stored within a physical register in response to a load instruction is made available for use for further processing before said error detecting means has been able to generate said error signal;
said load instruction is handled by said register renaming recovery means as a speculative instruction until at least said error detecting means has been able to generate said error signal; and
if said error signal indicates an error, then said register renaming recovery means reverses any changes in said mapping made that are dependent upon said load instruction such that said physical registers to which said set of architectural registers are mapped correspond to and contain values of said physical registers to which said architectural registers were mapped prior to execution of said load instruction.
The above, and other objects, features and advantages of this invention will be apparent from the following detailed description of illustrative embodiments which is to be read in connection with the accompanying drawings.
A renaming recovery unit 26 coupled to the renaming stage 10, the issue stage 12, an ECC detector 24 and various other elements from the execute stage 14 and the writeback stage 16. The renaming recovery unit 26 stores register mapping recovery data indicative of changes in register mappings needed to recover from incorrect execution of speculatively executed instructions which have been subject to register renaming by the renaming stage 10. When a signal is detected indicating a speculative instruction is not properly executed, such as failure of a condition code, misprediction of a branch, an access permission abort etc, then this is signalled back to the renaming recovery circuit 26 which then employs the data stored in respect of the speculative instruction concerned and dependent subsequent instructions that have been subject to remapping to reverse the remapping changes made such that the mapping adopted (and data stored) corresponds to that preceding the incorrectly executed speculative instruction. Physical registers 18 which are storing data values which may be needed for such recovery actions are preserved within the set of physical registers 18 and are not overwritten by being reused in mappings when they no longer represent the current mapping as given in an architectural to virtual mapping table 28 until after recovery using those previous data values and physical registers is no longer a potential possibility.
It will be seen that associated with the load/store unit 22 is a memory management unit 30 and an ECC detector 24. The memory management unit 20 stores access permission data which is used to determine whether or not a load instruction to a particular memory location is or is not permitted depending upon the characteristics associated with that memory location, such as privileged-only modes of access etc. Such an access permission result may be relatively rapidly obtained and is available in this example embodiment at the same time as the data value is returned from the data cache 20 to be loaded into the appropriate one of the physical registers 18. When the data value is returned, if it has passed its access permission test, then it is written into the physical register 18 concerned and is then available for use by subsequent program instructions. This avoids any delay being introduced as a result of further checking that is performed upon the data value itself by the ECC detector 24.
The ECC detector 24 receives the data value returned to the load/store unit 22 and performs error correcting code checking thereon. This takes a finite amount of time to complete and the result of this error checking is not available until some time after the data value has been written to the physical register 18 and has potentially be subject to use by subsequent program instructions. If the ECC detector 24 determines that the data value is corrupted, then it generates an error signal which is passed to the renaming recovery unit 26 to trigger a recovery operation. This recovery operation returns the register mapping to that used prior to the load instruction which has resulted in the failure with the physical registers being pointed to containing the data values which were current at that prior time.
It will be realised that the error detection performed upon the data value could take a variety of forms, including ECC checking and parity checking although other forms of error detection are possible.
It will also be understood from the above that the access permission signal is returned early whereas the data value error signal is returned late. Alternative embodiments could combine these two signals into a single late returned error signal indicative of any form of error associated with the load instruction.
Although illustrative embodiments of the invention have been described in detail herein with reference to the accompanying drawings, it is to be understood that the invention is not limited to those precise embodiments, and that various changes and modifications can be effected therein by one skilled in the art without departing from the scope and spirit of the invention as defined by the appended claims.
Number | Name | Date | Kind |
---|---|---|---|
5625835 | Ebcioglu et al. | Apr 1997 | A |
5751983 | Abramson et al. | May 1998 | A |
6182210 | Akkary et al. | Jan 2001 | B1 |
6463522 | Akkary | Oct 2002 | B1 |
6493820 | Akkary et al. | Dec 2002 | B2 |
6505293 | Jourdan et al. | Jan 2003 | B1 |
6625723 | Jourday et al. | Sep 2003 | B1 |
6772324 | Akkary et al. | Aug 2004 | B2 |
6895527 | Quach et al. | May 2005 | B1 |
7222227 | Katayama et al. | May 2007 | B2 |
20010014941 | Akkary et al. | Aug 2001 | A1 |
20020194457 | Akkary | Dec 2002 | A1 |
20030033511 | Akkary et al. | Feb 2003 | A1 |
20040078559 | Katayama et al. | Apr 2004 | A1 |
20040123081 | Knies et al. | Jun 2004 | A1 |
Number | Date | Country | |
---|---|---|---|
20080109614 A1 | May 2008 | US |