INTEGRITY CHECKING
20250377989 ยท 2025-12-11
Assignee
Inventors
Cpc classification
International classification
Abstract
An apparatus has processing circuitry to execute instructions. The processing circuitry has calculation circuitry which is responsive to one or more instructions requiring a calculation to be performed to compute the result of the calculation and approximation circuitry which is responsive to said one or more instructions to calculate an approximate result of the calculation independently of the calculation circuitry. The processing circuitry also has integrity checking circuitry to perform an integrity check by comparing the result of the calculation performed by the calculation circuitry and the approximate result of the calculation performed by the approximation circuity. The integrity checking circuitry detects an error in the processing circuitry if it is determined that a difference between the result of the calculation and the approximate result of the calculation is greater than a deviation threshold.
Claims
1. An apparatus comprising: processing circuitry to execute instructions; wherein the processing circuitry comprises: calculation circuitry responsive to one or more instructions requiring a calculation to be performed to compute the result of the calculation; approximation circuitry responsive to said one or more instructions to calculate an approximate result of the calculation independently of the calculation circuitry; and integrity checking circuitry configured to perform an integrity check by: comparing the result of the calculation performed by the calculation circuitry and the approximate result of the calculation performed by the approximation circuity; and detecting an error in the processing circuitry in response to determining that a difference between the result of the calculation and the approximate result of the calculation is greater than a deviation threshold.
2. The apparatus according to claim 1, wherein: the processing circuitry is responsive to execution of an integrity checking initiation instruction to cause the approximation circuitry to begin calculating the approximate result in respect of one or more instructions following the integrity checking initiation instruction; and the processing circuitry is responsive to execution of an integrity checking termination instruction to cause the integrity checking circuitry to perform the integrity check.
3. The apparatus according to claim 2, wherein: the calculation operates on one or more operands; the integrity checking initiation instruction specifies one or more registers; and the approximation circuitry is configured to obtain the one or more operands from the one or more specified registers.
4. The apparatus according to claim 1, wherein: the calculation operates on one or more operands; and the approximation circuitry is configured to obtain the one or more operands from one or more predetermined registers.
5. The apparatus according to any preceding claim 1, wherein: the approximation circuitry comprises approximation suitability checking circuitry configured to determine whether a particular calculation is suitable for approximation by the approximation circuitry and to only allow the integrity check to be performed in respect of the particular calculation responsive to determining that the particular calculation is suitable for approximation by the approximation circuitry.
6. The apparatus according to claim 5, wherein: the approximation suitability checking circuitry is configured to determine that the particular calculation is suitable for approximation based on determining that the calculation comprises evaluating a function that is mathematically smooth at a point at which the function is to be evaluated.
7. The apparatus according to claim 5, wherein: the approximation suitability checking circuitry is configured to determine whether a particular calculation is suitable for approximation by the approximation circuitry using at least one of a neural network, a random forest, and a decision tree.
8. The apparatus according to claim 5, wherein: the approximation suitability checking circuitry is configured to identify the calculation as suitable for approximation by the approximation circuitry responsive to determining that the calculation corresponds to an operation from a predetermined list of operations.
9. The apparatus according to claim 1, wherein the approximation circuitry is configured to: maintain calculation result history information based on previous results of calculations computed by the calculation circuitry; and reference the calculation result history information to calculate the approximate result of the calculation.
10. The apparatus according to claim 9, wherein the calculation result history information comprises: an indication of the previous results of the calculations computed by the calculation circuitry; and gradient information indicative of how an operation to be evaluated to carry out the calculation varies in dependence on the inputs to the operation.
11. The apparatus according to claim 10, wherein: the approximation circuitry is configured to calculate the approximate result of the calculation based on a corresponding previous result of the previous results and the gradient information from the calculation result history information.
12. The apparatus according to claim 9, wherein: the approximation circuitry is responsive to the calculation circuitry computing the result of a given calculation to update the calculation result history information based on the result of the given calculation.
13. The apparatus according to claim 12, wherein updating the calculation result history comprises: storing the result of the given calculation; calculating new gradient information based on the result of the given calculation and the previous result; and storing the new gradient information.
14. The apparatus according to claim 1, wherein: the calculation circuitry is an arithmetic logic unit (ALU) or part of an ALU.
15. The apparatus according to any of claim 1, wherein: the calculation circuitry is a floating point unit (FPU) or part of an FPU.
16. The apparatus according to claim 1, wherein: the integrity checking circuitry is configured to obtain the deviation threshold from a system register.
17. The apparatus according to claim 1, wherein: the approximation circuitry is configured to determine a level of confidence association with the approximation; and the deviation threshold is based on the level of confidence.
18. The apparatus according to claim 2, wherein: the processing circuitry is responsive to execution of at least one of the integrity checking initiation instruction and the integrity checking termination instruction specifying a particular deviation threshold to cause the integrity checking circuitry to use the particular deviation threshold as the deviation threshold.
19. A method comprising: executing instructions by processing circuitry; computing, responsive to one or more instructions requiring a calculation to be performed, the result of the calculation; calculating, responsive to said one or more instructions, an approximate result of the calculation independently of the computing; and perform an integrity check by: comparing the result of the calculation and the approximate result of the calculation from; and detecting an error in the processing circuitry in response to determining that a difference between the result of the calculation and the approximate result of the calculation is greater than a deviation threshold.
20. A computer program for controlling a host data processing apparatus to provide an instruction execution environment comprising: processing program logic to execute instructions; wherein the processing program logic comprises: calculation program logic responsive to one or more instructions requiring a calculation to be performed to compute the result of the calculation; approximation program logic responsive to said one or more instructions to calculate an approximate result of the calculation independently of the calculation program logic; and integrity checking program logic configured to perform an integrity check by: comparing the result of the calculation performed by the calculation program logic and the approximate result of the calculation performed by the approximation program logic; and detecting an error in the processing program logic in response to determining that a difference between the result of the calculation and the approximate result of the calculation is greater than a deviation threshold.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Further aspects, features, and advantages of the present technique will be apparent from the following description of examples, which is to be read in conjunction with the accompanying drawings, in which:
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
DESCRIPTION OF EXAMPLES
[0015] Before discussing the examples with reference to the accompanying figures, the following description of examples is provided.
[0016] Intermittent faults in mercurial cores as mentioned above can lead to errors in calculations performed by processing circuitry in a number of possible ways. For example, the intermittent faults may lead to: [0017] data encrypted on one mercurial core only being able to be decrypted by that core; [0018] data becoming corrupted during copying; [0019] violations of lock semantics; and [0020] calculation errors e.g., such that int(1.1{circumflex over ()}53) will return 0 whereas int(1.1{circumflex over ()}52) correctly returns 142.
[0021] The present techniques provide an apparatus for detecting intermittent faults, and in particular for detecting intermittent faults that lead to calculation errors. The detection of such faults can also be referred to as integrity checking.
[0022] One possible approach by which intermittent faults in processing circuitry could be detected involves redundant execution of an application, i.e., running code two or more times and comparing the results obtained. However, such an approach involves large overheads to perform and is particularly costly since each calculation has to be repeated.
[0023] Another possible approach to detecting faults is to provide duplicated computation logic, for example, by providing two cores operating in parallel (referred to as dual core lock step) performing the same workload with the outputs of the cores compared at each cycle. This approach is however expensive in terms of the area and power required since an entire additional core needs to be provided along with circuitry needed to compare the results of the two cores.
[0024] The inventors recognised that in many cases to check the integrity of a particular calculation, a precise value is not needed against which to compare the result obtained by calculation circuitry that has performed the calculation. Rather, it may be sufficient to calculate an approximate result of the calculation and compare the approximate result with the result obtained by the calculation circuitry. If a fault has led to an error in the calculation that has caused sufficient deviation in the result, the approximate result will differ from the obtained result sufficiently that it can be determined that an error has occurred or is likely to have occurred. On the other hand, even if the approximate result differs from the result obtained by the calculation circuitry, if the difference is a relatively small amount, this may indicate that the calculation was likely to have produced the correct result.
[0025] As such, duplicated computation logic such as a separate core does not need to be provided, with the apparatus instead having approximation circuitry able to obtain an approximate result using less power and/or area than would be required to independently calculate another precise result. The approximate result may also be calculated in parallel with the result obtained by the calculation circuitry thereby providing a more efficient process for integrity checking than could be achieved if the calculation were to be repeated one or more times using the same circuitry.
[0026] In accordance with the techniques described herein, there is therefore provided an apparatus comprising processing circuitry to execute instructions. The processing circuitry may comprise a central processing unit (CPU) or graphics processing unit (GPU) or parts thereof. In particular, the processing circuitry may comprise an arithmetic logic unit (ALU) or floating point unit (FPU) as may be found in a CPU or GPU. The processing circuitry has calculation circuitry that is responsive to one or more instructions that require a calculation to be carried out. For example, the calculation circuitry may be a logical unit of an ALU or FPU configured to perform a particular type of calculation. When the processing circuitry executes an instruction that requires that type of calculation to be carried out, the calculation circuitry performs the calculation to compute the result of the calculation.
[0027] However, faults in the calculation circuitry may lead to erroneous results of the calculation being produced. In some cases, the faults may not be obvious which could be the case if the calculation circuitry failed to produce a result entirely, but may instead lead to the calculation circuitry providing incorrect but otherwise valid results of the calculation. This fault may be intermittent in the sense that it causes the result of the calculation to be erroneous in some circumstances or at some times but under other circumstances or at other times, even where the conditions under which the calculation is performed are the same.
[0028] Therefore, to check the integrity of the calculation circuitry itself and determine whether the result of the calculation is likely to be accurate, approximation circuitry and integrity checking circuitry are provided. The approximation circuitry is arranged to independently calculate an approximate result of the calculation against which the result obtained by the calculation circuitry can be compared. This may be done concurrently with the calculation by the calculation circuitry to reduce the performance impact of performing this check.
[0029] Once the result of the calculation from the calculation circuitry and the approximate result from the approximation circuitry are available, the integrity checking circuitry performs the integrity check by comparing the result and the approximate result. Based on the difference between approximate result and the result of the calculation, the integrity checking circuitry may determine whether there is an error in the processing circuitry. This determination as to whether there is an error makes use of a deviation threshold indicative of an expected or tolerable difference between the approximate result and the result from the calculation circuitry. Since the approximate result is not calculated precisely, it is expected that even where the processing circuitry is functioning correctly, there will be some deviation between the approximate result and the result from the calculation circuitry. As such, the deviation threshold provides a way to determine whether this deviation is sufficient to determine that an error has been detected. Thus, while a small deviation between the calculated result from the calculation circuitry and the approximate result may be attributed to the impreciseness of the approximation, if the calculation circuitry produces a result that differs significantly from the expected result determined by the approximation, this may be indicative of a fault in the calculation circuitry (or indeed in the approximation circuitry).
[0030] In response to detecting the error, the integrity checking circuitry could be arranged to take a number of possible actions. For example, the integrity checking circuitry may indicate that the error has been detected by raising an exception or saving a particular value in a register to indicate that the error was detected. This could be used to indicate to software that the error was detected and as such the result of the calculation may be erroneous or to aid in detecting mercurial cores prone to intermittent faults so that these cores can be replaced, for example. Additionally, or alternatively, the integrity checking circuitry may cause the calculation to be repeated.
[0031] In some examples, the integrity check may be initiated based on an integrity checking initiation instruction, thereby allowing the integrity check to be controlled using software. That is, the programmer or compiler may include in program code the integrity checking initiation instruction such that execution of the integrity checking initiation instruction by the processing circuitry causes the integrity check to be carried out.
[0032] This may be implemented using an integrity checking initiation instruction in combination with an integrity checking termination instruction. Where the integrity checking initiation instruction is followed by one or more instructions that cause the calculation circuitry to perform calculations, the execution of the integrity checking initiation instruction causes the approximation circuitry to calculate the approximate result for those calculations. The processing circuitry is then responsive to execution of an integrity checking termination instruction signalling the end of the sequence of instructions for which the integrity check is to be carried out such that the integrity checking circuitry is then invoked to perform the integrity check and compare the results obtained by the calculation circuitry and the approximation circuitry.
[0033] For the calculation circuitry, the location of the operands on which the calculation is based may be specified by the instruction to be executed. For example, a particular form of instruction may indicate a register in which an operand is stored or may indicate a register containing an address in memory from which the operand is to be obtained. It will be appreciated that the operand may be indicated in other manners, for example using offsets or encoded in the instruction itself.
[0034] The approximation circuitry may determine the location of the operands on which it is to operate from the same instructions as described above. However, in some examples, the integrity checking initiation instruction specifies one or more registers containing the operands on which the calculations represented by the subsequent instructions are to operate. In this case, the approximation circuitry is configured to obtain the one or more operands from the one or more specified registers. This approach allows the operands to be located in any of a number of registers that may be provided within the apparatus, thereby providing flexibility regarding where the operands may be stored before invoking the integrity checking mechanism.
[0035] In some examples, to avoid needing to specify the register in the integrity checking initiation instruction however, the one or more operands on which the approximation circuitry is to operate may be predetermined, for example by being defined as architectural behaviour. Thus, in response to the integrity checking initiation instruction, the approximation circuitry may obtain the operands from the predetermined registers.
[0036] In some cases, the approximation circuitry may only be suitable for approximating the result of certain types of calculation that are supported by the calculation circuitry. For other types of calculation that are supported by the calculation circuitry, due to the nature of the calculation and/or the configuration of the approximation circuitry, the approximation circuitry may not be able to determine an approximate result, or may not be able to determine the approximate result with sufficient accuracy to enable the integrity check to be carried out making use of the approximation circuitry.
[0037] In this case, the approximation circuitry may be additionally provided with approximation suitability checking circuitry to determine whether a particular calculation is suitable for approximation by the approximation circuitry. Based on determining whether a particular calculation is suitable or is not suitable for approximation, the approximation suitability checking circuitry is configured to allow or prevent respectively the integrity check to be performed in respect of the particular calculation.
[0038] The approximation suitability checking circuitry may be configured to determine whether a particular is suitable for approximation on the basis of a number of possible factors. In some examples, the approximation suitability checking circuitry makes use of more than one different mechanism to determine whether a calculation is suitable for approximating.
[0039] One such approach involves determining that a particular calculation is suitable for approximation based on determining that the calculation involves evaluating a function that is mathematically smooth at a point at which the function is to be evaluated. The function being mathematically smooth at the point means that the function can differentiated and the derivative evaluated at that point. For example, where the calculation involves raising one operand to the power of another operand, the function being evaluated will be smooth and the function can be differentiated.
[0040] In determining whether a particular calculation is suitable for approximation, the approximation suitability checking circuitry may also take into account the behaviour of the derivative of the function being evaluated such that only calculations involving evaluating functions have a derivate that does not change too quickly are found to be suitable for approximation.
[0041] In some cases the function being evaluated will correspond directly to an instruction that is executed (e.g., where the function comprises addition, an addition instruction may be provided); however, in some cases the function will correspond to several instructions (e.g., if the Instruction Set Architecture does not provide a multiplication instruction, the function may correspond to one or more addition and branch instructions).
[0042] This condition for suitability for approximation may for example be used where the approximation circuitry relies on the derivate of the function to determine the approximate result.
[0043] In some examples, the approximation suitability checking circuitry is configured to determine whether a particular calculation is suitable for approximation by the approximation circuitry using at least one of a neural network, a random forest, and a decision tree. These structures may be trained to recognise functions for which the approximation circuitry will be able to reliably produce an approximate result. These structures may be trained based on the observed results of the calculation circuitry and/or the approximation circuitry for various functions that are evaluated using the apparatus or these structures may be pre-trained before being deployed in the apparatus such that the apparatus is provided with an already trained model to be used by the neural network, random forest, or decision tree.
[0044] Another approach to identifying whether a calculation is suitable for approximation by the approximation circuitry involves identifying the calculation as suitable for approximation based on determining that the calculation corresponds to an operation from a predetermined list of operations. For example, the approximation suitability checking circuitry may be provided with an indication of certain operations (which may correspond to particular instructions or sequences of instructions) that are known to be suitable for approximation using the approximation circuitry. Where the calculation corresponds to such an operation, the approximation suitability checking circuitry may therefore determine that the calculation is suitable for approximation.
[0045] The approximation circuitry itself could make use of various techniques for calculating approximate results. For example, a neural network may be used to determine the approximate results. In some examples however, the approximation circuitry maintains and makes use of calculation result history information based on previous calculations that have been computed by the calculation circuitry. In this way, the approximation circuitry can make use of the results from the calculation circuitry and base the calculation of an approximate result on these previous results. In such cases, the approximation circuitry references the calculation result history information to calculate the approximate result of a calculation.
[0046] The calculation result history information may include an indication of previous results as computed by the calculation circuitry as well as gradient information indicative of how an operation to be evaluated to carry out the calculation varies in dependence on the inputs to the operation. The operation could be a mathematical function or may involve more than one sub operation such that the operation requires one or more functions to be evaluated as part of the calculation. As such, the gradient information may reflect the dependence of the operation as whole, including the functions that form sub-operations of the operation, on the inputs to the operation.
[0047] To calculate an approximate result for a particular calculation, the approximation circuitry may be configured to use a corresponding previous result and gradient information to estimate the result of the calculation with the inputs that are to be used. For example, the approximation may select a previous result obtained using inputs that are similar to the inputs for the calculation to be approximated and then identify a gradient indicative of how the result of the calculation will vary as the inputs are varied. This can then be used to derive an approximate result for the calculation.
[0048] This provides a quick and efficient way of determining an approximate value for the result of the calculation which can be compared with the result provided by the calculation circuitry. If the result from the calculation circuitry and the approximate result differ by more than the deviation threshold, this may be taken as an indication that an error has occurred which may be the result of a fault in the processing circuitry.
[0049] The calculation result history information may be populated by the approximation circuitry based on observed results from the calculation circuitry. Specifically, the approximation circuitry may be responsive to the calculation circuitry computing the result of a given calculation to update the calculation result history based on the result of the given calculation as calculated by the calculation circuitry. For example, the approximation circuitry may store the result of the given calculation and the inputs which led to that result. Based on the result and other results previously obtained for that calculation, the approximation circuitry may also calculate and store new gradient information to be used in calculating approximate results.
[0050] In some examples, the calculation result history information is updated each time a calculation is performed using the calculation circuitry; however, in some examples this update may only be performed for calculations for which an integrity check is carried out.
[0051] The deviation threshold may be obtained in several possible ways. For example, the deviation threshold may be set in a system register such that the integrity checking circuitry is able to obtain the deviation threshold from the system register. Thus, the deviation threshold to be used can be modified by altering the value stored in the register.
[0052] In some examples, the approximation circuitry, as well as determining the approximate result, also determines a level of confidence associated with that approximation. Where the calculation result history was used to make the approximation, this level of confidence could be determined for example based on the difference between the input or inputs for which there was an entry in the calculation result history and the input or inputs on which the calculation was based. Irrespective of how the level of confidence was established, this level of confidence may be used to determine the deviation threshold to use such that where the level of confidence is higher, the deviation threshold is smaller.
[0053] Where the integrity checking initiation instruction and the integrity checking termination instruction are used to control the integrity checking process, at least one of the integrity checking initiation instruction and the integrity checking termination instruction may specify a particular deviation threshold with the processing circuitry responsive to execution of this instruction to cause the integrity checking circuitry to use that particular deviation threshold.
[0054] Particular examples will now be described with reference to the figures.
[0055]
[0056] The execute stage 16 includes a number of processing units, for executing different classes of processing operation. For example the execution units may include an arithmetic/logic unit (ALU) 20 for performing arithmetic or logical operations; a floating point unit (FPU) 22 for performing operations on floating-point values, a branch unit 24 for evaluating the outcome of branch operations and adjusting the program counter which represents the current point of execution accordingly; and a load/store unit 28 for performing load/store operations to access data in a memory system 8, 30, 32, 34. In this example the memory system includes a level one data cache 30, the level one instruction cache 8, a shared level two cache 32 and main system memory 34. It will be appreciated that this is just one example of a possible memory hierarchy and other arrangements of caches can be provided. The specific types of processing unit 20 to 28 shown in the execute stage 16 are just one example, and other implementations may have a different set of processing units or could include multiple instances of the same type of processing unit so that multiple micro-operations of the same type can be handled in parallel. It will be appreciated that
[0057] The apparatus 2 may have one or more faults, arising for example due to issues in manufacturing or ageing of the system. In particular, the processor could have one or more intermittent faults that only occur from time to time and which lead to errors in calculations performed by the apparatus 2.
[0058]
[0059] As such, the integrity checking circuitry 50 is provided to check the results produced by the calculation circuitry 40. Rather than having the calculation circuitry 40 repeat the calculation to check the correctness of the calculation just performed or providing replicated circuitry able to carry out a parallel calculation of the result and comparing the results, the integrity checking circuitry 50 is provided with approximation circuitry 60 arranged to calculate an approximate result of the calculation against which the result computed by the calculation circuitry 40 can be compared as shown in comparison 64. Since the approximation circuitry 60 is not expected to produce a precise result for the calculation, when comparing 64 the approximate result and the result from the calculation circuitry 40, a deviation threshold is used such that if a difference between the result from the calculation circuitry 40 and the approximation exceeds the deviation threshold, an error is indicated, which may be indicative of a fault that has been detected in the processing circuitry 4.
[0060] The difference may be considered to exceed the deviation threshold if the difference is greater than a particular value or may be considered to exceed the deviation threshold if the difference is greater than or equal to a particular value.
[0061] Although various mechanisms may be provided for calculating the approximate result, as shown in
[0062] The approximation circuitry 60 is arranged to update the calculation result history information 62 based on the results of calculation circuitry 40. In some cases, the integrity checking circuitry 50 is not invoked to carry out an integrity check on every calculation performed by the calculation circuitry 40. In this case, the approximation circuitry 60 may nonetheless update the calculation result history information 62 when a calculation is performed, even if no integrity check was performed. However, to avoid populating the calculation result history information 62 with result information for which no integrity check was carried out, in some examples, the approximation circuitry 60 is configured to only update the calculation result history information 62 in cases where the integrity check was invoked.
[0063] Since the calculation result history information 62 is populated from the results of the calculation circuitry 40 in the example of
[0064] In some cases, the approximation circuitry 60 may not be suitable for approximating all of the calculations that can be performed by the calculation circuitry 40. As such, approximation suitability checking circuitry 52 is provided to determine for which calculations the approximation circuitry 60 will be able to provide a reliable approximation of the result.
[0065] If the integrity checking circuitry 50 is invoked for a calculation that the approximation suitability checking circuitry 52 determines is not suitable for approximation, the approximation suitability checking circuitry 52 may suppress the integrity check operation for that calculation. On the other hand, if the approximation suitability checking circuitry 52 determines that the calculation can be approximated by the approximation circuitry 60, the approximation suitability checking circuitry 52 allows the integrity check operation to proceed.
[0066] The determination as to whether a particular calculation can be accurately approximated could be performed in a number of ways. For example, the approximation suitability checking circuitry 52 could operate based on smoothness detection 54 and may be configured to determine whether the calculation involves evaluating a function that is mathematically smooth at the point at which the function is to be evaluated. The smoothness of the function may enable a gradient to be calculated and as such the dependence of the result of the calculation on variation in the inputs. Hence, where the calculation involves evaluating a smooth function, the approximation circuitry 60 may be able to determine the approximate result using a nearby result from the calculation result history information 62 and gradient information.
[0067] In some examples however, the approximation suitability checking circuitry 52 makes use of a list of suitable operations 56 such that if the calculation consists of suitable operations for approximating, the approximation suitability checking circuitry 52 will allow the result to be approximated by the approximation circuitry 60. In some examples, the approximation suitability checking circuitry 52 makes use of a neural network, a random forest, or a decision tree 58. These structures may be trained in situ using data observed from the operation of the processing circuitry 4, or may be provided already trained such that the neural network/random forest/decision tree is already able to classify calculations to be performed as suitable for approximation or otherwise.
[0068]
[0069]
[0070] As shown in
[0071] The integrity checking circuitry 40 may be arranged to obtain the arguments from predetermined registers (e.g., from the first two general purpose registers in the register file 14) or the START_IC instruction may in some examples indicate the location of the arguments.
[0072] Once the START_IC instruction has been used to indicate the start of the calculation to be subject to integrity checking, the following instructions (not shown) are used to cause the processing circuitry 4 and specifically the calculation circuitry 40 to perform the calculation. To indicate to the integrity checking circuitry 50 that the calculation to be subject to the integrity check operation is complete, an integrity checking termination instruction, the END_IC instruction is provided. Responsive to the integrity checking termination instruction, the integrity checking circuitry 50 is configured to perform the comparison 64 between the result from the calculation circuitry 40 and the approximate result.
[0073] Thus, the programmer or the compiler can indicate that an integrity check is to be carried out for a particular calculation and the extent of the instructions representing the calculation.
[0074]
[0075]
[0076] If the integrity check is to be performed, the calculation circuitry 40 proceeds with calculating the result at step 606. The approximation circuitry 60 also calculates an approximate result at 604. These results are then compared at step 608 where it is determined whether the difference between the result and the approximate result exceeds a deviation threshold. If the difference does not exceed the threshold, the calculation is deemed to have passed the integrity check. At this point, the result of the calculation may be used to populate the calculation result history information 62.
[0077] If on the other hand, the difference between the result and the approximate result does exceed the deviation threshold, the integrity checking circuity 50 determines at step 610 that an error has occurred.
[0078] The error may be indicated by writing a value to a register in the register file 14 or by raising an exception for example. The error may be indicative of a fault in the processing circuitry 4 and so may be used as the basis of a decision to replace the processing circuitry 4 or otherwise compensate for the fault. However, since the determination of the error was made on the basis of an approximation, the determination of a single error may not be sufficient to conclusively establish that a fault exists and the presence of a fault may instead be established only in the case of repeated errors detected by the integrity checking circuitry 50.
[0079]
[0080] To the extent that embodiments have previously been described with reference to particular hardware constructs or features, in a simulated embodiment, equivalent functionality may be provided by suitable software constructs or features. For example, particular circuitry may be implemented in a simulated embodiment as computer program logic. Similarly, memory hardware, such as a register or cache, may be implemented in a simulated embodiment as a software data structure. In arrangements where one or more of the hardware elements referenced in the previously described embodiments are present on the host hardware (for example, host processor 714), some simulated embodiments may make use of the host hardware, where suitable.
[0081] The simulator program 704 may be stored on a computer-readable storage medium (which may be a non-transitory medium), and provides a program interface (instruction execution environment) to the target code 702 (which may include applications, operating systems and a hypervisor) which is the same as the interface of the hardware architecture being modelled by the simulator program 704. Specifically, the simulator program 704 contains simulator code to provide processing program logic 706, calculation program logic 708, and approximation program logic 710 corresponding to the processing circuitry 4, calculation circuitry 40, and approximation circuitry 60 respectively. Thus, the program instructions of the target code 702, including the integrity checking initiation instruction and the integrity checking termination instruction described above, may be executed from within the instruction execution environment using the simulator program 704, so that a host computer 714 which does not actually have the hardware features of the apparatus 2 discussed above can emulate these features.
[0082] Thus, there has been described a mechanism for quickly and efficiently checking the results of a calculation performed by the processing circuitry 4 that avoids the need for the entire calculation logic to be replicated or the calculation to be performed more than once. The integrity checking operation can also be selectively employed with instructions provided to indicate to the processing circuitry 4 whether the integrity checking operation is to be carried out.