Data encoding and decoding method, error correction method, memory controller, chip and device
By transforming the standard encoding matrix to generate an extended encoding matrix, the problem of insufficient coverage in existing error correction algorithms is solved, achieving more efficient data error correction and improving the reliability and stability of memory.
Patent Information
- Application Number
- CN202211608891.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-14
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-12-14
AI Technical Summary
Existing error correction algorithms have low error correction capabilities and cannot fully cover data symbols, which may cause serious problems such as computer system crashes when data errors occur.
By transforming the standard coding matrix, an extended coding matrix is generated, ensuring that there are no identical column vectors under the code elements of the target data size. The extended coding matrix is then used to generate check codes to completely cover the data codes and improve error correction capability.
The error correction algorithm has been improved, enabling it to correct multiple data errors, reduce the false positive rate, and enhance the reliability and stability of memory.
Smart Images

Figure CN116054842B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of memory technology, specifically to a data encoding and decoding method, an error correction method, a memory controller, a chip, and a device. Background Technology
[0002] During operation, memory may experience data errors due to environmental interference such as electromagnetic interference and its own structural characteristics; for example, data errors may occur when writing data to or reading data from memory.
[0003] Data errors in memory can cause instability or crashes in computer systems. For users with high stability requirements, data errors in memory can cause even more serious problems. Therefore, computer systems need to use error correction algorithms to correct errors in the data read from memory.
[0004] Error correction of data read from memory requires that the data be accompanied by checksums for error correction when written to memory. In this context, providing a technical solution to support the improvement of the error correction capability of error correction algorithms has become a pressing technical problem for those skilled in the art.
[0005] Contents
[0006] In view of this, embodiments of this application provide a data encoding and decoding method, an error correction method, a memory controller, a chip, and a device to improve the coverage of check symbols on data symbols, provide support for increasing the number of symbols that the error correction algorithm can correct, and thus improve the error correction capability of the error correction algorithm.
[0007] To achieve the above objectives, the embodiments of this application provide the following technical solutions.
[0008] In a first aspect, embodiments of this application provide a data encoding method, including:
[0009] Determine the data to be written to memory, and map the data into multiple corresponding data symbols;
[0010] According to the extended coding matrix, the multiple data symbols are encoded to obtain multiple check symbols; wherein, the extended coding matrix is obtained by transforming the standard coding matrix, and the standard coding matrix has the same column vectors under the code symbols of the target data size; the extended coding matrix does not have the same column vectors under the code symbols of the target data size, and the column vectors in the extended coding matrix are different from the unit column vectors in the identity matrix corresponding to the check symbols;
[0011] The plurality of data code elements and the plurality of check code elements are used as the encoding result and written into memory; wherein, the plurality of check code elements are used to correct errors in the encoding result when reading the encoding result from memory.
[0012] Secondly, embodiments of this application provide a data decoding method, including:
[0013] The encoding result is read from memory, the encoding result including multiple data code elements and multiple check code elements; the encoding result is obtained based on the data encoding method described in the first aspect above.
[0014] The first syndrome is determined based on the extended coding matrix, as well as the multiple data symbols and multiple check symbols read.
[0015] Based on the first synecdoche and the method of obtaining the extended coding matrix, a second synecdoche is determined; wherein the first synecdoche and the second synecdoche serve as the decoding result, and the decoding result serves as the input of the error correction algorithm to correct the coding result.
[0016] Thirdly, embodiments of this application provide a data error correction method, including:
[0017] Obtain the decoding result, which includes a first synapse and a second synapse; the decoding result is obtained based on the data decoding method described in the second aspect above;
[0018] Based on the first and second syndromes, an error correction algorithm is run to determine the error correction result corresponding to the encoding result read from memory.
[0019] Fourthly, embodiments of this application provide a memory controller, including an encoding module, a decoding module, and an error correction module; the encoding module is used to execute the data encoding method as described in the first aspect above; the decoding module is used to execute the data decoding method as described in the second aspect above; and the error correction module is used to execute the data error correction method as described in the third aspect above.
[0020] Fifthly, embodiments of this application provide a chip including the memory controller described in the fourth aspect above.
[0021] In a sixth aspect, embodiments of this application provide an electronic device including the chip described in the fifth aspect above.
[0022] The data encoding method provided in this application includes: determining data to be written to memory and mapping the data to a plurality of corresponding data symbols; encoding the plurality of data symbols according to an extended encoding matrix to obtain a plurality of check symbols; wherein the extended encoding matrix is obtained by transforming a standard encoding matrix, the standard encoding matrix having the same column vectors under the code symbols of the target data size; the extended encoding matrix not having the same column vectors under the code symbols of the target data size, and the column vectors in the extended encoding matrix are different from the unit column vectors in the identity matrix corresponding to the check symbols; after obtaining the plurality of check symbols, this application embodiment can write the plurality of data symbols and the plurality of check symbols as the encoding result into memory; wherein the plurality of check symbols are used to correct errors in the encoding result when reading the encoding result from memory.
[0023] Since the check code elements in this embodiment are obtained based on an extended coding matrix, and the extended coding matrix does not have identical column vectors for code elements of the target data size, and the column vectors in the extended coding matrix are different from the unit column vectors in the identity matrix corresponding to the check code elements, the extended coding matrix in this embodiment can provide comprehensive error correction support for data code elements compared to the standard coding matrix. This improves the coverage of the check code elements generated based on the extended coding matrix over the data code elements (e.g., the check code elements can completely cover the data code elements), thereby supporting an increase in the number of symbols that the error correction algorithm can correct (e.g., the error correction algorithm can correct data errors in two symbols). Therefore, the data encoding method provided in this embodiment can improve the coverage of the check code elements over the data code elements based on the extended coding matrix, supporting an increase in the number of symbols that the error correction algorithm can correct, and thus improving the error correction capability of the error correction algorithm. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0025] Figure 1 This is a partial structural block diagram of a computer system.
[0026] Figure 2A Example diagram for obtaining check code elements.
[0027] Figure 2B Here is another example diagram to obtain the check code.
[0028] Figure 3AThe flowchart for obtaining the extended encoding matrix.
[0029] Figure 3B This is an example diagram showing the check symbol and the identity matrix.
[0030] Figure 3C This is an example diagram of the intermediate Vandermonde matrix.
[0031] Figure 3D This is another example diagram of the intermediate Vandermonde matrix.
[0032] Figure 4 This is a flowchart of the data encoding method.
[0033] Figure 5A This is a flowchart of the data decoding method.
[0034] Figure 5B This is an example diagram of obtaining the first companion based on the Vandermonde matrix.
[0035] Figure 6 A flowchart for the data error correction method.
[0036] Figure 7 A flowchart for determining the error correction result.
[0037] Figure 8 Example diagram of an XOR table for finding roots of a quadratic equation. Detailed Implementation
[0038] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0039] Figure 1 An exemplary partial structural block diagram of a computer system is shown, such as... Figure 1 As shown, the computer system may include: memory 110 and memory controller 120.
[0040] As an important component of a computer system, memory 110 can be used to temporarily store data processed by the processor and data exchanged with external storage devices such as hard drives. Memory 110 can have different memory specifications and interface modes. In one example, memory 110 can be DDR (Double Data Rate) memory, such as DDR5 memory.
[0041] The memory controller 120, as the controller of the memory 110 in the computer system, can be used to control the writing and reading of data in the memory 120. The memory controller 120 can have multiple memory channels, such as channel0, channel1, etc. The memory controller 120 can use channels to write data to memory and read data from memory.
[0042] When writing data to and reading data from memory 110, data errors may occur due to various interferences in the memory's working environment and the memory's own structural characteristics. To ensure the reliability of the computer system, the memory controller 120 needs to use error correction algorithms to check for data errors in the data read from memory 110 and correct the detected data errors, thereby enabling the computer system to have error correction and fault tolerance capabilities when data errors occur in memory.
[0043] The memory controller 120 performs error correction on data read from memory only if the data is written to memory along with checksums for error correction. Based on this, further combining... Figure 1 As shown, the memory controller 120 can be configured with an encoding module 121, a decoding module 122, and an error correction module 123. Specifically, for data to be written to memory, before writing the data to memory 110, the encoding module 121 can encode the corresponding data symbols to generate check symbols for error correction. The check symbols and data symbols, as the encoding result, can be written to memory 110.
[0044] Due to interference from the memory operating environment and the structural characteristics of the memory itself, when the memory controller 120 reads the encoding result from the memory 110, the data code and check code read may be inconsistent with those written to the memory, resulting in data errors. Therefore, when the memory controller 120 reads the encoding result from the memory 110, the decoding module 122 can decode the read encoding result, and the decoding result serves as the input of the error correction module 123.
[0045] Error correction module 123 can perform error correction operations based on the error correction algorithm and the decoding result of decoding module 122, thereby performing error checking and correction on the encoded result read from memory 110. In one example, the error correction algorithm used by error correction module 123 may include RS (Reed-Solomon), Parity plus CRC (Cyclic Redundancy Check), SDDC (Single Device Data Correction), DDDC (Double Device Data Correction), etc. It should be noted that RS coding, or Reed-solomon codes, is a type of forward error correction channel coding. RS coding is effective for polynomials generated by corrected oversampled data; RS coding is a special type of non-binary BCH code (BCH is an abbreviation for Bose, Ray-Chaudhuri, and Hocquenghem) with error correction capabilities.
[0046] Error correction algorithms have an upper limit to their error correction capabilities. The determination of whether the severity of data errors in memory exceeds this upper limit is crucial. Memory data errors can be categorized by severity as follows:
[0047] CE (Correctable Error) means that the degree of data error in memory does not exceed the upper limit of the error correction capability of the error correction algorithm.
[0048] UE (Uncorrectable Error) refers to a memory data error whose severity exceeds the upper limit of the error correction algorithm's ability to correct errors.
[0049] Undetectable errors: The degree of data error in memory cannot be detected by the error correction algorithm, and consequently, the error correction algorithm cannot correct the data error.
[0050] Among the data error types mentioned above, CE (Complete Error) has the lowest severity level and the least impact, generally not causing serious problems. UE (User Error Detection) and undetectable errors, on the other hand, can lead to system crashes and other issues. Therefore, the goal of data error correction is to enhance the error correction capabilities of error correction algorithms and reduce the severity level of data errors; for example, changing memory data errors from UE to CE, or from undetectable errors to detectable UE.
[0051] However, error correction algorithms used by memory controllers, such as RS, Parity plus CRC, SDDC, and DDDC, have relatively low error correction capabilities in a single error correction operation based on ECC (Error Check and Correction). For example, an error correction algorithm can only correct the data error of one symbol in a single error correction operation. In one example, the RS ECC algorithm performs error detection on two symbols and corrects the data error of one symbol.
[0052] It should be noted that a symbol, also known as a code element, is the smallest error correction unit in ECC error correction. The data size of a symbol (i.e., a code element) can be determined according to the data size of the memory chip. For example, for x4 memory chips, the data size of a symbol is 4 bits, and for x8 memory chips, the data size of a symbol is 8 bits. 4 bits and 8 bits are just examples of the data size of a symbol. The data size of a symbol can be determined according to the actual situation, and this application does not set any limitations on this.
[0053] Error correction algorithms that can only correct data errors of a single symbol are a manifestation of their low error correction capability. During their research, the inventors of this application discovered that one reason for the low error correction capability of error correction algorithms is that the check symbols used for error correction cannot completely cover the data symbols. This results in low error correction support for data symbols, thus leading to low error correction capability (e.g., only correcting data errors of a single symbol) and a high false positive rate.
[0054] Further research revealed that one reason why check symbols cannot completely cover data symbols is that check symbols can be obtained using finite field operations, which utilize standard coding matrices (such as standard Vandermonde matrices). When the symbol size is the same as the target data size, the standard coding matrix will contain identical column vectors. Therefore, the data symbols corresponding to the identical column vectors cannot be distinguished, resulting in check symbols generated based on the standard coding matrix not completely covering the data symbols. Consequently, the error correction algorithm can only correct data errors in one symbol, leading to a high false positive / false negative rate. In other words, if identical column vectors exist in the standard coding matrix (such as standard Vandermonde matrices), the data symbols corresponding to the identical column vectors cannot be distinguished, causing the check symbols obtained from the standard coding matrix and data symbols to not completely cover the data symbols.
[0055] For ease of understanding, let's take encoding based on the standard Vandermonde matrix as an example. Figure 2A An example diagram illustrating the obtaining of the check symbol is shown below, such as... Figure 2AAs shown, as an example, the standard Vandermonde matrix is a 4-row, 16-column encoding matrix. The contents of one column in the standard Vandermonde matrix form a column vector. For example, the first column vector in the standard Vandermonde matrix is (1... 0 ,2 0 4 0 8 0 ), and so on, the 16th column vector is (1 15 ,2 15 4 15 8 15 ).
[0056] Data symbols correspond to the data to be written to memory, and the number of data symbols corresponds to the number of column vectors in a standard Vandermonde matrix. For example, for a 16-column standard Vandermonde matrix, there are 16 data symbols, numbered d0 to d... 15 That is, the first data symbol is d0, and so on, the 16th data symbol is d. 15 .
[0057] When obtaining check symbols based on multiplication operations in a finite field, the check symbols can be calculated by multiplying a standard Vandermonde matrix with the data symbols. Thus, multiplying a 4x16 standard Vandermonde matrix with a matrix formed by 16 data symbols yields four check symbols c0 to c3, where the first check symbol is c0, and so on, with the fourth check symbol being c3. It should be noted that a finite field, also called a Galois field, is a field containing a finite number of elements. A finite field can be written as GF(2^32)^32. n ), where n represents the bit size of an element within a finite field.
[0058] Since a finite field contains a finite number of elements, and a finite number of elements can only construct a finite number of vector spaces, based on Euler's theorem for finite fields, when the data size of the symbol is the same as the target data size (the data size of the symbol corresponds to the bit size of the element in the finite field), any specified power of any element in the finite field is equal. This leads to the existence of identical column vectors in the standard Vandermonde matrix based on the finite field under the symbol size of the target data size.
[0059] For example, taking a code element data size of 4 bits as an example, Figure 2B Another example diagram illustrating the obtaining of the check symbol is shown; when the data size of the symbol is 4 bits, the finite field GF(2) n The bit size of the element in GF(2) is 4. n ) is GF(2 4 Since a finite field contains a finite number of elements, based on Euler's theorem for finite fields, the finite field GF(2)... 4 In this equation, any element raised to the power of 15 equals 1; this leads to Figure 2BIn the example standard Vandermonde matrix, the first column vector and the sixteenth column vector are equal, both being (1,1,1,1). That is, an example of using 4 bits as the target data size for a symbol would make the first and last column vectors in a standard Vandermonde matrix equal.
[0060] Since the first column vector and the sixteenth column vector in the standard Vandermonde matrix are equal, this further results in the first data symbol d0 and the sixteenth data symbol d0 in the data symbols being equal. 15 Undistinguishable, meaning the first data symbol and the last data symbol cannot be distinguished. This applies to the inability to distinguish the first data symbol d0 and the sixteenth data symbol d. 15 In the case of, based on Figure 2B Using the standard Vandermonde matrix and data symbols to generate check symbols will result in errors occurring on the first data symbol d0 and the sixteenth data symbol d15 being undetectable when the check symbols are used for error correction. This will also increase the false positive rate of the error correction algorithm and may even lead to serious consequences such as computer system crashes.
[0061] It should be noted that compared to 8-bit symbols, 4-bit symbols can reduce chip area usage and achieve the minimum length requirement for correcting errors in two symbols with a smaller total amount of data and check symbols. Therefore, setting the symbol size to 4 bits is meaningful, which also leads to... Figure 2B The case of identical column vectors is quite common in the standard Vandermonde matrix of the example.
[0062] It should be further explained that the finite field multiplication operation to obtain the check code can be implemented by using lookup tables. For example, the multiplication of two coefficients requires looking up the corresponding lookup tables for each coefficient, then adding the results of the lookup operations together, and finally looking up a logarithmic table to realize the finite field multiplication operation. Therefore, the multiplication of two coefficients in a finite field involves three lookup tables. If the data size of the three lookup tables is large, it will undoubtedly have a huge impact on the chip area.
[0063] In the above scenario, if an 8-bit data size is used as the symbol size, each of the three lookup tables would need to store 256 8-bit data entries. This would result in a significant increase in chip area occupied by the three lookup tables. Furthermore, 128 data bits and 32 check bits are required to meet the minimum length requirement for correcting two symbol data errors (corresponding to four data transfers in one DDR5 channel). It is evident that using 8 bits for error correction introduces significant latency, occupies a large chip area, and the error correction algorithm lacks flexibility. Additionally, the probability of all 8 bits of a symbol being corrupted simultaneously is low, leading to a waste of error correction capability when using 8 bits for error correction. Therefore, using a 4-bit data size as the symbol size reduces chip area significantly compared to storing 256 8-bit data entries. Moreover, the minimum length requirement for correcting two symbol data errors can be met through two data transfers in one DDR5 channel, further reducing data processing latency. Therefore, setting the symbol size to 4 bits is meaningful.
[0064] It is worth noting that the above description only indicates that the 4-bit code element has certain technical significance. However, the code element size that makes the same column vector exist in the standard coding matrix (e.g., the standard Vandermonde matrix) is not necessarily 4 bits. It can be determined according to the actual situation. This application does not set any limitations on this.
[0065] As can be seen from the above description, if there are identical column vectors in the standard coding matrix, the generated check symbols will not be able to completely cover the data symbols, resulting in a low error correction capability of the error correction algorithm (e.g., it can only correct the data error of one symbol) and a high false correction rate.
[0066] Based on this, embodiments of this application provide an improved technical solution. By transforming the standard encoding matrix (e.g., the standard Vandermonde matrix) to obtain an extended encoding matrix (e.g., an extended Vandermonde matrix), the extended encoding matrix has no identical column vectors for code elements of the target data size. Based on the extended encoding matrix, embodiments of this application can generate check code elements during the encoding process using the extended encoding matrix and data code elements. This improves the coverage of check code elements over data code elements (e.g., check code elements can completely cover data code elements), thereby supporting an increase in the number of symbols that the error correction algorithm can correct (e.g., the error correction algorithm can correct data errors in two symbols).
[0067] On the other hand, based on the extended coding matrix, embodiments of this application can use the extended coding matrix to decode the data symbols and check symbols read from memory during the decoding process, obtaining a first and a second companion for error correction; the first and second companions can be regarded as the decoding result and used as the input of the error correction algorithm. Furthermore, during the error correction process, the error correction algorithm can determine the error correction result based on the first and second companions in the decoding result, thereby correcting errors in the data read from memory; with the support of the extended coding matrix, the error correction algorithm can cover data error detection for all data symbols, and can correct data errors of two symbols (e.g., correcting data errors of two data symbols, and correcting data errors of one data symbol and data errors of non-first check symbols, etc.), thereby improving the error correction capability of the error correction algorithm and enhancing the reliability of memory.
[0068] Based on the above ideas, embodiments of this application can transform the standard encoding matrix to obtain an extended encoding matrix, ensuring that the extended encoding matrix has no identical column vectors under the target data size of code elements. In other words, the standard encoding matrix will have identical column vectors under the target data size of code elements, while embodiments of this application can transform the standard encoding matrix so that the resulting extended encoding matrix has no identical column vectors under the target data size of code elements. For example, the standard Vandermonde matrix will have identical column vectors under 4-bit code elements (e.g., the 1st column vector is equal to the 16th column vector). Embodiments of this application transform the standard Vandermonde matrix to obtain an extended Vandermonde matrix, and the extended Vandermonde matrix has no identical column vectors under 4-bit code elements.
[0069] As an optional implementation for transforming the standard coding matrix Figure 3A An exemplary flowchart illustrating the process of obtaining an extended encoding matrix according to an embodiment of this application is provided. This process can be executed by a device with data processing capabilities. In one example, a processor in a computer system or an external device can perform the operation. Figure 3A The example process obtains an extended encoding matrix, which is then input into the memory controller so that the memory controller can use the extended encoding matrix for data encoding, decoding, and error correction. In one example, this embodiment of the application can also support obtaining the extended encoding matrix from the memory controller. (See reference...) Figure 3A The process may include the following steps.
[0070] In step S310, based on the preset column vectors, the column vectors in the standard encoding matrix are processed to obtain an intermediate encoding matrix containing the preset column vectors; the intermediate encoding matrix does not have the same column vectors under the code symbols of the target data size.
[0071] In an optional implementation, transforming the standard coding matrix into an extended coding matrix can be divided into two steps: horizontal expansion and row transformation.
[0072] Horizontal expansion refers to introducing predefined column vectors into the standard encoding matrix to obtain an intermediate encoding matrix. This intermediate encoding matrix ensures that no two column vectors are identical within the target data size. The horizontally expanded encoding matrix can be called the intermediate encoding matrix. Optionally, the predefined column vectors can be related to the unit column vectors in the identity matrix corresponding to the check code. For example, the predefined column vectors can be related to the unit column vector corresponding to the first check code c0; the unit column vectors can be considered as column vectors in the identity matrix corresponding to the check code. In one example... Figure 3B The example diagram shows a sample diagram of the check symbol and the identity matrix. Figure 3B In the example, the check code (c0,c1,c2,c3) has a corresponding 4x4 identity matrix. The column vectors of the 4 columns in the identity matrix can correspond to the check code (c0,c1,c2,c3) respectively. For example, the check code c0 corresponds to the identity column vector (1,0,0,0), and so on.
[0073] Row transformation refers to eliminating the preset column vectors in the intermediate coding matrix to obtain the extended coding matrix, so that the column vectors in the extended coding matrix are different from the unit column vectors in the identity matrix corresponding to the check code.
[0074] exist Figure 3A In the process shown, step S310 can be regarded as a way to implement horizontal expansion, and step S311 can be regarded as a way to implement row transformation.
[0075] As an optional method for implementing horizontal expansion in step S310, this embodiment of the application can determine two identical column vectors in the standard encoding matrix under the code elements of the target data size; and adjust one of the two identical column vectors to a preset column vector. That is, one of the two identical column vectors in the standard encoding matrix is directly replaced with a preset column vector, thereby obtaining an intermediate encoding matrix, and making the column vectors of the intermediate encoding matrix different under the code elements of the target data size. Optionally, this embodiment of the application can adjust the column vector that is ordered later in the two identical column vectors to a preset column vector. In one example, taking the standard Vandermonde matrix as an example, combined with... Figure 2B As shown, in 4-bit code, the first column vector and the 16th column vector of the standard Vandermonde matrix are equal, both being (1,1,1,1); in this embodiment, the 16th column vector, which is ordered later in the first and 16th column vectors, can be replaced with a preset column vector.
[0076] In an optional implementation, the preset column vector can be associated with the unit column vector corresponding to the first check code c0. For example, the preset column vector can be (1,0,0,0). In this embodiment, the 16th column vector in the standard Vandermonde matrix can be replaced with the preset column vector (1,0,0,0) to obtain an intermediate Vandermonde matrix (the intermediate Vandermonde matrix can be considered as an example of an intermediate coding matrix). As an example, Figure 3C An example diagram of an intermediate Vandermonde matrix is shown, in conjunction with... Figure 2B and Figure 3C As shown, the 16th column vector in the standard Vandermonde matrix is... Figure 2B As shown (1 15 ,2 15 4 15 8 15 ), adjusted to Figure 3C The given (1,0,0,0) code, in 4-bit code, Figure 3C The 16th column vector shown is not (1,1,1,1).
[0077] As another optional method for implementing horizontal expansion in step S310, this embodiment of the application can transpose the standard encoding matrix to obtain an intermediate encoding matrix containing preset column vectors. Furthermore, the intermediate encoding matrix does not contain identical column vectors for codebases of the target data size. Optionally, in the standard Vandermonde matrix, the exponents of the same column are the same and the bases are geometric (e.g., the exponents of 1, 2, 4, and 8 are geometric numbers of 2), and the exponents between columns are sequentially increasing. In this embodiment of the application, when transposing the standard encoding matrix, the exponents of the same column can be set to arithmetic progressions with the same base, and the bases between columns can be set to sequentially increasing, thereby obtaining an intermediate encoding matrix containing preset column vectors. In one implementation example, Figure 3D Another example diagram of the intermediate Vandermonde matrix is shown as an example. Figure 2A and Figure 2B The standard Vandermonde matrix shown can be obtained by performing a matrix transpose. Figure 3D The intermediate Vandermonde matrix shown is transformed so that the bases of its columns increase sequentially from 0 to 15, and columns within the same column have the same base and exponents ranging from 0 to 3. After transformation, the intermediate Vandermonde matrix contains a predefined column vector; for example, let's say the predefined column vector is (1,0,0,0). Figure 3D The first column vector (0) in the middle Vandermonde matrix of the example 0 ,0 1 ,0 2 ,0 3 ) is equal to the preset column vector (1,0,0,0).
[0078] In step S311, the row vectors in the intermediate encoding matrix are processed to obtain an extended encoding matrix that does not have a preset column vector.
[0079] After obtaining the intermediate coding matrix, although there are no identical column vectors in the codebase of the target data size, a preset column vector is introduced into the intermediate coding matrix. This preset column vector is related to the check codebase (for example, the preset column vector is the unit column vector corresponding to the first check codebase). Therefore, this embodiment of the application needs to eliminate the preset column vector in the intermediate coding matrix through row transformation, so that there is no preset column vector in the final extended coding matrix. That is, the final extended coding matrix is linearly independent of ECC. For example, each column vector in the final extended coding matrix is not equal to each column vector in the identity matrix corresponding to the check codebase.
[0080] In one example, taking the Vandermonde matrix as an example, the preset column vector (1,0,0,0) introduced into the intermediate Vandermonde matrix is eliminated by row transformation. During the row transformation, the unit column vector in the identity matrix corresponding to the check symbol (c0,c1,c2,c3) does not change. Therefore, after the preset column vector (1,0,0,0) is eliminated, the 16 column vectors in the extended Vandermonde matrix are not equal to the 4 unit column vectors in the identity matrix, thus realizing that the extended Vandermonde matrix is linearly independent of ECC.
[0081] Optionally, embodiments of this application can perform row transformations on the intermediate encoding matrix by processing the row vectors in the intermediate encoding matrix (in the encoding matrix, the content of one row can form a row vector), thereby eliminating the preset column vectors in the intermediate encoding matrix. In optional implementations, the processing of the row vectors in the intermediate encoding matrix can involve several different row transformation methods:
[0082] Method 1: Multiply the row vector of the first row in the intermediate encoding matrix by the first value, and add the result to the row vector of the second row; optionally, the first value can be any value a0;
[0083] Method 2: Multiply the row vector of the first row in the intermediate encoding matrix by the second value, and add the result to the row vector of the third row in the intermediate encoding matrix; optionally, the second value can be any value a1, and the first value and the second value can be equal or unequal;
[0084] Method 3: Multiply the row vector of the first row in the intermediate encoding matrix by the third value, and add the result to the row vector of the fourth row in the intermediate encoding matrix; optionally, the third value can be any value a2, and the first, second and third values can be different, or at least one value can be the same;
[0085] Method 4: Use both Method 1 and Method 2 simultaneously. Multiply the row vector of the first row in the intermediate encoding matrix by the first value, add the result to the row vector of the second row, and multiply the row vector of the first row in the intermediate encoding matrix by the second value, add the result to the row vector of the third row in the intermediate encoding matrix.
[0086] Method 5: Use both Method 1 and Method 3 above simultaneously. That is, multiply the row vector of the first row in the intermediate encoding matrix by the first value, add the result to the row vector of the second row, and multiply the row vector of the first row in the intermediate encoding matrix by the third value, add the result to the row vector of the fourth row in the intermediate encoding matrix.
[0087] Method 6: Use both Method 2 and Method 3 simultaneously. Multiply the row vector of the first row in the intermediate encoding matrix by the second value, add the result to the row vector of the third row in the intermediate encoding matrix, and multiply the row vector of the first row in the intermediate encoding matrix by the third value, add the result to the row vector of the fourth row in the intermediate encoding matrix.
[0088] Method 7: Use Method 1, Method 2 and Method 3 simultaneously. That is, multiply the row vector of the first row of the intermediate encoding matrix by the first value, add the result to the row vector of the second row, multiply the row vector of the first row of the intermediate encoding matrix by the second value, add the result to the row vector of the third row of the intermediate encoding matrix, and multiply the row vector of the first row of the intermediate encoding matrix by the third value, add the result to the row vector of the fourth row of the intermediate encoding matrix.
[0089] In optional implementations, when providing methods one, two, and three as described above, at least one row transformation method from methods one, two, and three can be used (for example, any one, two, or three of methods one, two, and three) to process the row vectors in the intermediate encoding matrix. It should be noted that the methods for processing the row vectors in the intermediate encoding matrix provided above are only optional implementations; any method that can transform the row vectors in the intermediate encoding matrix so that the resulting extended encoding matrix can eliminate the preset column vectors is supported by this application.
[0090] It is understandable that different row transformation methods will result in different forms of the final extended coding matrix. Therefore, this application does not limit the final form of the extended coding matrix, as long as it is ensured that there are no identical column vectors in the extended coding matrix under the code elements of the target data size, and that the column vectors in the extended coding matrix are different from the unit column vectors in the identity matrix corresponding to the check code elements.
[0091] After obtaining the extended coding matrix, as an optional implementation, embodiments of this application can encode the data symbols corresponding to the data using the extended coding matrix when the data needs to be written into memory, thereby obtaining check symbols; the check symbols and data symbols can be written into memory as the encoding result. Optionally, Figure 4 An exemplary flowchart of an optional data encoding method provided in an embodiment of this application is shown. This process can be implemented by a memory controller, for example, by an encoding module within the memory controller. (Refer to...) Figure 4 The process may include the following steps.
[0092] In step S410, the data to be written to memory is determined, and the data is mapped to multiple corresponding data symbols.
[0093] Optionally, when writing data to memory, the memory controller can obtain a data write request, which carries the data to be written to memory and the write address of the data in memory. In this embodiment, the data to be written to memory can be obtained from the data write request and mapped to multiple data symbols for data encoding. For example, the data to be written to memory can be mapped to 16 data symbols d0 to d... 15 .
[0094] In step S411, multiple data symbols are encoded according to the extended coding matrix to obtain multiple check symbols.
[0095] In this embodiment, the extended coding matrix can be obtained by transforming the standard coding matrix. The standard coding matrix has identical column vectors for code elements of the target data size; however, the extended coding matrix does not have identical column vectors for code elements of the target data size, and the column vectors in the extended coding matrix are different from the unit column vectors in the identity matrix corresponding to the check code elements. The method for obtaining the extended coding matrix can be referred to the corresponding description above, and will not be repeated here.
[0096] In an optional implementation, embodiments of this application may use an extended coding matrix, multiplied by multiple data symbols, to obtain multiple check symbols. It should be noted that the multiplication, addition, and other operations mentioned in embodiments of this application are all finite field operations. In one example, taking an extended Vandermonde matrix as an example, the extended Vandermonde matrix is a 4x16 matrix with 16 column vectors; the data to be written to memory is mapped to 16 data symbols d0 to d... 15 Then, the 4x16 extended Vandermonde matrix can be used with 16 data symbols d0 to d16. 15 Multiplying these results in four check bits, c0 to c3. An example of multiplying the Vandermonde matrix by the data bits to obtain the check bits can be found in [the following text is incomplete and requires further context]. Figure 2A As shown.
[0097] In step S412, multiple data symbols and multiple check symbols are written into memory as the encoding result; wherein, the multiple check symbols are used to correct errors in the encoding result when reading the encoding result from memory.
[0098] After obtaining multiple check bits based on the extended encoding matrix, the multiple data bits mapped to the data to be written to memory, along with the obtained check bits, can be used as the encoding result. This allows the encoding result to be written to memory (e.g., based on the write address carried in the data write request), thus enabling data writing to memory. Due to environmental interference such as electromagnetic interference and the inherent structural characteristics of memory, data errors may occur after the encoding result is written to memory. Therefore, the multiple check bits in the encoding result can be used to correct errors when reading the encoding result from memory.
[0099] The data encoding method provided in this application includes: determining data to be written to memory and mapping the data to a plurality of corresponding data symbols; encoding the plurality of data symbols according to an extended encoding matrix to obtain a plurality of check symbols; wherein the extended encoding matrix is obtained by transforming a standard encoding matrix, the standard encoding matrix having the same column vectors under the code symbols of the target data size; the extended encoding matrix not having the same column vectors under the code symbols of the target data size, and the column vectors in the extended encoding matrix are different from the unit column vectors in the identity matrix corresponding to the check symbols; after obtaining the plurality of check symbols, this application embodiment can write the plurality of data symbols and the plurality of check symbols as the encoding result into memory; wherein the plurality of check symbols are used to correct errors in the encoding result when reading the encoding result from memory.
[0100] Since the check code elements in this embodiment are obtained based on an extended coding matrix, and the extended coding matrix does not have identical column vectors for code elements of the target data size, and the column vectors in the extended coding matrix are different from the unit column vectors in the identity matrix corresponding to the check code elements, the extended coding matrix in this embodiment can provide comprehensive error correction support for data code elements compared to the standard coding matrix. This improves the coverage of the check code elements generated based on the extended coding matrix over the data code elements (e.g., the check code elements can completely cover the data code elements), thereby supporting an increase in the number of symbols that the error correction algorithm can correct (e.g., the error correction algorithm can correct data errors in two symbols). Therefore, the data encoding method provided in this embodiment can improve the coverage of the check code elements over the data code elements based on the extended coding matrix, supporting an increase in the number of symbols that the error correction algorithm can correct, and thus improving the error correction capability of the error correction algorithm.
[0101] Based on the data encoding method provided in the embodiments of this application, the embodiments of this application also provide a corresponding data decoding method. After reading the encoding result from memory, the data decoding method provided in the embodiments of this application can decode the encoding result to obtain a first and a second appendix as inputs to an error correction algorithm. This allows the error correction algorithm to check whether there are data errors in the encoding result read from memory and to correct the data errors (including error correction of data symbols and check symbols in the encoding result). Optionally, Figure 5A An exemplary flowchart of an optional data decoding method provided in an embodiment of this application is shown. This process can be implemented by a memory controller, for example, by a decoding module within the memory controller. (Refer to...) Figure 5A The process may include the following steps.
[0102] In step S510, the encoding result is read from memory. The encoding result includes multiple data symbols and multiple check symbols.
[0103] The encoded result read from memory can be obtained based on the data encoding method provided in the embodiments of this application. Due to environmental interference such as electromagnetic interference and the structural characteristics of memory itself, data errors may occur after the encoded result is written to memory. Therefore, the encoded result read from memory may differ from the encoded result written to memory. For example, the data code elements and check code elements in the encoded result read from memory may differ from those written to memory. Based on this, in the data decoding stage, the embodiments of this application can construct a syndrome as the input to the error correction algorithm based on the encoded result read from memory, so as to detect and correct errors in the encoded result read from memory.
[0104] In an optional implementation, the memory controller can read two data transfers from memory via a DDR channel, thereby obtaining the encoded result containing multiple data symbols and multiple check symbols. For example, taking a symbol size of 4 bits, two data transfers totaling 80 bits can be read via the DDR channel, including 16 data symbols d0 to d... 15 The data encoding output is the data decoding input (e.g., 16 data symbols and 4 check symbols, totaling 20 symbols). However, after memory reads and writes, the data decoding input and the data encoding output may become inconsistent, thus requiring data error checking and correction.
[0105] In an optional implementation, when reading data from memory, the memory controller can obtain a data read request, which carries a read address; in this embodiment, the encoded result can be read from memory according to the read address.
[0106] In step S511, the first syndrome is determined based on the extended coding matrix and the multiple data symbols and multiple check symbols read.
[0107] After reading the encoded result from memory, this embodiment of the application can use an extended encoding matrix to process multiple data symbols and multiple check symbols in the read encoded result, thereby obtaining a first syndrome. The syndrome can have four syndrome parameters. In one example, this embodiment of the application can define the first syndrome as (s0',s1',s2',s3').
[0108] Optionally, in embodiments of this application, the extended encoding matrix can be multiplied by multiple read data symbols, and the multiplication result can be XORed with multiple read check symbols and the identity matrix corresponding to the check symbols to obtain the first companion. For example, in embodiments of this application, the extended Vandermonde matrix can be multiplied by 16 read data symbols, and the multiplication result can be XORed with 4 read check symbols and the identity matrix corresponding to the check symbols to obtain the first companion (s0',s1',s2',s3'). In one example, Figure 5B An example diagram illustrating the first adjoint derived from the Vandermonde matrix is shown for reference.
[0109] In step S512, the second synod is determined according to the first synod and the method of obtaining the extended coding matrix; wherein the first synod and the second synod are used as the decoding result, and the decoding result is used as the input of the error correction algorithm to correct the read coding result.
[0110] After obtaining the first companion (s0', s1', s2', s3'), embodiments of this application can determine the operation method for obtaining the second companion based on the method of obtaining the extended coding matrix, and then use the determined operation method to operate on the first companion to obtain the second companion. Alternatively, embodiments of this application can determine the operation method for obtaining the second companion based on the row transformation method used to obtain the extended coding matrix, and then use the determined operation method to operate on the first companion to obtain the second companion.
[0111] In one implementation example, based on the row transformation methods described above (methods one through seven), the operation method for obtaining the second companion can be adjusted accordingly when using different row transformation methods from methods one through seven to obtain the extended coding matrix. The following uses the row transformation methods from methods one through seven as examples to illustrate the example content of obtaining the second companion based on the first companion operation under various row transformation methods from methods one to seven. For ease of explanation, the second companion is defined as (s0, s1, s2, s3) in this embodiment.
[0112] Operation Method 1 corresponds to the case of obtaining the extended coding matrix using the row transformation method of Method 1, (s0,s1,s2,s3)=(s0',s1'+a0*s0',s2',s3'); that is, the first accompanying parameter s0', the third accompanying parameter s2', and the fourth accompanying parameter s3' in the first accompanying equation are kept unchanged, the first accompanying parameter s0' in the first accompanying equation is multiplied by the first value a0, and the result of the multiplication is added to the second accompanying parameter s1' in the first accompanying equation, thereby adjusting the second accompanying parameter s1 in the second accompanying equation to obtain the second accompanying equation (s0,s1,s2,s3);
[0113] The second operation method corresponds to the case where the extended coding matrix is obtained by using the row transformation method of the second method. (s0,s1,s2,s3)=(s0',s1',s2'+a1*s0',s3'); that is, the first companion parameter s0', the second companion parameter s1', and the fourth companion parameter s3' in the first companion equation remain unchanged. The first companion parameter s0' in the first companion equation is multiplied by the second value a1, and the result of the multiplication is added to the third companion parameter s2' in the first companion equation, thereby adjusting the third companion parameter s2 in the second companion equation to obtain the second companion equation (s0,s1,s2,s3).
[0114] Operation method three corresponds to the case of obtaining the extended coding matrix using the row transformation method of method three, (s0,s1,s2,s3)=(s0',s1',s2',s3'+a2*s0'); that is, the first adjoint parameter s0', the second adjoint parameter s1', and the third adjoint parameter s2' in the first adjoint remain unchanged, the first adjoint parameter s0' in the first adjoint is multiplied by the third value a2, and the result of the multiplication is added to the fourth adjoint parameter s3' in the first adjoint, thereby adjusting the fourth adjoint parameter s3 in the second adjoint to obtain the second adjoint (s0,s1,s2,s3);
[0115] Operation method four corresponds to the case of obtaining the extended coding matrix using the row transformation method of operation method four, (s0,s1,s2,s3)=(s0',s1'+a0*s0',s2'+a1*s0',s3'); that is to say, operation method four uses operation method one and operation method two at the same time.
[0116] Operation method five corresponds to the case where the extended coding matrix is obtained by using the row transformation method of operation method five, (s0,s1,s2,s3)=(s0',s1'+a0*s0',s2',s3'+a2*s0'); that is to say, operation method five uses operation method one and operation method three at the same time.
[0117] Operation method six corresponds to the case where the extended coding matrix is obtained by using the row transformation method of method six, (s0,s1,s2,s3)=(s0',s1',s2'+a1*s0',s3'+a2*s0'); that is to say, operation method six uses operation method two and operation method three at the same time.
[0118] Operation method seven corresponds to the case where the extended coding matrix is obtained by using the row transformation method of method seven, (s0,s1,s2,s3)=(s0',s1'+a0*s0',s2'+a1*s0',s3'+a2*s0'); that is to say, operation method seven uses operation method one, operation method two and operation method three at the same time.
[0119] As can be seen, based on the fact that the row transformation method used to obtain the extended coding matrix is at least one of the row transformation methods of method one, method two, and method three, the embodiments of this application can use at least one of the operation methods of method one, operation method two, and operation method three (for example, any one, any two, or any three of the operation methods of method one, operation method two, and operation method three) to operate on the first companion (s0',s1',s2',s3') to obtain the second companion (s0,s1,s2,s3).
[0120] After obtaining the decoding result, it can be used as input to an error correction algorithm to correct errors in the encoded result read from memory. As an optional implementation, Figure 6 An exemplary flowchart of an optional data error correction method provided in an embodiment of this application is shown. This process can be implemented by a memory controller, for example, by an error correction module within the memory controller. (Refer to...) Figure 6 The process may include the following steps.
[0121] In step S610, the decoding result is obtained, which includes a first syndrome and a second syndrome.
[0122] The decoding result obtained by the error correction module can be obtained based on the data decoding method provided in the embodiments of this application. The decoding result obtained by the error correction module may include a first synod (s0',s1',s2',s3') and a second synod (s0,s1,s2,s3).
[0123] In step S611, an error correction algorithm is run according to the first and second synods to determine the error correction result corresponding to the encoding result read from memory.
[0124] The decoding result serves as the input to the error correction algorithm of the error correction module. After obtaining the decoding result, the error correction module can run the error correction algorithm based on the first and second synastry in the decoding result to determine the error correction result corresponding to the encoded result read from memory. Optionally, the error correction result may be that the encoded result read from memory does not contain data errors. In this case, the data symbols in the encoded result read from memory do not contain data errors, and this embodiment can output the data symbols read from memory. Optionally, the error correction result may also be that the encoded result read from memory contains data errors. In this case, this embodiment can output the error location (e.g., the location of the symbol with the data error) and the error value of each error location in the encoded result read from memory. Based on the support of the extended coding matrix, this embodiment can support the correction of data errors of two symbols. It should be noted that symbols correspond to code elements. Therefore, when correcting the encoded result read from memory, the location and error value of the code element with the data error are also the location and error value of the symbol with the data error.
[0125] Optionally, the encoding result read from memory can be obtained based on the data encoding method provided in the embodiments of this application.
[0126] As an optional implementation Figure 7 An exemplary flowchart for determining the error correction result is shown. Figure 7 It can be regarded as Figure 6 The step S611 shown can be implemented in various ways. (Refer to...) Figure 7 The process may include the following steps.
[0127] In step S710, the first and second syndromes are read.
[0128] In step S711, it is determined whether all the accompanying parameters in the first accompanying equation are target values. If yes, step S712 is executed; otherwise, step S713 is executed.
[0129] Optionally, the target value can be a value corresponding to the absence of data errors in the encoded result read from memory (e.g., neither the data code elements nor the check code elements read from memory correspond to values corresponding to data errors). In one implementation example, the target value can be 0; embodiments of this application can determine whether all the accompanying parameters in the first accompanying expression are 0.
[0130] In step S712, the data symbols in the encoding result read from memory are output.
[0131] When all the accompanying parameters in the first accompanying expression are target values, the embodiments of this application can determine that there are no data errors in the encoding result read from memory. Therefore, the embodiments of this application can output the data symbols in the encoding result read from memory to realize the output of the data read from memory. For example, the data symbols can be output to a processor or other device that requires data to be read.
[0132] In step S713, it is determined whether the number of accompanying parameters with the target value in the first accompanying expression has reached the preset number. If yes, step S712 is executed; otherwise, step S714 is executed.
[0133] If the number of accompanying parameters with a value of the target value in the first accompanying expression reaches a preset number, it indicates that although there is a data error in the encoded result read from memory, the data error occurs at a check symbol, while the data symbols do not have data errors. Therefore, this embodiment allows the output of the data symbols in the encoded result read from memory. Optionally, the preset number can be the total number of accompanying parameters in the first accompanying expression minus one; for example, if the preset number is 3, this embodiment can determine whether the number of accompanying parameters with a value of 0 in the first accompanying expression reaches 3.
[0134] In step S714, various error correction operations are used to perform error correction processing on the second syntactic, and the error correction outputs of various error correction operations are obtained.
[0135] Optionally, if none of the accompanying parameters in the first accompanying expression are target values, and the number of accompanying parameters with target values is less than a preset number, it indicates that there are data errors in the encoded results read from memory (the data errors may be in all data symbols, or in both data symbols and check symbols). In this case, this embodiment of the application needs to use various error correction operations to perform error correction processing on the second accompanying expression and obtain the error correction outputs of various error correction operations. For example, if none of the accompanying parameters in the first accompanying expression (s0',s1',s2',s3') are 0, and the number of accompanying parameters with values of 0 is less than 3, this embodiment of the application can use various error correction operations to perform error correction processing on the second accompanying expression (s0,s1,s2,s3) to obtain the error correction outputs of various error correction operations.
[0136] In an optional implementation, embodiments of this application may utilize at least two of the following five error correction operations to perform error correction processing on the second adjoint; in one example, all five of the following error correction operations may be used to perform error correction processing on the second adjoint.
[0137] Two-data error correction;
[0138] Data and ECC1 error correction operations;
[0139] Data and ECC2 error correction operations;
[0140] Data and ECC3 error correction operations;
[0141] Single data error correction.
[0142] Optionally, after performing error correction processing on the second syntactic using multiple error correction operations, each error correction algorithm has its own error correction output. The error correction output of an error correction algorithm may include the following: whether there is a solution, and the corresponding symbol position and error value when there is a solution; if the error correction algorithm outputs a solution, it is considered that the error correction algorithm can solve for the symbol position and error value when there is a data error, and if the error correction algorithm outputs no solution, it is considered that the error correction algorithm cannot solve for the symbol position and error value when there is a data error.
[0143] In step S715, the error correction outputs of various error correction operations are combined to determine the code element position and error value in the encoding result read from memory where the data error occurred.
[0144] Optionally, based on the error correction output of multiple error correction algorithms, if only one of the multiple error correction algorithms outputs a solution, then the embodiments of this application can determine the code position and error value of the code that caused the data error in the output of the error correction algorithm, which are the code position and error value of the code that caused the data error in the encoding result read from memory.
[0145] Optionally, if more than one of the error correction algorithms outputs a solution, the present application embodiment can be considered as having no solution for the data error. In this case, the present application embodiment can determine that the encoded result read from memory has an uncorrectable data error. The present application embodiment may not output any error location or error value, and may not output any data symbols. In one example, assuming that double data error correction operation and data and ECC1 error correction operation are used to correct the second symptom; if both double data error correction operation and data and ECC1 error correction operation output a solution, and output the error location where the data error occurred (the error locations output by double data error correction operation and data and ECC1 error correction operation may be different), then the present application embodiment can be considered as having no solution for the data error in the encoded result, and it cannot be corrected.
[0146] In step S716, based on the location and error value of the code element with data error, the code element with data error in the encoding result read from memory is corrected to obtain the corrected encoding result, and the data code element in the corrected encoding result is output.
[0147] When only one of the error correction algorithms outputs a solution, this embodiment of the application can use the code position and error value of the code that has a data error in the output of the error correction algorithm as the code position and error value of the code that has a data error in the encoding result read from memory. Then, based on the code position and error value of the code that has a data error in the output of the error correction algorithm, this embodiment of the application can perform data error correction on the code that has a data error in the encoding result read from memory, obtain the encoding result with corrected data error, and output the data code in the encoding result with corrected data error, so that the accurate data code can be output to the processor or other device that requires reading data.
[0148] When correcting data errors in code elements that have data errors in the encoding results read from memory, based on the support of the extended encoding matrix in the embodiments of this application, the embodiments of this application can support the correction of data errors of 2 code elements, for example, the correction of data errors of 2 code elements, and of course, the correction of data errors of 1 code element can also be supported.
[0149] Taking a 4-bit code as an example, based on the support of the extended Vandermonde matrix, this embodiment can correct errors in any two code elements within a 64-bit data code (corresponding to 16 data code elements) and a 16-bit check code (corresponding to 4 check code elements), thereby resolving the situation where two symbol positions are incorrect. Compared to the classic RS code scheme, which supports correcting errors in any two code elements within a 44-bit data code and a 16-bit check code, this embodiment, when correcting errors in two code elements, can support error correction for a larger amount of data code elements compared to the classic RS code scheme. Compared to the standard VanderMont matrix approach, which is limited by Euler's theorem in finite fields and can only correct errors on up to 60 bits of data symbols, failing to cover the remaining 4 bits, this embodiment provides a solution that, compared to the standard VanderMont matrix approach, can provide complete error correction coverage for 64 bits of data symbols, resolving the situation where two symbols are incorrect, thereby improving the error correction algorithm's capability. Furthermore, when adapting to the bit width of the DDR5 standard, this embodiment can transform an uncorrectable error into a correctable one when two devices (memory chips) in DDR5 memory malfunction, thus correcting the errors in the data from the two faulty devices; each device corresponds to one symbol.
[0150] In a further optional implementation, the following section uses the five error correction operations mentioned above as examples to introduce an optional implementation for error correction processing of the second collocation using error correction operations. In the optional implementation, the error correction module in the memory controller can be configured with error correction operation units corresponding to various error correction operations, so as to realize the error correction processing of the second collocation using various error correction operations.
[0151] (1) Dual data error correction operation
[0152] Calculate the first parameter a, the second parameter b, and the third parameter c based on the second adjoint equation (s0, s1, s2, s3); optionally, the formulas for calculating the first parameter a, the second parameter b, and the third parameter c can be, for example:
[0153] a = s1 2 +s0*s2,b=s1*s2+s0*s3,c=s1*s3+s2 2 ;
[0154] Based on the first parameter a, the second parameter b, and the third parameter c, construct the quadratic equation ax in the finite field. 2 +bx+c=0;
[0155] Based on the above quadratic equation, if a is 0, it is considered that the double data error correction operation has no solution, that is, the output of the double data error correction operation does not have data errors.
[0156] If a is not 0, then let y = ax / b and u = ac / b. 2 Therefore, the above quadratic equation can be transformed into the following equation: y 2 +y+u=0;
[0157] For the transformed equation, the equation y can be... 2 Solving the equation +y+u=0, for example, using a quadratic equation root XOR table, can determine whether the transformed quadratic equation is solvable; in one example... Figure 8 An example diagram of the XOR table for finding the roots of a quadratic equation is shown for reference. Combined with... Figure 8 As shown, u0 to u3 represent different values of u, a0 to a3 represent different values of a, and y0 to y3 represent different values of y. If u takes the value u3 and u3 is 1, then the equation has no solution, which is considered as no solution in the double data error correction operation.
[0158] If the equation has a solution, the embodiments of this application can obtain the solutions y and y' of the equation through XOR operation; then, according to the row transformation method used when constructing the extended Vandermonde matrix, the first error position x and the second error position x' are calculated; the first error position x can be regarded as the error position of the first erroneous data symbol, and the second error position x' can be regarded as the error position of the second erroneous data symbol; the calculation of the first error position x and the second error position x' can be carried out using any of the following schemes:
[0159] Scheme (11), x=log(y*b / a), x'=log(y'*b / a);
[0160] Scheme (12), x=y*b / a, x'=y'*b / a;
[0161] The error value e at the first error position x is calculated based on the different schemes used to calculate the first error position x and the second error position x'. x And calculate the error value e at the second error location x'. x’ The method can be adjusted accordingly, for example:
[0162] When calculating x and x' using scheme (11), e x =(s0*2) x’ +s1) / (2 x +2 x’ ), e x’ =s0+e x ;
[0163] When using scheme (12) to calculate x and x', e x =(s0*x'+s1) / (x+x'), e x’ =s0+e x .
[0164] (2) Data and ECC1 error correction operations
[0165] Assuming the value of ecc1 is incorrect (ecc1 corresponds to the second check code c1, i.e., assuming the second check code c1 is incorrect), the following scheme can be used to determine the location and value of the data error.
[0166] Scheme (21), based on the second syndrome (s0,s1,s2,s3), if s3 / s2 = 2 x And s2 / s0 = 2 2x The error positions are x and ecc1 (i.e., check code c1), where x is the error position of the erroneous data code, the error value of x is s0, and the error value of ecc1 is (s0*2). x ⊕s1), where ⊕ represents the XOR operation;
[0167] Scheme (22), second adjoint (s0,s1,s2,s3), if s3 / s2=x and s2 / s0=x 2 The error locations are x and ecc1, respectively. The error value of x is s0, and the error value of ecc1 is (s0*x⊕s1).
[0168] (3) Data and ECC2 error correction operations
[0169] Assuming the value of ecc2 is incorrect (ecc2 corresponds to the third check symbol c2, i.e., assuming the third check symbol c2 is incorrect), the following scheme is used to determine the location and value of the data error.
[0170] Scheme (31), based on the second adjoint (s0,s1,s2,s3), if s1 / s0=2 x And s3 / s1=2 2x The error positions are x and ecc2 (i.e., check code c2), the error value of x is s0, and the error value of ecc2 is (s1*2). x ⊕s2);
[0171] Scheme (32), based on the second adjoint (s0,s1,s2,s3), if s1 / s0 = x and s3 / s1 = x 2 The error locations are x and ecc2, respectively. The error value of x is s0, and the error value of ecc2 is (s1*x⊕s2).
[0172] (4) Data and ECC3 error correction operations
[0173] Assuming the value of ecc3 is incorrect (ecc3 corresponds to the fourth check code c3, i.e., assuming the fourth check code c3 is incorrect), the following scheme is used to determine the location and value of the data error.
[0174] Scheme (41), based on the second adjoint (s0,s1,s2,s3), if s1 / s0=s2 / s1=2 x The error positions are x and ecc3 (i.e., check code c3), the error value of x is s0, and the error value of ecc3 is (s2*2). x ⊕s3);
[0175] Scheme (42) is based on the second syntactic (s0,s1,s2,s3). If s1 / s0 = s2 / s1 = x, then the error positions are x and ecc3 respectively. The error value of x is s0, and the error value of ecc3 is (s2*x⊕s3).
[0176] (5) Single data error correction operation
[0177] When performing error correction operations using single-data error correction operations, the following methods can be used to determine the location and value of the data error;
[0178] Scheme (51), based on the second adjoint (s0,s1,s2,s3), if s3 / s2=s2 / s1=s1 / s0=2 x The error location is x, and the error value is s0.
[0179] Scheme (52) is based on the second syntactic (s0,s1,s2,s3). If s3 / s2 = s2 / s1 = s1 / s0 = x, then the error position is x and the error value is s0.
[0180] When using single-data error correction operation, the single-data error correction operation is responsible for outputting the error position and error value of a single data symbol, while the error correction of a single check symbol is determined by step S713; for example, when the number of the accompanying parameters with the value of the target value in the first syntactic reaches a preset number, the data error occurs at a check symbol.
[0181] It can be seen that, in various error correction operations, if only the output of the double data error correction operation has a solution, then the embodiments of this application can correct the data errors of two data symbols, such as correcting the data errors at error positions x and x'.
[0182] If only the data and the output of the ECC1 error correction operation have a solution, then the embodiments of this application can correct the data error of a data symbol and the data error of the check symbol c1, for example, correcting the data error of error position x and check symbol c1.
[0183] If only the data and the output of the ECC2 error correction operation have a solution, then the embodiments of this application can correct the data error of a data symbol and the data error of the check symbol c2, for example, correcting the data error of error position x and check symbol c2.
[0184] If only the data and the output of the ECC3 error correction operation have a solution, then the embodiments of this application can correct the data error of a data symbol and the data error of the check symbol c3. For example, it can correct the error position x and the check symbol c3 as data errors.
[0185] If only a single data error correction operation output has a solution, then the embodiments of this application can correct the data error of one data symbol.
[0186] In other words, the above five error correction operations cover 16 data symbols and 3 check symbols (c1, c2, c3). Therefore, in the case where two symbols are incorrect out of the 20 symbols (16 data symbols and 4 check symbols), this embodiment can largely cover the situation. For example, taking a 4-bit symbol as an example, with the support of the extended Vandermonde matrix, this embodiment can simultaneously correct errors in two symbols out of 16 data symbols (64 bits) and 4 check symbols (16 bits). If only one 4-bit symbol is incorrect, this embodiment can also support error correction without changing the algorithm. This embodiment can improve the error correction capability of the error correction algorithm and enhance memory reliability.
[0187] In practical application, taking a 4-bit symbol as an example, based on the extended VanderMont matrix, this embodiment can correct data errors in any one or two symbols within the 64-bit data symbols and 16-bit check symbols. When only one symbol position is incorrect, the accuracy of correction using the extended VanderMont matrix reaches 100%. Furthermore, this embodiment can resolve the issue of UE reports occurring when symbols are incorrect in two positions, thus achieving correction for errors in symbols at both positions.
[0188] Furthermore, embodiments of this application can utilize the characteristics of the encoding matrix to generate two sets of syndromes during the decoding process and determine the error type step by step during the error correction process; thereby, by utilizing the characteristics of quadratic equations in a finite field, the number of errors can be quickly determined, and it can be determined whether the error location contains a check symbol, thus improving the probability of error correction. In addition, if the correctness of the ECC granules is guaranteed, the accuracy of correcting two random data symbol errors using the extended Vandermonde matrix can reach 100%.
[0189] It is worth noting that the extended encoding matrix, such as the extended Vandermonde matrix, used in this invention is not unique. By performing transformations such as mirroring or swapping rows and columns on the encoding matrix, the column vectors in the encoding matrix can still be made unequal and can still be used for error correction. Therefore, there are many possible forms of the extended encoding matrix, such as the extended Vandermonde matrix, used in the embodiments of this application, and the embodiments of this application do not set any limitations on this.
[0190] Extended Vandermonde matrices and other extended coding matrices are not limited to 4-bit code elements; standard Vandermonde matrices are in GF(2... n In a finite field, the maximum number of fields that can be supported is 2. n Error correction of -1 data symbol. After transforming the standard Vandermonde matrix into an extended Vandermonde matrix, the embodiments of this application can support 2 n Error correction of 2 data symbols, therefore, the embodiments of this application can also be implemented in 2 n In a set of 1 data code and 4 check code (each code is n bits), 2 code errors are corrected.
[0191] This application also provides a memory controller, combined with... Figure 1 As shown, the memory controller may include an encoding module, a decoding module, and an error correction module. The encoding module executes the data encoding method provided in this embodiment, the decoding module executes the data decoding method provided in this embodiment, and the error correction module executes the data error correction method provided in this embodiment. The content of the data encoding method, data decoding method, and data error correction method provided in this embodiment can be referred to the descriptions in the corresponding sections above; correspondingly, the functions of the encoding module, decoding module, and error correction module can also be referred to the descriptions in the corresponding sections above.
[0192] This application also provides a chip, including the memory controller provided in this application embodiment.
[0193] This application also provides an electronic device, such as a terminal device or a server device, which may include the chip provided in this application.
[0194] The foregoing describes multiple embodiment schemes provided by the embodiments of this application. The optional methods described in each embodiment scheme can be combined and cross-referenced with each other without conflict, thereby extending to a variety of possible embodiment schemes. These can all be considered as the embodiment schemes disclosed and published by the embodiments of this application.
[0195] While the embodiments disclosed above are described in this application, this application is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of this application; therefore, the scope of protection of this application should be determined by the scope defined in the claims.
Claims
1. A data encoding method, characterized in that, include: Determine the data to be written to memory, and map the data into multiple corresponding data symbols; According to the extended coding matrix, the multiple data symbols are encoded to obtain multiple check symbols; wherein, the extended coding matrix is obtained by transforming the standard coding matrix, and the standard coding matrix has the same column vectors under the code symbols of the target data size; the extended coding matrix does not have the same column vectors under the code symbols of the target data size, and the column vectors in the extended coding matrix are different from the unit column vectors in the identity matrix corresponding to the check symbols; The plurality of data code elements and the plurality of check code elements are used as the encoding result and written into memory; wherein, the plurality of check code elements are used to correct errors in the encoding result when reading the encoding result from memory.
2. The method according to claim 1, characterized in that, Also includes: The standard encoding matrix is horizontally expanded to introduce a preset column vector into the standard encoding matrix to obtain an intermediate encoding matrix. The intermediate encoding matrix does not have the same column vectors under the code elements of the target data size. The preset column vector is related to the unit column vector in the identity matrix corresponding to the check code element. The intermediate encoding matrix is subjected to row transformation to eliminate the preset column vectors in the intermediate encoding matrix, thereby obtaining the extended encoding matrix.
3. The method according to claim 2, characterized in that, The step of horizontally expanding the standard encoding matrix to introduce a preset column vector into the standard encoding matrix to obtain an intermediate encoding matrix includes: Based on the preset column vectors, the column vectors in the standard encoding matrix are processed to obtain an intermediate encoding matrix containing the preset column vectors; The step of performing row operations on the intermediate encoding matrix to eliminate preset column vectors in the intermediate encoding matrix to obtain the extended encoding matrix includes: The row vectors in the intermediate encoding matrix are processed to obtain an extended encoding matrix that does not have a preset column vector.
4. The method according to claim 3, characterized in that, The step of processing the column vectors in the standard encoding matrix based on the preset column vectors to obtain an intermediate encoding matrix containing the preset column vectors includes: Under the code symbols of the target data size, determine the two identical column vectors of the standard coding matrix, and adjust one of the two identical column vectors to the preset column vector; Alternatively, the standard encoding matrix can be transposed to obtain an intermediate encoding matrix containing the preset column vectors; wherein, in the standard encoding matrix, the exponents of the same column are the same and the bases are geometric numbers, and the exponents between columns are sequentially increasing; after the standard encoding matrix is transposed, the exponents of the same column are arithmetic numbers and the bases are the same, and the bases between columns are sequentially increasing.
5. The method according to claim 3, characterized in that, The step of processing the row vectors in the intermediate encoding matrix to obtain an extended encoding matrix that does not contain a preset column vector includes: The row vectors in the intermediate encoding matrix are processed using at least one of the following row transformation methods to obtain an extended encoding matrix that does not have a preset column vector: Multiply the row vector of the first row in the intermediate encoding matrix by the first value, and add the result of the multiplication to the row vector of the second row; Multiply the row vector of the first row in the intermediate encoding matrix by the second value, and add the result of the multiplication to the row vector of the third row in the intermediate encoding matrix; Multiply the row vector of the first row in the intermediate encoding matrix by the third value, and add the result of the multiplication to the row vector of the fourth row in the intermediate encoding matrix.
6. The method according to any one of claims 1-5, characterized in that, The standard coding matrix is a standard Vandermonde matrix, in which the first column vector and the sixteenth column vector are equal under 4-bit code elements; the extended coding matrix is an extended Vandermonde matrix obtained by transforming the standard Vandermonde matrix, in which the first column vector and the sixteenth column vector are different under 4-bit code elements, and the column vectors in the extended Vandermonde matrix are different from the unit column vector corresponding to the first check code element.
7. A data decoding method, characterized in that, include: The encoded result is read from memory, and the encoded result includes multiple data code elements and multiple check code elements; The encoding result is obtained based on the data encoding method according to any one of claims 1-6; The first syndrome is determined based on the extended coding matrix, as well as the multiple data symbols and multiple check symbols read. Based on the first synequation and the method of obtaining the extended coding matrix, a second synequation is determined; wherein the first synequation and the second synequation are used as decoding results, and the decoding results are used as input to an error correction algorithm to correct the coding results.
8. The method according to claim 7, characterized in that, Determining the second syndrome based on the first syndrome and the method of obtaining the extended coding matrix includes: Based on the method of obtaining the extended coding matrix, the operation method for obtaining the second syndrome is determined; using the determined operation method, the first syndrome is operated on to obtain the second syndrome.
9. The method according to claim 8, characterized in that, The step of determining the operation method for obtaining the second adjoint based on the method of obtaining the extended coding matrix includes: Based on the row transformation method used to obtain the extended coding matrix, the operation method used to obtain the second synod is determined.
10. The method according to claim 9, characterized in that, The step of determining the operation method for obtaining the second adjoint based on the row transformation method used to obtain the extended coding matrix includes: Based on the row transformation method used to obtain the extended coding matrix, at least one of the following operation methods is determined as the operation method for obtaining the second adjoint: Keep the first, third, and fourth accompanying parameters in the first accompanying equation unchanged, multiply the first accompanying parameter in the first accompanying equation by the first value, and add the result of the multiplication to the second accompanying parameter in the first accompanying equation to adjust the second accompanying parameter in the second accompanying equation. Keep the first, second, and fourth accompanying parameters in the first accompanying equation unchanged, multiply the first accompanying parameter in the first accompanying equation by the second value, and add the result of the multiplication to the third accompanying parameter in the first accompanying equation to adjust the third accompanying parameter in the second accompanying equation. Keeping the first, second, and third accompanying parameters in the first accompanying equation unchanged, multiply the first accompanying parameter in the first accompanying equation by the third value, and add the result of the multiplication to the fourth accompanying parameter in the first accompanying equation to adjust the fourth accompanying parameter in the second accompanying equation.
11. A data error correction method, characterized in that, include: Obtain a decoding result, the decoding result including a first synapse and a second synapse; the decoding result is obtained based on the data decoding method according to any one of claims 7-10; Based on the first and second syndromes, an error correction algorithm is run to determine the error correction result corresponding to the encoding result read from memory.
12. The method according to claim 11, characterized in that, The step of running the error correction algorithm based on the first and second syntactic expressions to determine the error correction result corresponding to the encoding result read from memory includes: Determine whether all the accompanying parameters in the first accompanying equation are target values; If all the accompanying parameters in the first syntactic expression are target values, it is determined that there are no data errors in the encoding result, and the data symbols in the encoding result are output. If not all the accompanying parameters in the first syndrome are target values, and the number of accompanying parameters in the first syndrome that are target values reaches a preset number, then it is determined that a check symbol in the encoding result has a data error, and the data symbol in the encoding result is output.
13. The method according to claim 12, characterized in that, The step of running the error correction algorithm based on the first and second synecdotes to determine the error correction result corresponding to the encoding result read from memory further includes: If the accompanying parameters in the first accompanying equation are not all target values, and the number of accompanying parameters in the first accompanying equation that are target values does not reach the preset number, the second accompanying equation is processed by various error correction operations to obtain the error correction output of various error correction operations. By combining the error correction outputs of various error correction operations, the location and error value of the code element containing the data error in the encoded result read from memory are determined; Based on the position and error value of the code element with the data error, the code element with the data error in the encoding result is corrected to obtain the corrected encoding result, and the data code element in the corrected encoding result is output.
14. The method according to claim 13, characterized in that, The method of determining the location of the code element and the error value of the data error in the encoded result read from memory by combining the error correction output of various error correction operations includes: If only one of the error correction algorithms outputs a solution, then the code position and error value of the code that caused the data error in the output of that error correction algorithm are determined as the code position and error value of the code that caused the data error in the encoding result. If more than one of the error correction algorithms in the various error correction operations has a solution, then it is determined that the encoding result has an uncorrectable data error.
15. The method according to any one of claims 13-14, characterized in that, The method of using multiple error correction operations to perform error correction processing on the second adjoint, and obtaining the error correction outputs of various error correction operations, includes: The second symptom is subjected to error correction processing using at least two of the following: double data error correction operation, data and ecc1 error correction operation, data and ecc2 error correction operation, data and ecc3 error correction operation, and single data error correction operation, so as to obtain the error correction output of various error correction operations. Here, ecc1 is the second check code c1, ecc2 is the third check code c2, and ecc3 is the fourth check code c3.
16. The method according to claim 15, characterized in that, The process of correcting the second adjoint using dual-data error correction operations includes: Calculate the first parameter a, the second parameter b, and the third parameter c based on the second adjoint equation (s0, s1, s2, s3); Construct a quadratic equation ax in a finite field based on the first parameter a, the second parameter b, and the third parameter c. 2 +bx+c=0; If a is 0, then the double data error correction operation has no solution; If a is not 0, let y = ax / b and u = ac / b. 2 The quadratic equation is transformed to obtain the transformed equation y. 2 +y+u=0, and the equation y 2 Solve for +y+u=0; If the equation y 2 If +y+u=0 has no solution, then the double data error correction operation has no solution. If the equation y 2 +y+u=0 has a solution, so we can obtain the solutions y and y' of the equation; Determine x = log(y) b / a), x'=log(y') b / a), and e x =(s0 2 x’ +s1) / (2 x +2 x’ ), e x’ =s0+e x Where x is the error position of the first erroneous data symbol, x' is the error position of the second erroneous data symbol, and e x For the error value of x, e x’ The error value for x'; Alternatively, determine x=y b / a, x'=y' b / a, and e x =(s0 x'+s1) / (x+x'), e x’ =s0+e x .
17. The method according to claim 15, characterized in that, The process of correcting the second adjoint using data and ECC1 error correction operations includes: Assuming the value of ecc1 is incorrect, based on the second syndrome (s0, s1, s2, s3), if s3 / s2 = 2 x And s2 / s0=2 2x The error locations are determined to be x and ecc1, with the error value of x being s0 and the error value of ecc1 being s0. 2 x ⊕s1, where x is the error position of the erroneous data code, and ecc1 corresponds to the second check code c1; Alternatively, assuming the value of ecc1 is incorrect, based on the second adjoint (s0, s1, s2, s3), if s3 / s2 = x and s2 / s0 = x 2 The error locations are determined to be x and ecc1, with the error value of x being s0 and the error value of ecc1 being s0. x⊕s1.
18. The method according to claim 15, characterized in that, The process of correcting the second adjoint using data and ECC2 error correction operations includes: Assuming the value of ecc2 is incorrect, based on the second syndrome (s0, s1, s2, s3), if s1 / s0 = 2 x And s3 / s1=2 2x The error locations are determined to be x and ecc2, with the error value of x being s0 and the error value of ecc2 being s1. 2 x ⊕s2, where ecc2 corresponds to the third check code element c2; Alternatively, assuming the value of ecc2 is incorrect, based on the second adjoint (s0, s1, s2, s3), if s1 / s0 = x and s3 / s1 = x 2 The error locations are determined to be x and ecc2, with the error value of x being s0 and the error value of ecc2 being s1. x⊕s2.
19. The method according to claim 15, characterized in that, The process of correcting the second adjoint using data and ECC3 error correction operations includes: Assuming the value of ecc3 is incorrect, based on the second syndrome (s0, s1, s2, s3), if s1 / s0 = s2 / s1 = 2 x The error locations are determined to be x and ecc3, with the error value of x being s0 and the error value of ecc3 being s2. 2 x ⊕s3, where ecc3 corresponds to the fourth check code element c3; Alternatively, assuming the value of ecc3 is incorrect, based on the second adjoint (s0, s1, s2, s3), if s1 / s0 = s2 / s1 = x, then the error locations are determined to be x and ecc3, respectively. The error value of x is s0, and the error value of ecc3 is s2. x⊕s3.
20. The method according to claim 15, characterized in that, The process of correcting the second adjoint using single-data error correction operations includes: Based on the second syndrome (s0, s1, s2, s3), if s3 / s2 = s2 / s1 = s1 / s0 = 2 x If the error location is x, then the error value is s0. Alternatively, based on the second syntactic equation (s0, s1, s2, s3), if s3 / s2=s2 / s1=s1 / s0=x, then the error location is determined to be x, and the error value is s0.
21. The method according to any one of claims 11-20, characterized in that, The error correction algorithm is based on the support of the extended coding matrix and supports the correction of data errors of two code elements; The extended coding matrix is obtained by transforming the standard coding matrix, and the standard coding matrix has the same column vectors under the code elements of the target data size; The extended coding matrix has no identical column vectors for code elements of the target data size, and the column vectors in the extended coding matrix are different from the unit column vectors in the identity matrix corresponding to the check code element.
22. The method according to claim 21, characterized in that, When the code element is 4 bits in size, the error correction algorithm is based on the support of the extended coding matrix and can correct errors in 2 code elements out of 16 data code elements (64 bits) and 4 check code elements (16 bits).
23. A memory controller, characterized in that, It includes an encoding module, a decoding module, and an error correction module; the encoding module is used to perform the data encoding method as described in any one of claims 1-6; the decoding module is used to perform the data decoding method as described in any one of claims 7-10; and the error correction module is used to perform the data error correction method as described in any one of claims 11-22.
24. A chip, characterized in that, Includes the memory controller as described in claim 23.
25. An electronic device, characterized in that, Includes the chip as described in claim 24.
Citation Information
Patent Citations
Decoding method and related device, electronic equipment and storage medium
CN113485866A
Error correction circuit and error correction encoding method
US20210376860A1