BACKGROUND OF THE INVENTION
1. Field of the Invention
This invention relates to a method and apparatus for correcting errors in encoded uncorrected data in a storage device, and more particularly to a method and apparatus using a unique implementation involving look-up tables for decoding syndromes of error indicative of at least two errors in said data.
2. Description of Background Art
The following references disclose basic theories and various methods and arrangements for correcting errors in storage devices: W. W. Peterson, Error-Correcting Codes, M.I.T. Press, 1961; R. C. Bose and D. K. Ray-Chaudhuri, "On a class of error-correcting binary group codes", Inf. Control 3, pp. 68-69, 1960; I. S. Reed and G. Solomon, "Polynominal codes over certain finite fields", J. Soc. Indust. Appl. Math 8, pp. 300-304, 1960; and R. T. Chien, "Cyclic decoding procedures for Bose-Chaudhuri-Hocquenghem codes", IEEE Trans. Inf. Theory, Vol. IT10, pp. 357-363, 1964.
In the copending application U.S. Ser. No. 781,449, filed Sept. 27, 1985 (now U.S. Pat. No. 4,706,250, issued Nov. 10, 1987), assigned to the assignee of the present invention, there is disclosed a two-level error correction code structure in an improved multibyte error-correcting subsystem. Data is formatted on a disk track into a number of subblocks, each within a respective block. There are also two sets of three subblock check bytes C.sub.1, C.sub.2 and C.sub.3. One set is associated with the even phase and the other with the odd phase, thus providing interleaved codewords. With this arrangement, the first level of correction (of subblock errors) is done on-the-fly at the storage device after being delayed one subblock, and the data is sent to the storage director for correction of any second level (block) errors. This on-the-fly correction is suitable only for systems operating in an asynchronous environment. The second (block) level correction is carried out using one additional check byte C.sub.0 for each phase at the end of the block.
The aforementioned copending application discloses hardware in a disk storage device that receives uncorrected data in real time and generates three first-level syndrome bytes and one second-level syndrome byte (corresponding to each phase). The first-level syndromes are decoded at the device into error pattern and error location information that is transmitted to a storage director.
This aforementioned application describes how the system functions if there are no errors in any subblock, and how errors are corrected if there is not more than one error per subblock and if there is more than one error per subblock. More specifically, syndromes S.sub.1, S.sub.2, S.sub.3 corresponding to each phase associated with a particular subblock codeword are held in a local memory. They are retained for further processing at the block level if that particular subblock's syndromes were not all zeros and no nonzero error pattern was generated by a first level decoder. The local memory also retains the identification of an uncorrected subblock as subblock identifier "f". At the end of the block, a second level syndrome, S.sub.0, from a second level syndrome generator and the first level syndromes S.sub.1, S.sub.2, S.sub.3 for subblock f from the local memory are processed by a second level decoder to correct two errors in subblock f.
There is a need for a less expensive, yet efficient, method and apparatus which uses unique look-up tables implemented in firmware or software to decode the syndromes for two-byte errors in a record of a predetermined number of bytes, in which each byte contains a desired preselected number of bits; e.g., two-byte errors in any one subblock of a two-level code format similar to that described in said copending application.
SUMMARY OF THE INVENTION
Toward this end and according to the invention, a method and apparatus is provided for correcting up to two byte errors in encoded uncorrected data in records of a predetermined length (such as a preidentified subblock of a block in the case of a multi-level error correction code format). The data is read from a storage device and corrected by decoding and processing four syndromes of error (S.sub.1, S.sub.2, S.sub.3, S.sub.0) that are generated by means disclosed in the aforementioned copending application. These syndromes are decoded in response to uncorrected errors in any one record by computing vectors P, Q and R, which are functions of the four syndromes. Binary numbers u and v are then calculated from these vectors by table look-up to enable calculation of a value of d from the sum of said binary numbers toward determining error locations. A value t, having a specific mathematical relation to the value of d, is then determined by table look-up and the error location values y and z are calculated from the offset of binary numbers u and v from the value t. Finally, the error patterns E.sub.y and E.sub.z are determined by table look-up.
As illustrated, and more specifically, errors in encoded uncorrected data in a disk storage device are corrected using a multiple level error correction code formatted into a block containing a number of subblocks. During a read operation, first level syndromes of error (S.sub.1, S.sub.2, S.sub.3) for each subblock and an additional second level syndrome (S.sub.0) common to all subblocks of the block are generated by hardware in the storage device. The first level syndromes are decoded by table look-up to provide first level error pattern and location information. The second level syndromes are decoded by computing vectors that are functions of the first and second level syndromes. The second level error locations and error patterns are determined by software or firmware using look-up tables. Any correction of errors, if needed, is done later by sending error information in a deferred mode.
The foregoing and other objects, features and advantages of the invention will be apparent from the following more particular description of a preferred embodiment of the invention as illustrated in the accompanying drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates a data format of a disk track that embodies a two-level code structure used in connection with the present invention.
FIG. 2 is a block diagram of the first and second level correcting portions of an ECC apparatus according to one embodiment of the invention showing flow of the data and depicting the hardware resident in the storage device and software resident in the storage director.
DESCRIPTION OF PREFERRED EMBODIMENT
FIG. 1 illustrates the data format of a disk track that embodies a two-level code structure implementing the present invention. As illustrated, data is recorded along a track 11, formatted into a plurality of fixed or variable length blocks 12. Each block 12 is divided into fixed length subblocks 14. As illustrated, each subblock 14 comprises two interleaved codewords 18, 19. Each codeward 18, 19 comprises 48 data byte positions and three subblock check bytes C.sub.1, C.sub.2, C.sub.3. Each block 12 thus comprises subblocks, each having 96 (two pairs of 48) data byte positions and three pairs of subblock check bytes C.sub.1, C.sub.2, and C.sub.3. In addition, four check bytes CR.sub.1 -CR.sub.4 for data integrity checking after ECC correction and one pair of check bytes C.sub.0 for second level error correction are appended to the end of each block 12 in a block check byte area 15. The manner in which the error correction check bytes C.sub.1 -C.sub.3 in each subblock 12 and check bytes CR.sub.1 -CR.sub.4 and C.sub.0 at the end of each block 12 are determined and produced forms no part of the present invention. The reader is referred to the aforementioned copending application, for a detailed explanation. In the following description of this invention, all process steps will be described for one of the two phases (even or odd); however, it is to be understood that the same steps and process are repeated for the other phase.
Referring now to FIG. 2, data from a data processing system (not shown) is sent via a control unit or storage director 20 to storage disk 21 of a disk storage device 100 for writing on a track which is formatted as shown in FIG. 1. In the writing and transfer of this data, three sets of check bytes C.sub.1, C.sub.2 and C.sub.3 are developed for each subblock by an ECC encoder 22. Block check byte C.sub.0 (and data integrity check bytes CR.sub.1 -CR.sub.4) are also developed by encoder 22. A subblock formatter 22A appends check bytes C.sub.1, C.sub.2 and C.sub.3 to each corresponding subblock. A block formatter 22B appends block check byte C.sub.0 (as well as data integrity check bytes, CR.sub.1 -CR.sub.4) at the end of the block. The formatted data is then recorded on storage disk 21. Computation and processing of the data integrity check bytes CR.sub.1 -CR.sub.4 forms no part of the present invention and is described in U.S. Pat. No. 4,703,485, issued Oct. 27, 1987, assigned to the assignee of the present invention.
In the readback process, the read data are checked by coding equations (1), (2), (4) and (5) in the aforementioned copending application in order to develop the syndromes of error in the conventional manner. Subblock check bytes C.sub.1, C.sub.2 and C.sub.3 are associated with syndromes S.sub.1, S.sub.2 and S.sub.3, while block-level check byte C.sub.0 is associated with the S.sub.0 syndrome byte.
The subscript numbers assigned to the syndromes, e.g., S.sub.0, S.sub.1, etc., are related to the particular T matrix employed to generate the respective check characters. Specifically, S.sub.0, which is developed from C.sub.0, corresponds to a conventional parity check byte. S.sub.3, on the other hand, is developed from C.sub.3 which is generated in accordance with logic that involves multiplying the input byte by a matrix T.sup.3. Syndromes S.sub.1 and S.sub.2, which correspond to check bytes C.sub.1 and C.sub.2, respectively, are similarly generated, using logic which involves matrices T.sup.1 and T.sup.2, respectively. Such logic for syndrome generation is well known and forms no part of the present invention.
During the readback process, uncorrected data is read from disk 21 to a first level syndrome generator 23 and a second-level syndrome generator 25 which generate first-level syndrome bytes S.sub.1, S.sub.2, S.sub.3 for each subblock and a second-level syndrome S.sub.0 common to all subblocks of the block. The syndrome bytes S.sub.1, S.sub.2, S.sub.3 are transmitted to a first level decoder 24 in storage director 20 for decoding into error pattern data. The software-implemented decoding process for decoder 24 is described below in a separate section entitled "First Level Decoding Process".
Briefly, a nonzero value for S.sub.1, S.sub.2 or S.sub.3 indicates an error. If a subblock has only one byte in error, its location x and error pattern E.sub.x, as determined by decoder 24, will be supplied to the software 26 for correction of the appropriate byte fetched from subblock buffer 27. After correction, this byte is restored into buffer 27. The error pattern E.sub.x will also be stored in local memory 28 for each of the subblocks that obtained first-level correction of one error. The second-level syndrome S.sub.0 will be modified by software at 29 to include the error pattern information E.sub.x corresponding to all of the corrected subblocks. When decoder 24 has received a nonzero value for S.sub.1, S.sub.2 or S.sub.3 and is unable to correct the subblock, it indicates the presence of more than one error in the subblock by providing a subblock identifier f to the local memory 28. The unprocessed syndromes S.sub.1, S.sub.2 and S.sub.3 for subblock f are also passed on to the local memory for later processing by the second-level decoder. Second-level decoding software 30 will combine syndrome S.sub.0 with the syndromes S.sub.1, S.sub.2, S.sub.3 from local memory 28 and convert these combined inputs by table look-up into outputs y and z indicative of the error locations and E.sub.y and E.sub.z indicative of the error patterns. These outputs y, z, E.sub.y, E.sub.z will be combined with the identifier f of the subblock in error for causing the bytes in error B.sub.y and B.sub.z to be corrected. The second-level error correction software 31 fetches the subblocks from the buffer 27 and delivers corrected data by providing correction of bytes B.sub.y and B.sub.z of subblock f using the error location information y,z and error patterns E.sub.y and E.sub.z.
And now the inventive concept will be explained more specifically. The basic two-level ECC scheme, as described in the aforementioned copending application has n subblocks in a block with N bytes in each subblock. The capability at the first level of decoding provides correction of up to one byte error in each of the subblocks. The capability, including the second level of decoding provides correction of up to two-byte errors in one subblock and one-byte error in all other subblocks in a block.
The basic error event is a "byte in error". A burst error may cause correlated errors in adjacent bytes; however, sufficient interleaving is assumed to effectively randomize these errors. With appropriate interleaving, all bytes are assumed equally likely to be in error as seen by the error correction code (ECC) scheme. Each byte contains a preselected number of bits m; the corresponding operations for the error correction code will be carried out in a finite field, GF(2.sup.m), of 2.sup.m elements. As illustrated, m is 8 and the finite field, GF(2.sup.8), has 256 elements.
Mathematical Background--Logarithms of Field Elements
Let G(x) denote a primitive polynominal of degree 8 with binary coefficients.
The companion matrix of the polynominal G(x) is defined as the following nonsingular matrix: ##EQU1##
The matrix T.sup.i denotes T multiplied by itself i times and all numbers reduced modulo-2. The matrices T, T.sup.2, T.sup.3, . . . , T.sup.255 are all distinct, and T.sup.255 is the identity matrix, which can also be written as T.sup.0. These 255 matrices represent (2.sup.8 -1) nonzero elements of GF(2.sup.8). Let .alpha. denote the primitive element of GF(2.sup.8). Then T.sup.i represents the nonzero element .alpha..sup.i for all i. The zero element is represented by the 8.times.8 all-zero matrix. The sum and product operations in GF(2.sup.8) are, then, defined by the modulo-2 matrix-sum and matrix-product operations, using these matrix representations of the field elements.
The elements of GF(2.sup.8) can also be represented by the 8-digit binary vectors. The square matrices in the above representation are very redundant. In fact, each matrix can be uniquely identified by just one of its columns (in a specific position), which can very well be used for representation of the corresponding field element without ambiguity. In particular, the first column of each 8.times.8 matrix in the above set is the commonly used 8-digit vector representation of the corresponding field element. This establishes a one-to-one correspondence between the set of all nonzero 8-digit vectors and the set of T.sup.i matrices representing the field elements .alpha..sup.i. Thus, each nonzero 8-digit vector S corresponds to a unique integer i (0.ltoreq.i.ltoreq.254) which can be regarded as its logarithm to the base .alpha..
Appendix A.1 is a table of logarithms which maps all field elements into powers of .alpha.. Appendix A.2 is a table of antilogarithms which maps integer powers of .alpha. into corresponding field elements. These tables were generated, using the following companion matrix T as the representation for the base element .alpha.: ##EQU2##
With the help of these tables, the product A.sub.1 .sym. A.sub.2 (of the two elements represented by 8-digit vectors A.sub.1 and A.sub.2) can be computed as follows: ##EQU3##
Each table requires a memory of 8.times.256 bits in which the word number or memory location expressed as 8-bit vector is the input vector. The stored 8-bit vector in that memory location represents the logarithm and the antilogarithm corresponding to the input vector in the two tables, respectively. Note that A=0 (the all-zero vector) cannot be processed using the log and antilog tables. Thus, it should be treated as a special case as follows: Multiplication by zero always produces zero and division by zero should not be permitted.
First-Level Decoding Process: Single Error Correction
As illustrated herein, decoding of first level errors can be accomplished using a software method involving table look-up operations.
A nonzero value for S.sub.1, S.sub.2 or S.sub.3 indicates the presence of error. Assume the subblock has only one byte (byte x) in error; then the read byte B.sub.x corresponds to the written byte B.sub.x as
where E.sub.x is the error pattern in the byte x
When the subblock has only one byte (byte x) in error, the syndromes are related to E.sub.x as
In this method, equations (2), (3) and (4) are viewed as relations among field elements in GF(2.sup.8). In particular, the matrix multiplication of the type T.sup.i B represents the product of field elements .alpha..sup.i and .beta., where .alpha..sup.i is represented by the first column of matrix T.sup.i, and .beta. is represented by the column vector B.
The product operation in GF(2.sup.8) has been discussed above, with reference to the log and antilog tables (Appendices A.1 and A.2 respectively) to the base .alpha., where .alpha. is a primitive field element. With the help of these tables, the error-position or location value x can be computed from Equations (2), (3) and (4) as follows:
And the error pattern E.sub.x can be computed from Equations (2) and (5) as:
All terms in Equations (5) and (6) are 8-digit binary sequences. In modulo-255 computations, subtraction of an 8-digit binary number is equivalent to addition of its complement. For this, it is convenient to use an 8-digit binary adder with end-around carry, in which the 8-digit all-ones sequence (value 255) represents the number zero, and a high-order carry (value 256) is equivalent to the number one.
Each computation of x requires two references to the log table (Appendix A.1) and one modulo-255 subtract operation. Similarly, the computation of E.sub.x requires one reference to the antilog table (Appendix A.2). The byte B.sub.x is then corrected as B.sub.x +E.sub.x.
Note that if S.sub.1 =S.sub.2 =0 and S.sub.3 .noteq.0 then the error is in check byte C.sub.2. In Equation (5), x is computed two ways, the result of which must be the same; otherwise there are more than one bytes in error. Also, if S.sub.1 .noteq.S.sub.2 and S.sub.1 or S.sub.2 is zero, then there are more than one bytes in error. The subblock in that case has errors but remains uncorrected through the first level processing. Such subblock is identified by the subblock number f and the corresponding syndromes S.sub.1, S.sub.2, S.sub.3 are stored in local memory and passed on for later second level processing.
Second-Level Decoding Process: Two-Error Correction
Assume only one subblock contains two bytes in error denoted by y and z with error patterns E.sub.y and E.sub.z, respectively. The syndromes S.sub.0, S.sub.1, S.sub.2 and S.sub.3 are related to E.sub.y and E.sub.z as follows:
The first level processing for the corresponding subblock will have detected these errors as a multiple error. With S.sub.1, S.sub.2 and S.sub.3 available at the subblock-level, the subblock-level processing of syndromes will not miscorrect these errors as a one-symbol error E.sub.x in position x.
To decode the combined set of subblock and block-level syndromes for two-symbol errors, see Appendix B which explains, the theory behind the decoding algorithm. First, vectors P, Q and R are obtained. As illustrated, they are 8-digit constants which are functions of the syndromes S.sub.0, S.sub.1, S.sub.2, and S.sub.3, as given by:
where .circle..times. denotes the product operation of the field elements in GF(2.sup.8), and the field elements are represented by binary 8-digit vectors. The product operation can be realized using hard-wired logic or through the use of log and antilog tables in GF(2.sup.8).
Note that P, Q, and R are necessarily nonzero when there are two bytes in error and both are in data bytes of the subblocks. In contrast, when the check byte C.sub.1 or C.sub.2 is among the two erroneous bytes, this is indicated by P=0 and R=0, respectively.
Assume now that there are exactly two erroneous bytes in one of the subblocks. Then the error-location values y and z are two unique solutions of i in the equation:
where P, Q, and R are functions of the syndromes S.sub.0, S.sub.1, S.sub.2, and S.sub.3, as given by Equations (11) to (13).
For each of the two solution values of i, the error pattern is given by:
The proof of this appears in Appendix B.
According to an important feature of the invention, decoding of the combined set of subblock and block-level syndromes for two-symbol errors can be accomplished using a software method involving table look-up operations. Vectors P, Q and R are computed from syndromes S.sub.0, S.sub.1, S.sub.2 and S.sub.3, using the log and antilog tables of Appendices A.1 and A.2, respectively. This requires, at the most, eighteen references to the tables in memory, six binary-add (modulo-255) operations, and three vector-add (modulo-2) operations.
The error-location values y and z can be obtained through a simple table look-up procedure. The table and the theory behind this procedure appear in Appendix C. In this method, the error-location values y and z are obtained through the following four-step procedure.
Step 1: Obtain two binary numbers u and v from vectors P, Q, and R, using log and antilog tables Appendices A.1 and A.2, respectively.
Step 2: Calculate the value d from the sum of said two binary numbers as a step toward determining the locations of the two errors, as follows:
Step 3: Obtain the value t, having a specific mathematical relation to value d, from the table of Appendix C.1.
Step 4: Obtain error-location values y and z by calculating the offset of said binary numbers from the value t, as follows:
All terms in Equations (16) to (20) of the above procedure are 8-digit binary sequences undergoing modulo-255 add or subtract operations. The procedure requires four table look-up operations, four modulo-255 subtact operations, and one modulo-255 add operation. In this procedure, an invalid value of d (the one with no entry in Appendix C.1) or an invalid error location value for y or z (greater than m+1) indicates an uncorrectable error involving three or more bytes in error.
The error pattern E.sub.y can be computed using the log and antilog tables (Appendices A.1 and A.2, respectively) in accordance with Equation (15), in which matrix multiplication T.sup.2y S.sub.0 is replaced by the corresponding field element given by the product .alpha..sup.2y .circle..times. S.sub.0 of two field elements.
The error pattern E.sub.z can be computed similarly, using Equation (15) or alternatively from Equation (9), which gives:
The subblock error correction is then accomplished by correcting bytes B.sub.y and B.sub.z with error patterns E.sub.y and E.sub.z.
While the embodiment, as illustrated, assumed a two-level code structure in which a one-byte error in a codeword is correctable at the first level and a two-byte error in a codeword is correctable at the block level, it should be understood that the method and apparatus may be used to correct two byte errors in any single or multi-level code structure.
It should also be recognized that the disclosed method and apparatus will also operate to decode the syndromes for two-byte errors in a record of a predetermined number of bytes, in which each byte contains a preselected number of bits.
Also, while the method and apparatus, as disclosed, correct errors in encoded uncorrected data in a magnetic disk storage device, they are equally applicable to a tape or optical storage device.
Finally, it should be understood that, if preferred, in lieu of the software implementation herein described, decoding of first level (single) errors may be accomplished by hardware, such as disclosed in U.S. Pat. No. 4,525,838, issued June 25, 1985, assigned to the assignee of the present invention.
It will therefore be understood by those skilled in the art that the foregoing and other applications and/or implementations may be made to the method and apparatus herein described without departing from the spirit, scope and teaching of the invention. Accordingly, the method and apparatus herein disclosed are to be considered merely as illustrative and the invention is to be limited only as specified in the claims.
While the invention has been particularly shown and described with reference to a preferred embodiment thereof, it will be understood by those skilled in the art that various other changes in the form and details may be made therein without departing from the spirit and scope of the invention.
APPENDIX B
Theory for Decoding Two-Symbol Errors
This Appendix B provides the background for the decoding algorithm for two-symbol errors. This is derived from the well-known prior art method called Chien Search in decoding the generalized BCH code, which is described in the Chien paper cited above in the "Background Art" section.
Assume that there are exactly two erroneous bytes in one of the subblocks. The following proof will establish that error-location values y and z are two unique solutions of i in the equation:
where P, Q and R are functions of syndromes S.sub.0, S.sub.1, S.sub.2 and S.sub.3, as given by Equations (11)-(13). The error patterns E.sub.i for i=y or i=z each satisfies the following equation:
Proof: The syndromes are expressed as functions of the two errors in Equations (7)-(10). These equations are rewritten here as:
Combining appropriate equations from (B-3) through (B-6), we have:
Matrix Equations (B-7), (B-8), and (B-9) are relations among field elements in GF(2.sup.8) represented by matrices. In particular, the matrix multiplication of the type T.sup.i B represents the product of field element .alpha..sup.i and .beta., where .alpha..sup.i is represented by the first column of matrix T.sup.i, and .beta. is represented by the column vector B. In view of this interpretation, Equations (B-7), (B-8), and (B-9) yield the following relationship:
where .circle..times. denotes the product of corresponding elements in GF(2.sup.8). The Equation (B-10) can be rearranged into the following matrix equation:
In these equations, P, Q and R are column vectors given by:
Thus y is one of the solutions for i in the equation
By exchanging the variables y and z in the above process, it can be shown that z is the second solution for i in Equation (B-15).
Equation (B-2) for each error pattern can be verified by direct substitution of values for R, S.sub.0, S.sub.1 and S.sub.2. Both sides of
Equation (B-2) reduce to the expression:
thereby completing the proof.
APPENDIX C
Table Look-up Solution for Two Error Locations
In Appendix B, it was shown that the error locations y and z for two errors in a subblock can be determined by solving for i in Equation (B-1). That equation is rewritten here as:
The constants P, Q and R are functions of syndromes S.sub.0, S.sub.1, S.sub.2 and S.sub.3, given by Equations (B-12)-(B-14), respectively. We can obtain logarithms of P, Q and R from the log-antilog tables of Appendices A.1 and A.2.
Then the matrix Equation (C-1) can be rewritten as a relation among field elements in GF(2.sup.8) as follows:
Multiplying both sides of Equation (C-5) by .alpha..sup.p-2q, we obtain:
Substituting t for (-i+p-q) in Equation (C-6), gives
where u=p-q
The right-hand side of Equation (C-7) is a known field element .alpha..sup.d, in which the exponent d is:
where u=p-q, and v=r-q
A table look-up solution is then provided for Equation (C-7) which can be rewritten as:
Using this expression, each value of t (from 0 to 254) can be related to a value of d. Note that some values of d are absent in this relationship, and that each valid value of d corresponds to two values of t. For a given value of d, if t=t.sub.1 is one of the solutions of Equation (C-10), then it is apparent that t=t.sub.2 is also a solution where:
Substituting t=t.sub.1 in Equation (C-10) and then using (C-11),
Thus,
From equations (C-8), (C-9) and (C-13), the following two error location values i.sub.1 and i.sub.2 are obtained:
Appendix C.1 relates each valid value of d to one of the two values of t. Values of d are listed in ascending order for easy reference as addresses of an 8.times.256-bit memory. The corresponding value of t is stored in memory as an 8-bit binary number. The all-zeros vector (invalid value shown by dashes in the table) is stored at addresses corresponding to the invalid values of d, and is so interpreted.
In case of two errors, the computed value of d fetches one of the two values for t from Appendix C.1. With this one value of t, Equations (C-14) and (C-15) provide the two values of i as the error locations y and z. An invalid value of d fetches t=0 from Appendix C.1, which is interpreted as an uncorrectable error involving three or more bytes of the codeword.