Method for correction of errors in a binary word stored in multi-level memory cells, with minimum number of correction bits

Abstract: The method for correction comprises the step of executing the following steps, for each set of bits in the binary word stored in a single memory cell: a) assigning, to each single error, an error code which is not assigned to other errors; b) for each sub-set of multiple errors, carrying out the following steps: b1) assigning to the sub-set of multiple errors an error code, which is dependent on the error codes assigned to each of the individual errors in the sub-set itself; b2) checking whether the error code assigned to the said sub-set has already been assigned to other errors; b3) if the error code assigned to the said sub-set has already been assigned to other errors, carrying out the following steps: b31) rejecting the error code assigned to the said sub-set, and at least one of the error codes assigned to one of the single errors in the sub-set itself; b32) assigning to the single error assigned to the error code rejected, a new error code, which is not assigned to other errors; and b33) repeating the steps from b1) to b3), until the error code assigned to the sub-set of multiple errors is not assigned to other errors.

Description: The present invention relates to a method for correction of errors in a binary word stored in multi-level memory cells, with minimum number of correction bits. In order to detect and correct errors in a binary word which contains m bits, which is indicated hereinafter as a source word, techniques are known which are based on the addition of "redundancy" to the source word, i.e. techniques based on the assignation to the source word, and consequent storage, of a binary word which contains k bits, and is indicated hereinafter as the correction word, in which the k bits are obtained by carrying out k parity checks on k sub-groups selected appropriately from the m bits in the source word. This assignation is carried out in the so-called coding process, in which the 2 m possible source words, which can be defined by means of m bits, are mapped in a set of an equivalent number of binary words of m+k bits, which are indicated hereinafter as the code words, each of which can be obtained by disposing a source word and the corresponding correction word one after the other and is then stored in the memory. The value of each of the k correction bits assigned during the coding process depends on the type of parity check carried out. For example, the values of the k correction bits can be assigned according to the so-called even parity checking criterion, i.e. to the bit in the i-th position in the correction word is assigned the logic value 0 or 1 according to whether in the i-th sub-group there is respectively an even or odd number of logic values 1, or the values can be assigned according to the so-called odd parity checking criterion, i.e. to the bit in the i-th position in the correction word is assigned the logic value 0 or 1 according to whether in the i-th sub-group there is respectively an odd or even number of logic values 1. The decoding process, in which, on the basis of a code word containing m+k bits stored, there is determination of the corresponding source word with m bits, with detection and correction of any errors which have been generated in it during the storage period, is carried out by executing once again the k parity checks on the bits in the source word, and comparing the correction word thus obtained with the correction word which is read by the memory, in order to generate a check word, which is also of the binary type and indicates the position of the error(s) present in the source word. In detail, in the decoding process the i-th bit in the correction word, which is obtained by executing the i-th parity check on the i-th sub-group of the binary source word, is compared with the bit which is present in the i-th position in the correction word read by the memory and the logic value 0 or 1, according to whether the two bits compared are respectively the same as one another or different, is then assigned to the i-th bit in the check word. The check word is then compared with a plurality of error codes, each of which is constituted by a binary word which has the same length as the check word and is assigned to a bit or a group of bits in the source word and in the correction word and is thus indicative of the position of this bit or group of bits. If there is an error, the check word is identical to one of the error codes, and thus, by means of the said assignation, it is possible to identify the incorrect bit(s). With the bits in an error code having the logic value 1, there is associated a meaning which is linked to the composition of the sub-groups in the source word, of which the parity is to be checked. In particular, a bit which is at the logic level 1 in the i-th position in the error code is indicative of the fact that the bit in the source word, which is located in the position associated with this error code, is part of the i-th sub-group of bits in the source word, on which the i-th parity check is carried out. For example, in the case of the error code "0101" and on the assumption that this is assigned to the error in the first bit in the source word, this error code is indicative of the fact that the first bit in the binary source word must form part of the sub-groups of bits on which the first and third parity checks are carried out. In fact, by this means, if the first bit in the source word is incorrect, both the first bit and the third bit in the correction word which is generated during decoding (obtained from the first and the third parity checks) are different from the corresponding bits in the correction word generated during coding (during which the bit was different), and thus the error code which is obtained by comparing the two correction words has both the first and the third bit set to the logic value 1. If the k sub-groups in the source word on which the k parity checks are to be carried out are selected appropriately, the error code is in bi-univocal correspondence with the position, within the code word, of the single incorrect bit(s) and thus when this bi-univocal correspondence is known the incorrect bit(s) can be corrected. If conventional memories are used, in which a single bit is stored in each memory cell, the malfunctioning of a memory cell gives rise to deterioration of a single bit. If, as is usually the case for this type of memory, the probability of failure of a cell is relatively low, it is sufficient to use a correction code which can detect and correct a single error in the source word; in fact, the probability of occurrence of a plurality of errors within the source word is negligible. On the other hand, in a multi-level memory, in which several bits are stored in each memory cell, the malfunctioning of even a single memory cell can give rise to a multiple error, i.e. an error in several bits simultaneously. In fact, as is known, in a floating gate multi-level memory cell the data to be stored is associated with the quantity of electric charge which is stored in the floating gate region (which in turn defines the value of the threshold voltage of the memory cell) and thus the loss or gain of electric charges in the floating gate region of one of the memory cells which is used in order to store the code word can generate, within the code word, a maximum number of errors which is equivalent to the number n of bits stored in the memory cell in which the deterioration of the electric charge has taken place. In order to be efficient, a method for correction of the errors in a multi-level memory thus makes it necessary to be able to detect and correct multiple errors. By using the known methods for the correction of multiple errors, there would be a considerable increase in the number of bits in the correction word, for the same length of source word, compared with the number required for correction of a single error, and thus an increase in the memory area, for the same data storage capacity. It should however be noted that the deterioration of the electric charge stored in the floating gate region of a multi-level memory cell means that the n possible errors which this deterioration generates within the code word are present in positions which are correlated to one another and are known on the basis of the law of assignation, established a priori in the memory design stage, according to which the bits in the code word have been stored in the memory cells. If, for example, in each memory cell there are stored n bits, which are disposed in adjacent positions in the binary word, the n possible errors generated by the faultiness of this memory cell can also only be disposed in positions which are adjacent within the binary word. In order to correct a single error and dual errors present in any positions which are non-correlated to one another, within a code word stored in a conventional memory, for a binary word with m bits to be stored there is required a number k of correction bits such that the following inequality is fulfilled: 2 k > 1 + m + k + 1 2 ·( m + k )·( m + k - 1) The preceding inequality simply expresses the fact that it must be possible to put the 2 k possible correction words which can be generated with k bits into bi-univocal correspondence with the m+k possible positions of a single error and with the (m+k)(m+k-1)/2 possible combinations of the positions of two errors; the additional 1 is derived from the fact that it is also necessary to take into consideration the condition of lack of errors. From 1) it can easily be deduced that in order to correct a single error within the code word the following inequality must be fulfilled: 2 k > 1 + m + k On the other hand, for the correction of two errors in positions which are correlated within the code word stored in a multi-level memory, in which 2 bits are stored in one memory cell, for a source word with m bits there is required a number k of correction bits such that the following inequality is fulfilled: 2 k > 1 + 3 2 ·( m + k ) which can be deduced from the inequality 1), taking into account the fact that the possible combinations of the positions of two errors in correlated positions are only (m+k)/2. In general, for correction of r errors in positions which are correlated within a code word stored in a multi-level memory, in which 2 bits are stored in one memory cell, for a binary word with m bits to be stored there is required a number k of correction bits such that the following inequality is fulfilled: 2 k > 1 + 2 r - 1 r ·( m + k ) For the most significant values of m, the table in figure 1 shows the minimum values of k which are required for correction of two errors in any positions, of two errors in adjacent positions, and of a single error, if two bits are stored in each memory cell. Examination of this table shows that the correction of two errors in correlated positions can be carried out using the same number of additional cells required for the correction of a single error, at least for binary words which have lengths longer than 8 bits. In particular, analysis of the last two lines of the table shows that in order to carry out the correction of two errors in correlated positions, in the case of a 32-bit binary word (16 cells), it would be necessary to use 6 correction bits (3 cells), with an increase of 19% in the memory matrix area, whereas in order to carry out the correction of two errors in correlated positions, in the case of a 64-bit binary word (32 cells), it would be necessary to use 7 correction bits (4 cells), with an increase of only 12.5% in the memory matrix area. The foregoing information, provided with reference to the case of two errors in correlated positions, is also valid for the general case of n errors in correlated positions, and this shows immediately that the correlation between the position of the errors within the source word is in general a condition which minimises the number of correction bits necessary (and thus the number of additional correction cells), which can be calculated by means of the inequality 3) in the case of any n, or by means of the inequality 4) in the case of n=2. However, in the literature there are not known criteria of definition of the k sub-groups of the source word on which there can be carried out the k operations of checking of parity, in the case of correction of multiple errors in correlated positions, in which there is met the condition of bi-univocality of the correspondence between the error code and the position of the single incorrect bit or the n incorrect bits. The document US-A-5 621 682 discloses a multi-value memory system provided with an error correction means using stored check data. The object of the present invention is thus to provide a method for correction of errors in a binary word stored in multi-level memory cells, which fulfils the condition of requiring the minimum number of correction bits and the condition of complying with the bi-univocality of the correspondence between the error code and the position of the single incorrect bit or the n incorrect bits. According to the present invention, a method for correction of errors, using the minimum number of correction bits, is provided, as defined in claim 1. In order to assist understanding of the present invention, a preferred embodiment is now described, purely by way of non-limiting example, with reference to the attached drawings, in which: figure 1 shows a table which contains the minimum number of correction bits necessary for correction of a single error or a dual error; figure 2 shows a flowchart of operations relative to assignment of error codes according to the present invention; figure 3 shows a table which contains the error codes relative to a first use of the present method; figure 4 shows a table which contains the error codes relative to a second use of the present method; figure 5 shows a first correction matrix obtained by means of the present method; figure 6 shows a second correction matrix obtained by means of the present method; and figure 7 shows a logic diagram of an error correction circuit. The present correction method is described hereinafter with reference to the flowchart in figure 2 and, without detracting from its general applicability, relatively to the specific case in which n=2, m=6 and k=4, i.e. relatively to the case of memory cells which store two bits per cell and 10-bit code words (which require 5 memory cells), in which the first 6 bits (3 cells) define the source word and the last 4 bits (2 cells) define the correction word generated during the coding process. In addition, the present correction method is described hereinafter, without detracting from its general applicability, on the assumption that adjacent positions within the code word are assigned to the two bits stored in each memory cell, it being apparent that, in the case in which correlated positions within the code word are assigned to the two bits which are stored in each memory cell, everything which is stated hereinafter with reference to two bits which are disposed in adjacent positions also applies to two bits which are disposed in correlated positions. The fact is also emphasised that the specific application for which the present method is designed, i.e. the correction of errors in positions which are correlated to one another, means that by means of the method it is possible to correct not only a single error but also a pair of errors which are generated by the faultiness of a single memory cell, and not by the faultiness of two separate memory cells, which each generate a single error, since, in this last case, the two errors would be non-correlated to one another. According to a first aspect of the present invention, the k sub-groups in the source word on which the k parity checks are to be carried out, are defined by taking into consideration initially the possibility of the presence of errors in the correction word read by the memory, since this conditions the definition of the k sub-groups themselves in the manner described in greater detail hereinafter. Thus, as illustrated in the flowchart in figure 2, initially a block 10 is reached, in which a respective error code is assigned to each of the single errors and to each of the dual errors in the correlated position in the correction word. The criterion according to which the error codes are assigned to the positions of the errors in the correction word read by the memory can be deduced from observation of what actually happens during the decoding process in the event of an error in the correction word. In particular, with reference to the example taken into consideration in the present description, if none of the memory cells, in which there are stored the bits in the source word and in the correction word, is faulty, the correction word generated during the decoding process will be identical to the correction word read by the memory and thus the corresponding check word will be zero (i.e. it will consist entirely of zeros). This check word thus cannot be used for the assignation, since it is indicative of the lack of errors. If, on the other hand, the memory cell in which the first two bits in the correction word are stored is faulty, the following situations can occur: there is a single error in the first of the four correction bits stored and thus the first bit in the correction word generated during the decoding process, obtained from the first parity check, will not be equivalent to the first bit in the correction word stored, which was generated during the coding process, and thus the first parity check will be unsuccessful, whereas the successive checks will be correct and will provide a positive result; consequently, the error code "0001" ("1" in decimal representation) is advantageously assigned to this single error in the first bit in the correction word stored, indicating the fact that the result of the first check was negative (first bit at the logic level 1) and that the result of the subsequent three checks was positive (subsequent three bits at the logic level 0); there is a single error in the second of the four correction bits stored and thus the second parity check will be unsuccessful, whereas the subsequent checks will be correct; the error code "0010" (representing decimal "2") is advantageously assigned to this error; there is a dual error in the first and second correction bits stored and thus both the first and the second parity checks will be unsuccessful; the error code "0011" (representing decimal "3") is thus advantageously assigned to this dual error. Similarly, if the memory cell in which the third and fourth correction bits are stored is faulty, the following situations can occur: there is a single error in the third correction bit stored and thus the third parity check will be unsuccessful; the error code "0100" (representing decimal "4") is advantageously assigned to this error; there is a single error in the fourth correction bit stored and thus the fourth parity check will be unsuccessful; the error code "1000" representing decimal "8") is advantageously assigned to this single error; there is a dual error in the third and fourth correction bits stored and thus both the third and the fourth parity checks will be unsuccessful; the error code "1100" (representing decimal "12") is advantageously assigned to this dual error. Thus, in the light of the foregoing description, in general, in block 10, an error code having the i-th bit set to the logic value 1 is assigned to the single error in the i-th bit in the correction word stored, whereas to the dual error in the i-th bit and the subsequent bit in the correction word stored there is assigned an error code which is obtained by carrying out the EXCLUSIVE OR, or EX-OR operation, between each pair of bits in corresponding positions in the error codes assigned to the single error in the i-th bit and to the single error in the subsequent bit, and thus have the i-th bit and the subsequent bit set to the logic value 1. The assignation of error codes to the single and dual errors in the correction word conditions the assignation of the error codes to the single and dual errors in the source word, since, in the selection of the sub-groups in the source word, on which the parity checks are to be carried out, it is necessary to take into account the fact that the error codes 1, 2, 3, 4, 8 and 12 are already assigned to errors in the correction word stored. Thus, from block 10, there is transition to a series of blocks in which there are taken into consideration, one at a time, successive separate pairs of adjacent bits in the source word (i.e. in accordance with the foregoing description, there are taken into consideration, one at a time, the series of n bits stored in a single memory cell), and for each of them there are determined the error codes to be assigned to the single error bits and to the dual error in both bits. In the example which is taken into consideration in the present description, the pair formed by the first and the second bits, then the pair formed by the third and fourth bits, and finally the pair formed by the fifth and sixth bits in the source word, are initially taken into consideration. In detail, from block 10, there is transition to a block 20, in which there is selected a pair of adjacent bits in the source word, to be taken into consideration for assignation of the error codes. From block 20, there is then transition to a block 30, in which the smallest error code, from amongst those which have not yet been assigned to other errors, is assigned to the single error in the first bit in the pair of bits selected. From the block 30, there is then transition to a block 40, in which the smallest error code, from amongst those which have not yet been assigned to the other errors and is subsequent to that assigned to the first bit in the pair of bits considered, is assigned to the single error in the second bit in the pair of bits selected. From block 40, there is then transition to a block 50, in which an error code, which is obtained by carrying out the EX-OR operation on each corresponding pair of bits in the error codes assigned to the single errors, is assigned to the dual error in both bits in the pair of bits selected. From the block 50, there is then transition to a block 60, in which it is checked whether the error code determined in block 50 has already been assigned to other errors in the source word or in the correction word. If the error code has already been assigned to other errors (YES output from block 60), this does not make it possible to comply with the criterion of bi-univocality between error codes and error positions, and thus, from block 60, there is transition to a block 70, otherwise, if the error code has not been assigned to other errors (NO output from block 60), this makes it possible to respect the criterion of bi-univocality between error codes and error positions, and thus, from block 60, there is transition to block 80. In block 70, there is rejection of the error code assigned to the dual error in both the bits in the pair required, since it does not fulfil the said condition of bi-univocality, and of the error code assigned to the error in the second bit in the pair of bits selected. From block 70, there is then transition to block 40 once more, in order to determine a new error code to be assigned to the error in the second bit in the pair of bits considered. The operations described with reference to blocks 40-70 are then repeated, until to the error in the second bit in the pair of bits selected there is assigned an error code which makes it possible to obtain an error code assigned to the dual error in both bits which fulfils the said condition of bi-univocality. When this error code has been determined, there is transition to block 80, in which the error code assigned to the dual error and the two error codes assigned to the two single errors are stored. From block 80, there is then transition to a block 90, in which it is checked whether there is a subsequent pair of adjacent bits in the source word to be taken into consideration for the assignation of error codes. If there is a subsequent pair of bits in the source word to be taken into consideration (YES output from block 90), then from block 90 there is transition once more to block 20 in order to repeat the operations described on a subsequent pair of bits in the source word, otherwise, if all the pairs of adjacent bits in the source word have been taken into consideration (NO output from block 90), then from block 90 there is transition to a block 100 which is described hereinafter. With reference to the example taken into consideration in the present description, by means of the above-described operations, the error code "0101" ("5" in decimal representation) is assigned to the error in the first bit in the source word and the error code "0110" ("6" in decimal representation) is assigned to the error in the second bit in the source word. The error code assigned to the dual error in both the bits would therefore be "0011" (representing decimal "3"), which however is already assigned to an error in the correction word and thus the assignation of the error code "0110" to the error in the second bit in the pair of bits concerned is rejected and the error code "0111" (representing decimal "7") is assigned to the error in the second bit. However, this also makes it impossible to fulfil the aforementioned condition of bi-univocality and thus the above-described operations are repeated. It is simple to check that the smallest error code which can be assigned to the error in the second bit in the source word, which does not give rise to ambiguity, is "1010" (representing decimal "10"), which, together with the error code "0101" assigned to the error in the first bit in the source word, gives rise, for the dual error in the first and second bits in the source word, to an error code "1111" (representing decimal "15"). The table in figure 3 shows the error codes assigned to the single and dual errors in the example taken into consideration in the present description. The method for assignation of the error codes to the bit errors in the source word can be extended to any values of m and k and can be executed by means of a simple calculation programme. For example, the table in figure 4 shows the error codes determined in the above-described manner for a recurrent application in which n=2, m=64 and k=8, i.e. for 36 memory cells altogether, of which 32 are for the source word and 4 are for the correction word. The method for assignation of the error codes to the bit errors in the source word can also be extended to values of n which are greater than two. For any values of n, sets of n adjacent bits in the code word (i.e. the bits stored in a single memory cell) are selected one at a time and for each of them the error codes are assigned to each of the n single errors. With reference to assignation of the error codes to multiple errors, the fact must be taken into account that for values of n which are greater than two it is necessary to determine not only the error code to be assigned to the multiple error in all the n bits but also all the error codes to be assigned to each of the multiple errors with r bits, in which 1<r<n. The error codes to be assigned to the multiple error with n bits, and to the multiple errors with r bits are thus determined in the above-described manner for the case of n=2, i.e. by checking whether the error code has already been assigned to other errors in the code, and, if it has already been assigned to other errors, rejecting one or more error codes assigned to the individual errors, and then searching repeatedly for other error codes to be assigned to these single errors, until the error code assigned to the multiple error is found to be non-assigned to other errors. For example, if n=4, when the error codes have been assigned to each of the four single errors, it is necessary to determine not only the error code to be assigned to the multiple error in all four bits but also the error codes to be assigned to each of the multiple errors in three bits, and to each of the multiple errors in two bits. With reference once again to the flowchart in figure 2, in block 100, to which transition takes place if all the pairs of bits in the source word have been selected and three error codes have been assigned to each of them (two for the single errors and one for the dual error), there are defined: a first matrix, or "mask", to be used in order to determine the k sub-groups of bits in the source word on which the checking operations are to be carried out during the coding and decoding process and in order to determine the position of the single errors within the source word during the decoding process; this matrix, which is commonly known as the parity matrix, is constructed by recording in matrix form, in the manner described hereinafter, the error codes assigned to the single errors, both in the source word and in the correction word; and a second matrix or "mask", to be used only during the decoding process, in order to determine the position of the dual errors within the source word, which is defined by recording in matrix form, in the manner described hereinafter, the error codes assigned to the dual errors both in the source word and in the correction word. Figures 5 and 6 illustrate two tables which contain respectively the first and the second matrix relative to the example given in the present description. In particular, in the columns of the first matrix there are progressively recorded the error codes assigned to the positions of the single incorrect bits within the source word and then the error codes assigned to the positions of the single incorrect bits within the correction word stored, with the least significant bit disposed in the topmost line, whereas in the columns of the second matrix there are progressively recorded the error codes assigned to the dual errors in correlated positions in the source word and in the correction word, with the least significant bit disposed in the topmost line. The error codes which are assigned to the individual errors in the source word define, within the first matrix, a first sub-matrix relative to the source word, whereas the error codes which are assigned to the individual errors in the correction word define, within the first matrix, a second sub-matrix relative to the correction word. The first sub-matrix relative to the source word shows graphically the above-described ratio which exists between the bits which have a logic value 1 in an error code, and the subgroups of bits in the source word, on which the checking operations are to be carried out during the coding and decoding process. In particular, the i-th line of the first sub-matrix is indicative of the position of the bits in the source word which form the i-th sub-group of bits on which the i-th checking operation is to be carried out, and, in greater detail, in the i-th checking operation the j-th bit in the source word belongs to the i-th sub-group only if in the i-th line the j-th bit assumes the logic value 1. On the other hand, the second sub-matrix relative to the correction word shows, during the coding process, the positions within the correction word in which there must be loaded the results of the parity checks, and, during the decoding process, the positions of the bits in the correction word with which the results of the parity checks must be compared. In particular, in the coding process, the bit with the logic value 1 in the i-th line is indicative of the position, within the correction word, in which there must be loaded the result of the i-th checking operation carried out on the i-th sub-group in the source word, whereas in the decoding process, it is indicative of the position of the bit in the correction word with which the result of the i-th checking operation carried out on the i-th sub-group in the source word must be compared. The first and second matrices are also used in the decoding process in order to determine the error which is present in the source word or in the correction word which is associated with it. In fact, in the decoding process, when the operations of checking on the various sub-groups of bits and of comparison between the correction word read in the memory and that of decoding have been carried out, a check word is generated and compared with the error codes contained in the columns of the first and the second matrix. In the presence of a single error or of a dual error in correlated positions in the source word or in the correction word, the check word obtained in the decoding process will thus be equivalent to one of the error codes contained in the columns of the first or second matrix, and in particular, it will be equivalent to the error code assigned to this single or dual error. When this error code is known, the position of the single or dual error (which can be read in the "Error position" line respectively in the table in figure 5 or figure 6, corresponding to the column in which the error code is contained) will immediately be known and they can thus be corrected. With reference to the matrix in figure 5, both during the coding process and during the decoding process, the first parity check will be carried out on the sub-group of bits formed from the 1st, 4th, 5th and 6th bits in the source word, the second parity check will be carried out on the sub-group of bits formed from the 2nd, 3rd, 4th and 5th bits, the third parity check will be carried out on the sub-group of bits formed from the 1st, 3rd and 5th bits, and the fourth parity check will be carried out on the sub-group of bits formed from the 2nd, 4th and 6th bits. In addition, during the coding process, the result of the first checking operation will be loaded in the first bit in the correction word, the result of the second checking operation will be loaded in the second bit in the correction word, the result of the third checking operation will be loaded in the third bit in the correction word, and the result of the fourth checking operation will be loaded in the fourth bit in the correction word. On the other hand, in the decoding process, the result of the first checking operation will be compared with the bit set in the first position in the correction word, the result of the second checking operation will be compared with the bit set in the second position in the correction word, the result of the third checking operation will be compared with the bit set in the third position of the correction word, and the result of the fourth checking operation will be compared with the bit set in the fourth position in the correction word. In addition, during the decoding process, if the check word is not zero, it is compared with the error codes which are contained in the columns of the matrices in figures 5 and 6 in order to identify the error code which is identical to it and then the decimal representation of this error code, which is indicative of the position of this single or dual error within the source word or the correction word, is read in the lowest line of the matrix. At this point, the single or dual error can thus be corrected. Figure 7 shows the correction circuit which is used for correction of the errors in the source word used, which is indicated as PSM in the figure. As illustrated in this figure, the correction circuit, which is designated 110 as a whole, comprises a decoder stage 112, which receives as input the check word obtained in the decoding process, and indicated in the figure as PC, and supplies as output, on the basis of the decoding matrices of the type illustrated in figures 4 and 5, a binary correction string, which has a length of 3m/2 bits, and consists of a plurality of triads of bits, each of which is associated with a respective pair of bits in the source word stored, PSM, which bits are stored in a single multi-level memory cell, and are a pair of adjacent bits in the example considered. In particular, in each triad, the first bit is associated with the single error in the first of the two adjacent bits in the source word used, PSM, with which the triad is associated, the third bit is associated with the single error in the other of the two adjacent bits in the source word stored, PSM, and the second bit, which is interposed between them, is associated with the dual error in both the adjacent bits in the source word, PSM. In other words, as shown in figure 7, the first bit in the binary correction string is associated with the error in the first bit in the source word, PSM, the second bit in the binary correction string is associated with the error in the first and second bits in the source word, PSM, the third bit in the binary correction string is associated with the error in the second bit in the source word, PSM, the fourth bit in the binary correction string is associated with the error in the third bit in the source word, PSM, and so on. Each of the bits in the binary correction string also assumes a logic value 1, if the bit or bits in the source word, PSM, associated with it, is or are incorrect, and thus, since the present method can correct a single error or two errors in correlated positions, a binary correction string will have only one bit which is set to the logic value 1. In addition, since, as initially emphasised, a pair of adjacent bits in the source word, PSM, are stored in a single memory cell, and owing to the correspondence between bits in the binary correction string and bits in the source word, PSM, each pair of OR logic gates operates on a pair of bits in the binary correction string, which are associated with errors in a pair of bits which are stored in a single cell. The correction circuit 110 additionally comprises m OR logic gates 114.1, 114.2, ..., one for each bit in the binary correction string which is set to an odd position. In particular, the OR logic gates 114.1, 114.2, ... are organised in pairs, and each pair operates on a respective triad of bits in the binary correction string, i.e. a first pair of OR logic gates operates on the triad of bits which is formed by the first, the second, and the third bits in the binary correction string, a second pair of OR logic gates operates on the triad of bits formed by the fifth, sixth and seventh bits in the binary correction string, and so on. In detail, in each pair of OR logic gates 114.1, 114.2, ..., a first OR logic gate carries out the OR logic operation between the first bit in the corresponding triad which is set to an odd position, and the bit which is set to an even position, and a second OR logic gate carries out the OR logic operation between the bit which is set to an even position, and the second bit which is set to an odd position. The correction circuit 110 additionally comprises m EX-OR logic gates 116.1, 116.2, ..., each of which is associated with a respective OR logic gate 114.1, 114.2, ..., and carries out the EXCLUSIVE OR operation, between the bit which is supplied as output by the respective OR logic gate, and the bit in the source word, PSM, which is associated with the bit in the binary correction string which is set to an odd position, on which the OR logic gate itself operates. In other words, the first EX-OR logic gate 116.1 carries out the EXCLUSIVE OR operation between the bit supplied as output from the first OR logic gate, and the first bit in the source word, PSM, the second EX-OR logic gate 116.2 carries out the EXCLUSIVE OR operation between the bit supplied as output from the second OR logic gate, and the second bit in the source word, PSM, stored, and so on. The outputs of the m EX-OR logic gates 116.1, 116.2, ..., thus define a correct source word, which is indicated as PSC in the figure. The functioning of the correction circuit 110 is apparent from the description provided. In fact, the decoding of the check word, PC, ensures that the binary correction string has a bit which is set to the logic value 1, in the position which corresponds to that of the single error within the source word, PSM, or to that of the error in two adjacent bits. Consequently, the output of one of the OR logic gates 114.1, 114.2, ..., in particular of the one which operates on the bit which is set to the logic level 1 in the binary correction string, is set to the logic level 1, and thus the EX-OR logic gate 116.1, 116.2, ... associated with it will supply as output the complement of the bit in the source word, PSM, supplied to it, thus correcting the error in this bit. The advantages of the present correction method are apparent from the foregoing description. Finally, it is clear that modifications and variants can be made to the correction method which is described and illustrated here, without departing from the protective scope of the present invention.

Claims: Method for correction of errors in a binary word stored in multi-level memory cells, each of which contain n bits, by means of a minimum number of correction bits, characterised in that it comprises, for each set of bits in said binary word stored in a single multi-level memory cell, the following steps: a) assigning, to the single error in each bit in said set of bits, a respective error code which is not assigned to other errors in said binary word and is indicative of the position of the incorrect bit in the binary word; b) for each sub-set of multiple errors in bits in said set of bits, carrying out the following steps: b1) assigning, to said sub-set of multiple errors, a respective error code which is dependent on the error codes assigned to the individual errors in the bits in the sub-set; b2) checking whether the error code assigned to said sub-set of multiple errors has already been assigned to other errors in said binary word; b3) if the error code assigned to said sub-set of multiple errors has already been assigned to other errors in said binary word, carrying out the following steps: b31) rejecting said error code assigned to said sub-set of multiple errors and at least one of the error codes assigned to the single errors in the bits in the sub-set; b32) assigning, to the single error assigned to the error code rejected, a new error code which is not assigned to other errors in said binary word; and b33) repeating said steps from b1) to b3) until the error code assigned to said sub-set of multiple errors is not assigned to other errors in said binary word. Method for correction according to claim 1, further characterised in that said step a) comprises the steps of: a1) assigning, to the single error in a first one of the bits in said set, the smallest error code which is not assigned to other errors; and a2) assigning respective error codes to the single errors in the other bits in said set, said error codes being the smallest from amongst the error codes not assigned to other errors and being in succession relative to one another and to the error code assigned to said first bit. Method for correction according to claim 1 or claim 2, further characterised in that said step b1) comprises the step of: b11) assigning, to said sub-set of multiple errors, an error code which is obtained by carrying out the EXCLUSIVE OR logic operation between the error codes assigned to each of the single errors in the sub-set. Method for correction according to any one of the preceding claims, further characterised in that said step b32) comprises the step of: b321) assigning a new error code to the single error assigned to the error code rejected, said new error code being the smallest from amongst the error codes not assigned to other errors. Method for correction according to claim 4, further characterised in that , in said step b321), said new error code assigned to the single error is subsequent to said error code rejected. Method for correction according to any one of the preceding claims, further characterised in that said step b) additionally comprises the steps of: b4) if the error code assigned to said sub-set of multiple errors has not been assigned to other errors, storing said error code assigned to said sub-set of multiple errors and the error codes assigned to each of the single errors in said sub-set. Method for correction according to any one of the preceding claims, further characterised in that said binary word is a source word with m bits which forms, together with a correction word with k bits assigned to it, a code word; said k bits in said correction word being obtained by carrying out k parity checks on k sub-sets of bits in said source word. Method for correction according to claim 7, further characterised in that for said correction word, said assignation step comprises the steps of executing, for each set of bits in said correction word which are stored in a single memory cell, the following steps: c) assigning, to each single error in said set of bits, an error code which is not assigned to other errors; and d) for each sub-set of multiple errors in said set of bits, assigning, to said sub-set of multiple errors, an error code which is dependent on the error codes assigned to each of the single errors in the sub-set itself. Method for correction according to claim 8, further characterised in that said step c) comprises the step of: c1) assigning, to the single error in the i-th bit in said correction word, an error code which has the i-th bit set to a first logic value and the other bits set to a second logic value. Method for correction according to claim 9, further characterised in that said first logic value is the logic value 1. Method for correction according any one of claims 8 to 10, further characterised in that said step d) comprises the step of: d1) assigning, to each sub-set of multiple errors in said set of bits, an error code which is obtained by carrying out the EXCLUSIVE OR logic operation between the error codes assigned to each of the single errors in the sub-set itself. Method for correction according to any one of claims 7 to 11, further characterised in that it additionally comprises the step of: e) defining a first matrix, in the columns of which there are progressively recorded the error codes assigned to the single errors in the bits in said source word and in said correction word; the error codes assigned to the single errors in the bits in said source word defining a first sub-matrix, the lines of which are indicative of the composition of said sub-sets of bits in the source word, on which said checking operations are to be carried out; the error codes assigned to the single errors in the bits in said correction word defining a second sub-matrix, the lines of which are indicative of the positions within the correction word, in which the bits derived from said checking operations must be placed. Method for correction according to claim 12, further characterised in that the i-th line of said first sub-matrix is indicative of the position of the bits in the source word, which form the i-th sub-set of bits, on which the i-th checking operation is to be carried out. Method for correction according to claim 13, further characterised in that , in said i-th checking operations, the j-th bit in said source word belongs to the i-th sub-set, if the j-th bit assumes a third logic value, in the i-th line of said first sub-matrix. Method for correction according to claim 14, further characterised in that said third logic value is the logic value 1. Method for correction according to claim 14 or claim 15, further characterised in that , in the i-th line of said second sub-matrix, there is present a single bit, which is set to a fourth logic value, and in that the position of this single bit set to said fourth logic value is indicative, in a coding process, of the position within the correction word, in which there must be loaded the bit derived from the i-th checking operation carried out on the i-th sub-set in said source word, and is indicative, in a decoding process, of the position within the correction word for the bit, with which the result of the i-th checking operation carried out on the i-th sub-set in the source word must be compared. Method for correction according to claim 16, further characterised in that said fourth logic value is the logic value 1. Method for correction according to any one of claims 12 to 17, further characterised in that it additionally comprises the step of: f) defining a second matrix, in the columns of which there are progressively recorded the error codes assigned to the multiple errors in the bits in said source word and in said correction word.

Inventors: MODELLI ALBERTO, MODELLI, ALBERTO
Applicants: ST MICROELECTRONICS SRL, STMICROELECTRONICS S.R.L.
Application year: 1999
Main classification: G06F11
IPC codes: G06F12, G06F11, H03M13, G11C11