Decoding method and apparatus, encoding method and apparatus, and chip and computing device

By converting the parity-check matrix over a finite field into a sparse 0-1 matrix over a polynomial ring, the RS encoding and decoding process is simplified, the hardware implementation complexity and overhead are reduced, and the encoding and decoding efficiency is improved.

WO2026130089A1PCT designated stage Publication Date: 2026-06-25HUAWEI TECH CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2025-11-29
Publication Date
2026-06-25

Smart Images

  • Figure CN2025138822_25062026_PF_FP_ABST
    Figure CN2025138822_25062026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a decoding method and apparatus, an encoding method and apparatus, and a chip and a computing device. The decoding method comprises: a decoding apparatus acquiring a first matrix, and then decoding a first codeword vector on the basis of the first matrix to obtain a decoding result, wherein the first matrix is a 0-1 matrix in which elements in a second matrix are represented on a polynomial ring, the second matrix is a check matrix having r rows and n columns on a finite field 2q, a first polynomial corresponding to the polynomial ring is an irreducible polynomial of a degree q on a binary field, and the number of "1"s in the first matrix is less than the number of "1"s in a 0-1 matrix representation of the second matrix; and the first codeword vector comprises k information symbols and r check symbols, where n=k+r, each symbol comprises q data units, and each data unit comprises at least one bit. The solution of the present application can effectively reduce the hardware implementation complexity and overheads of RS encoding and decoding.
Need to check novelty before this filing date? Find Prior Art

Description

Decoding methods, encoding methods, devices, chips and computing equipment

[0001] This application claims priority to Chinese Patent Application No. 202411897142.2, filed on December 19, 2024, entitled "Decoding Method, Encoding Method, Apparatus, Chip and Computing Device", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of encoding and decoding technology, and in particular to a decoding method, encoding method, apparatus, chip, and computing device. Background Technology

[0003] In communication and storage systems, Reed-Solomon (RS) codes are commonly used error-correcting codes, and their encoding and decoding are performed over finite fields. With the development of microelectronics technology, hardware implementation of RS encoding and decoding has become a reality. However, the complex finite field multiplication within the RS encoding and decoding algorithm results in high hardware implementation complexity.

[0004] To reduce the hardware implementation complexity of RS encoding and decoding, one current approach is to represent finite field elements as 0-1 matrices, thereby converting the complex finite field multiplication in the RS encoding and decoding algorithm into bit-level XOR operations. For example, the codeword of the [9,7] RS code in Figure 1 consists of 7 information code elements (a1~a7) and 2 check code elements (p1~p2) generated by encoding, denoted as the transmitted codeword (a1,a2,a3,a4,a5,a6,a7,p1,p2). Each code element consists of 3 bits, p1=a1+a2+a3+a4+a5+a6+a7, p2=a1+2×a2+3×a3+4×a4+5×a5+6×a6+7×a7. The symbols + and × refer to the finite field GF(2 3 The encoding device sends the above-mentioned transmitted codewords to the decoding device, and the codewords actually received by the decoding device are recorded as the received codewords (a1). * a2 * a3 * a4 * a5 * a6 * a7 * p1 * p2 * To determine whether there is an error in the received codeword compared to the transmitted codeword, the decoding device needs to calculate the following two checksums, S1 and S2: S1 = a1 * +a2 * +a3 * +a4 * +a5* +a6 * +a7 * +p1 * S2=a1 * +2×a2 * +3×a3 * +4×a4 * +5×a5 * +6×a6 * +7×a7 * +p2 *

[0005] Each symbol in the received codeword consists of three bits, a1*=(a 1,1 a 1,2 a 1,3 The same logic applies to other code elements. If S1 = S2 = 0, then the received codeword is considered error-free; otherwise, the received codeword is considered error-free. To reduce encoding complexity, one current approach is to represent the finite field elements 1 to 7 involved in the above calculations as 0-1 matrices. This allows the calculations of S1 and S2 to be represented as multiplication of the 0-1 matrix in Figure 2 with the vector representation of the received codeword, ultimately reducing to bit-level XOR operations. However, because the 0-1 matrices corresponding to the finite field elements are relatively dense, the total number of XOR operations required in the above calculation process is high, resulting in high hardware implementation complexity and overhead for RS encoding / decoding. Summary of the Invention

[0006] This application provides a decoding method, encoding method, apparatus, chip, and computing device that can effectively reduce the hardware implementation complexity and overhead of RS encoding and decoding.

[0007] In a first aspect, this application provides a decoding method applied to a decoding device. The method includes: the decoding device acquiring a first matrix, and then decoding a first codeword vector based on the first matrix to obtain a decoding result. The first matrix is ​​a 0-1 matrix representing the elements of a second matrix on a polynomial ring, and the second matrix is ​​a finite field 22... q The first polynomial of the polynomial ring is an irreducible polynomial of degree q over the binary field. The number of 1s in the first matrix is ​​less than the number of 1s in the 0-1 matrix representation of the second matrix. The first codeword vector includes k information code elements and r check code elements, n = k + r. Each code element includes q data units, and each data unit includes at least one bit.

[0008] It should be noted that the second matrix mentioned above is a finite field 2. qThe first matrix has r rows and n columns. The second matrix corresponds to an RS codeword with length n, number of information bits k, and number of redundant bits r. In the RS decoding algorithm, the checksum is calculated by multiplying the second matrix and the first codeword vector. A checksum of all zeros indicates the first codeword vector is correct; otherwise, it indicates an error. A common approach is to represent each element of the second matrix as a 0-1 matrix to obtain its 0-1 representation, and then multiply this representation by the first codeword vector. However, the 0-1 representation of the second matrix is ​​relatively dense (i.e., contains many 1s), resulting in a still relatively high computational complexity.

[0009] The decoding method of this application represents the elements of the second matrix as elements of a polynomial ring and converts them into a 0-1 matrix to obtain the first matrix. Then, the product of the second matrix and the first codeword vector can be converted into the product of the first matrix and the first codeword vector (actually a pure XOR operation). Since the 0-1 matrix representation of the first matrix is ​​sparser than that of the second matrix (i.e., fewer 1s), the efficiency of RS decoding can be improved, and the hardware implementation complexity and overhead of RS decoding can be reduced.

[0010] Based on the first aspect, in a possible implementation, the aforementioned polynomial ring is a set of polynomials over a binary field whose degree is less than that of the first polynomial, and the degree of the first polynomial is such that the first polynomial divides the polynomial x. O The smallest positive integer value of O when +1.

[0011] Based on the first aspect, in a possible implementation, the first polynomial is the polynomial with the smallest order among all irreducible polynomials of degree q over the binary field. It should be understood that there can be multiple irreducible polynomials of degree q over the binary field; any irreducible polynomial of degree q can be used as the first polynomial, or the irreducible polynomial of degree q with the smallest order can be used. The smaller the order of the first polynomial, the smaller the highest degree of the polynomial in the corresponding polynomial ring, which helps to reduce the number of 1s in the first matrix, thereby simplifying the computation.

[0012] Based on the first aspect, in a possible implementation, the decoding result calculation for decoding the first codeword vector according to the first matrix includes: the decoding device calculating the product of the first matrix and the first codeword vector to obtain a first check vector; if all elements of the first check vector are 0, the decoding result indicates that the first codeword vector is correct.

[0013] Based on the first aspect, in a possible implementation, if the elements of the first check vector are not all 0, then the product of the inverse transformation matrix and the first check vector is calculated to obtain the second check vector, wherein the inverse transformation matrix is ​​a 0-1 matrix used to convert polynomials in the polynomial ring into elements in the finite field 2q; if the elements of the second check vector are all 0, then the decoding result indicates that the first codeword vector is correct; if the elements of the second check vector are not all 0, then the decoding result indicates that the first codeword vector has an error.

[0014] It should be understood that since the first matrix is ​​a 0-1 matrix representing the elements of the second matrix on a polynomial ring, the first check vector obtained by multiplying the first matrix and the first codeword vector is the result of an operation on the polynomial ring. The second check vector is obtained by multiplying the inverse transformation matrix and the first check vector. The second check vector is the result of an operation on the first check vector over a finite field. If all elements of the second check vector are 0, it indicates that the first codeword vector is correct.

[0015] From the mapping relationship between finite fields and polynomial rings, we know that finite field 2 q The element 0 in the first check vector can correspond to multiple elements (polynomials) in the polynomial ring. These polynomials include polynomials with all coefficients equal to 0, and such polynomials can only correspond to element 0 in the finite field (they will not correspond to other elements). If all elements of the first check vector (corresponding to polynomials in the polynomial ring) are 0, it means that all elements of the first check vector correspond to the polynomial in the polynomial ring with all coefficients equal to 0. Consequently, the elements of the second check vector (in the finite field) must also be 0. Therefore, if all elements of the first check vector are 0, it can be directly determined that all elements of the second check vector are also 0, thus directly confirming the correctness of the first codeword vector. This eliminates the need to perform the product operation between the inverse transformation matrix and the first check vector to obtain the second check vector, thereby reducing computational overhead.

[0016] Only when the elements of the first check vector are not all zeros is it necessary to actually calculate the product of the inverse transformation matrix and the first check vector to obtain the second check vector, and then determine whether the elements of the second check vector are all zeros, thereby determining whether the first codeword vector is correct.

[0017] Based on the first aspect, in a possible implementation, the sum of the number of 1s in the first matrix and the first value is less than the number of 1s in the 0-1 matrix representation of the second matrix, where the first value is the product of the number of 1s in the inverse transformation matrix minus the value obtained by q and r-1.

[0018] As mentioned earlier, when the elements of the first check vector are not all zeros, an inverse transformation matrix is ​​required for calculation. In this case, the product operation of the second matrix and the first codeword vector is divided into two steps: first, multiplying the first matrix and the first codeword vector to obtain the first check vector; second, multiplying the inverse transformation matrix and the first check vector to obtain the second check vector. The total number of XOR operations required for these two steps equals the number of 1s in the first matrix plus the aforementioned first value. To simplify the calculation, the first matrix can be designed according to the following condition: the total number of XOR operations < the number of 1s in the 0-1 matrix representation of the second matrix.

[0019] Based on the first aspect, in a possible implementation, the first element is any element in the second matrix, the first element corresponds to multiple polynomials in the polynomial ring, and the submatrix corresponding to the first element in the first matrix is ​​a 0-1 matrix representation of the polynomial with the fewest non-zero terms among the multiple polynomials. From the mapping relationship between finite fields and polynomial rings, it can be seen that finite field 2... q Each element in the first matrix can correspond to multiple elements (polynomials) in the polynomial ring. Different elements in the finite field do not have overlapping polynomials in the polynomial ring. Furthermore, the more non-zero terms in a polynomial, the more 1s there are in its 0-1 matrix representation (the denser the matrix). In the process of replacing elements in the second matrix with elements in the polynomial ring to obtain the first matrix, we can choose to replace each element with the polynomial that has the fewest non-zero terms among all the polynomials corresponding to that element. This minimizes the number of 1s in the generated first matrix, thus reducing the total number of XOR operations required for decoding using this first matrix, thereby simplifying the computation as much as possible.

[0020] Based on the first aspect, in possible implementations, multiple third matrices are finite fields 2. q The check matrix has r rows and n columns. These multiple third matrices correspond to multiple fourth matrices. Each third matrix corresponds to at least one fourth matrix. Each fourth matrix is ​​a 0-1 matrix that represents the elements of the corresponding third matrix on the polynomial ring. The first matrix is ​​the fourth matrix with the fewest 1s.

[0021] It should be understood that, given n, k, r, and q, the finite field 2 qThere can be multiple parity check matrices with r rows and n columns; these multiple parity check matrices are the aforementioned multiple third matrices. For each third matrix, its elements are represented as elements on a polynomial ring and converted into a 0-1 matrix. There may be multiple conversion results, each of which is a fourth matrix. Combining the conversion results of multiple third matrices, there can be a total of multiple fourth matrices. To simplify the calculation as much as possible, the fourth matrix with the fewest 1s can be taken as the first matrix, and the corresponding third matrix of this first matrix can be taken as the second matrix.

[0022] Based on the first aspect, in possible implementations, q is one of 1, 3, 5, 6, 7, 8, 9, and 11. Of course, in addition to the values ​​of q listed above, q can also be other values ​​greater than 1, and this application does not impose specific limitations on it.

[0023] Secondly, this application also provides an encoding method applied to an encoding device. The method includes: the encoding device acquiring a first matrix, and then encoding k information code elements according to the first matrix to obtain r check code elements. The first matrix is ​​a 0-1 matrix representing the elements of a second matrix on a polynomial ring, and the second matrix is ​​a finite field 2... q The parity check matrix has r rows and n columns. The first polynomial corresponding to the polynomial ring is an irreducible polynomial of degree q over the binary field. The number of 1s in the first matrix is ​​less than the number of 1s in the 0-1 matrix representation of the second matrix. Each symbol includes q data units, and each data unit includes at least one bit.

[0024] For details regarding the first and second matrices, please refer to the previous section. Choosing such a first matrix simplifies the decoding process on the decoding side; details can be found in the previous section and will not be repeated here.

[0025] Based on the second aspect, in a possible implementation, the aforementioned polynomial ring is a set of polynomials over a binary field whose degree is less than that of the first polynomial, and the degree of the first polynomial is such that the first polynomial divides the polynomial x. O The smallest positive integer value of O when +1.

[0026] Based on the second aspect, in a possible implementation, the first polynomial is the polynomial with the smallest order among all irreducible polynomials of degree q over the binary field.

[0027] Based on the second aspect, in a possible implementation, encoding k information symbols according to the first matrix to obtain r check symbols includes: the encoding device calculating the product of the first matrix and the k information symbols to obtain a second codeword vector; calculating the product of the inverse transformation matrix and the second codeword vector to obtain a third codeword vector, wherein the inverse transformation matrix is ​​used to convert polynomials in a polynomial ring into finite fields. qThe 0-1 matrix of the elements in the second matrix; calculate the product of the 0-1 matrix representation of the fifth matrix and the third codeword vector to obtain r check codes, where the fifth matrix is ​​the inverse matrix of the submatrix composed of the reciprocal r columns of elements selected from the second matrix.

[0028] Based on the second aspect, in a possible implementation, the sum of the number of 1s in the first matrix and the first value is less than the number of 1s in the 0-1 matrix representation of the second matrix, where the first value is the product of the number of 1s in the inverse transformation matrix minus the value obtained by q and r-1.

[0029] It should be understood that in the RS encoding process, the product of the second matrix and k information symbols (as a vector) needs to be calculated, and the product result is then multiplied by the fifth matrix to obtain r check symbols. The conventional approach is to represent each element of the second matrix as a 0-1 matrix to obtain a 0-1 matrix representation of the second matrix, and then perform the product operation between the 0-1 matrix representation of the second matrix and the k information symbols. However, the 0-1 matrix representation of the second matrix is ​​relatively dense (i.e., it contains a large number of 1s), resulting in a still relatively high complexity for the above operations.

[0030] The encoding method of this application represents the second matrix as elements in a polynomial ring and converts it into a 0-1 matrix to obtain the first matrix. Then, the product operation of the second matrix and k information symbols is converted into two steps: the first step is to calculate the product of the first matrix and the k information symbols to obtain the second codeword vector; the second step is to calculate the product of the inverse transformation matrix and the second codeword vector to obtain the third codeword vector. The total number of XOR operations required for these two steps equals the number of 1s in the first matrix plus the aforementioned first value. To simplify the calculation, the first matrix can be designed according to the following condition: the total number of XOR operations is less than the number of 1s in the 0-1 matrix representation of the second matrix.

[0031] Based on the second aspect, in a possible implementation, the first element is any element in the second matrix, the first element corresponds to multiple polynomials in the polynomial ring, and the submatrix corresponding to the first element in the first matrix is ​​a 0-1 matrix representation of the polynomial with the fewest non-zero terms among the multiple polynomials.

[0032] Based on the second aspect, in a possible implementation, the multiple third matrices are parity check matrices with r rows and n columns over a finite field 2q. These multiple third matrices correspond to multiple fourth matrices, each third matrix corresponds to at least one fourth matrix, and each fourth matrix is ​​a 0-1 matrix representing the elements of the corresponding third matrix on a polynomial ring. The first matrix is ​​the one with the fewest 1s among these multiple fourth matrices.

[0033] Based on the second aspect, in possible implementations, q is one of 1, 3, 5, 6, 7, 8, 9, and 11. Of course, in addition to the q values ​​listed above, q can also be other values ​​greater than 1, as specifically limited in this application.

[0034] Thirdly, this application also provides a decoding apparatus, including a module for performing the method of any possible embodiment of the first aspect.

[0035] Fourthly, this application also provides an encoding apparatus including a module for performing the method of any possible embodiment of the second aspect.

[0036] Fifthly, this application also provides a chip including a processor and an interface for data interaction with an external device or module of the chip, wherein the processor is used to execute the method of any possible implementation of the first or second aspect.

[0037] Sixthly, this application also provides a computing device including a processor and a memory. The processor is configured to execute instructions stored in the memory to cause the computing device to perform a method as described in any possible embodiment of the first or second aspect.

[0038] In a seventh aspect, this application also provides a computing device cluster, including a plurality of computing devices, each computing device including a processor and a memory. The processors of the plurality of computing devices are used to execute instructions stored in the memory of the plurality of computing devices, so that the computing device cluster performs the method of any possible embodiment of the first or second aspect.

[0039] Eighthly, this application also provides a computer-readable storage medium including instructions that, when executed on a computing device, cause the computing device to perform a method as described in any possible embodiment of the first or second aspect.

[0040] Ninthly, this application also provides a computer program product comprising instructions. When the aforementioned instructions are executed by a computing device, the computing device performs a method as described in any possible embodiment of the first or second aspect. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments are briefly introduced below.

[0042] Figure 1 is a schematic diagram of the codeword structure of a [9,7] RS code provided in an embodiment of this application;

[0043] Figure 2 is a schematic diagram of multiplication of a 0-1 matrix and a vector representation of a received codeword provided in an embodiment of this application;

[0044] Figure 3 is a flowchart illustrating an encoding method provided in an embodiment of this application;

[0045] Figure 4 is a flowchart illustrating a decoding method provided in an embodiment of this application;

[0046] Figure 5 is a schematic diagram of the first 12 columns of a verification matrix H provided in an embodiment of this application;

[0047] Figure 6 is a schematic diagram of converting the 12 elements in the upper left corner of matrix H into a corresponding 0-1 matrix according to an embodiment of this application;

[0048] Figure 7 is a diagram showing the relationship between some elements in a finite field and their corresponding optimal transformations, according to an embodiment of this application.

[0049] Figure 8 is a schematic diagram of converting the 12 elements in the upper left corner of matrix H′ into a corresponding 0-1 matrix according to an embodiment of this application;

[0050] Figure 9 is a schematic diagram of an inverse transformation matrix provided in an embodiment of this application;

[0051] Figure 10 is a schematic diagram of the first 12 columns of another verification matrix H provided in an embodiment of this application;

[0052] Figure 11 is a schematic diagram of another method for converting the 12 elements in the upper left corner of matrix H′ into a corresponding 0-1 matrix, provided by an embodiment of this application.

[0053] Figure 12 is a schematic diagram of another method for converting the 12 elements in the upper left corner of matrix H into a corresponding 0-1 matrix, provided by an embodiment of this application.

[0054] Figure 13 is a schematic diagram of the first 12 columns of another verification matrix H provided in an embodiment of this application;

[0055] Figure 14 is a schematic diagram of another method for converting the 12 elements in the upper left corner of matrix H′ into a corresponding 0-1 matrix, provided by an embodiment of this application.

[0056] Figure 15 is a schematic diagram of an encoding device provided in an embodiment of this application;

[0057] Figure 16 is a schematic diagram of a decoding device provided in an embodiment of this application;

[0058] Figure 17 is a schematic diagram of the structure of a computing device provided in an embodiment of this application. Detailed Implementation

[0059] To facilitate understanding of the technical solution of this application, some of the terms and concepts involved in this application are briefly introduced below.

[0060] 1. Finite fields and Galois fields (GF):

[0061] If a field contains a finite number of elements, the number of which is a power of a prime number, and corresponding addition and multiplication rules are defined among these elements such that the result of addition and multiplication cannot exceed the range of these finite elements, then the field formed by these finite elements is called a finite field. If the number of elements in a finite field is 2... q This finite field can then be called the Galois field, denoted as GF(2). q ), GF(2 q The elements in the range are 0 to 2. q -1.

[0062] For example, when q = 1, GF(2 q GF(2) has only two elements, "0" and "1", and is also called a binary field. The following addition (called finite field addition) and multiplication (called finite field multiplication) are defined between the elements of GF(2):

[0063] Addition: 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 0 (modulo 2 addition)

[0064] Multiplication: 0 × 0 = 0, 0 × 1 = 0, 1 × 0 = 0, 1 × 1 = 1 (modulo 2 multiplication)

[0065] GF(2 q The element i in ) can be represented by a q-bit binary number, i.e., [i q-1 i q-2 , ..., i0], where, i j ∈GF(2). Element i can also be represented as a polynomial i(x) with coefficients taken from GF(2) and degree less than q, i(x) = i0 + i1 × x + ... + i q-1 ×x q-1 The coefficients in i(x) correspond one-to-one with the digits in the binary representation above.

[0066] 2. Polynomial ring:

[0067] A polynomial ring is a ring of polynomials, where each element is a polynomial, and addition and multiplication are defined between these polynomial elements. In a polynomial ring, addition and multiplication operations follow the properties of the ring and satisfy the associative, commutative, and distributive laws.

[0068] If f(x) is an irreducible polynomial of degree n over GF(2), that is, f(x) cannot be decomposed into a product of multiple non-zero polynomials of lower degree, then the polynomial ring F2[x] / f(x) is a set of polynomials of degree less than n over GF(2). That is, the polynomials in the polynomial ring F2[x] / f(x) are all polynomials whose coefficients are taken from a binary field (i.e., the coefficients of each term can only be 0 or 1) and whose degree is less than n.

[0069] 3. Reed-Solomon (RS) codes and their parity-check matrix H:

[0070] RS code is a commonly used error-correcting code. The encoding device performs RS encoding in a finite field based on the following relation to obtain the RS codeword: H×[m,p] T =H×[m1,m2,…,mk,p1,…,p r ] T =0

[0071] In the above, n is the code length of the RS codeword, k is the number of information code elements in the RS codeword, and nk = r, where r is the number of check code elements in the RS codeword. Information code element m u It is a part of the original data block m (i.e., the data to be encoded), m u =[m u,1 ,m u,2 ,…,m u,q It contains q data units, 1 ≤ u ≤ k, and each data unit includes at least one bit. The check symbol (or redundant symbol) p v It is a part of the redundant data block p generated by the encoding device performing RS encoding on the original data block m, p v =[p v,1 ,p v,2 ,…,p v,q The RS codeword contains q parity check units, 1 ≤ v ≤ r, and each parity check unit includes at least one bit. H is the parity check matrix of the RS codeword, representing the algebraic relationship between the information code elements and the parity code elements in the RS codeword. Therefore, H determines the code type of the RS codeword, and H is required to satisfy the following form:

[0072] Among them, h i,j h is the element in the i-th row and j-th column of matrix H, where 1 ≤ i ≤ r, 1 ≤ j ≤ n. i,j =α j i-1 The elements in the second row of H are α1 to α2 respectively. n H satisfies the form of a Vandermonde matrix, and α j ∈GF(2 q ), α1≠α2≠...≠α n .

[0073] The encoding device sends the encoded RS codeword [m1,m2,…,mk,p1,…,p] to the decoding device. r [m′1, m′2, ..., m′k, p′1, ..., p′] is denoted as the transmitted codeword vector. This application does not specifically limit the type or connection relationship between the encoding and decoding devices. For example, the encoding device can be a communication device, and the decoding device can be another communication device, connected via a wired transmission medium such as a cable or optical fiber; or, the encoding device can be an encoding chip in a computing device, and the decoding device can be a decoding chip in a storage device, connected via a wired or wireless connection. The RS codeword actually received by the decoding device is [m′1, m′2, ..., m′k, p′1, ..., p′k]. r ] T Let H be the received codeword vector. The received codeword vector and the transmitted codeword vector have the same codeword length and correspond one-to-one with each other. To determine whether there is an error in the received codeword vector compared to the transmitted codeword vector, the decoding device needs to calculate the product of the parity check matrix H and the received codeword vector (i.e., parity calculation) to obtain r parities, denoted as S1, S2, ..., Sr. If all parities are 0, it indicates that the received codeword vector is correct; if not all parities are 0, it indicates that there is an error in the received codeword vector.

[0074] To reduce the encoding and decoding complexity of RS codes, this application provides an encoding method and a decoding method (collectively referred to as the encoding and decoding method): by representing the parity-check matrix H over the finite field of the RS code as a sparse 0-1 matrix over a polynomial ring, the product operation of H and a vector required in the RS encoding and decoding process (such as the product of H and the received codeword vector mentioned above) can be transformed into a product operation of a sparse 0-1 matrix and a vector, and further transformed into a pure XOR operation with fewer XOR operations, thereby improving encoding and decoding efficiency and reducing encoding and decoding overhead. Here, a 0-1 matrix, also known as a Boolean matrix, refers to a matrix whose elements are only 0 or 1.

[0075] Before introducing the encoding and decoding method of this application, the design process of the RS code used in the encoding and decoding method is introduced below, including steps 1 to 2.

[0076] Step 1: Determine the q-th degree irreducible polynomial p(x) on GF(2).

[0077] The scheme in this application involves a mapping transformation between elements in a finite field and elements in a polynomial ring (which are polynomials). However, not every finite field and polynomial ring can be transformed; the following relationship must be satisfied: For the finite field GF(2 q ) and the polynomial ring F2[x] / (x O +1), the finite field GF(2) is only valid when p(x) is an irreducible polynomial of degree q over GF(2).q ) and the polynomial ring F2[x] / (x O A mapping relationship exists only between +1). Here, p(x) is the polynomial corresponding to the aforementioned polynomial ring, O is the order of p(x), and the order of p(x) is defined as p(x) dividing the polynomial x. O The smallest positive integer value of O when +1, where p(x) divides x. O +1 means that there exists a non-zero polynomial that, when multiplied by p(x), yields x. O +1. Polynomial ring F2[x] / (x O +1) is the set of polynomials of degree less than 0 over GF(2), and the polynomial ring F2[x] / (x) O The highest degree of the polynomial in the polynomial ring is O-1, and the coefficients of the polynomials in the ring can only be taken from GF(2).

[0078] For the finite field GF(2) q The element a in ) has its binary representation as [a q -1, a q -2, ..., a0], a0~a q -1∈{0,1}, let a(x) be the polynomial representation of a on GF(2), and let a = a0 + a1×x + ... + a q-1 ×x q-1 When the above transformation relationship exists, a in the polynomial ring F2[x] / (x) o The polynomial corresponding to +1) The following transformation relationship is satisfied:

[0079] Where, l0, l1, ..., l o-1-q ∈{0,1}, mod represents the modulo operation. It can be seen that a finite field element 'a' can correspond to multiple elements in a polynomial ring, and the number of elements in the polynomial ring corresponding to 'a' is 22. O-q The larger the order O of p(x), the more elements are in the polynomial ring corresponding to the same finite field element a.

[0080] The above q is a positive integer, and this application does not specifically limit the value of q. For example, q can be any one of 1, 3, 5, 6, 7, 8, 9, and 11. When q = 8, GF(2 q )=GF(2 8 ) = GF(256), where GF(256) is a commonly used finite field with 256 elements ranging from 0 to 255. The numerical values ​​of q listed above are merely examples and do not constitute a limitation. In practical applications, q can also be other positive integers.

[0081] As can be seen from the transformation relationship introduced above, given q, there may be one or more irreducible polynomials of degree q on GF(2), and p(x) can be any one of these polynomials. When p(x) takes different polynomials, the corresponding polynomial ring F2[x] / (x) O +1) may be different.

[0082] Optionally, p(x) can be the smallest polynomial of degree q among all irreducible polynomials of degree q over GF(2), where the degree of each irreducible polynomial of degree q is defined as the polynomial of degree q that divides x. O The smallest positive integer value of O when +1. When p(x) takes the smallest polynomial, the corresponding polynomial ring F2[x] / (x O The polynomial in +1) has the lowest highest degree, and the number of polynomials corresponding to each element of the finite field in the polynomial ring is also the smallest.

[0083] The following explains the finite field element a in the polynomial ring F2[x] / (x). O The 0-1 matrix representation of the polynomial corresponding to +1).

[0084] For a finite field element a, Is the element a in the finite field F2[x] / (x) the polynomial ring? o The multiple polynomials corresponding to +1) one of the, in, Given q, A 0-1 matrix is ​​represented as a matrix with O rows and q columns, where each column has O elements. The elements in the first column of this matrix are, from top to bottom, ... That is, the elements in the first column are polynomials from top to bottom. The coefficients in the table are sorted from least significant digit to most significant digit. In the 0-1 matrix representation, the elements of the second column are the result of shifting the elements of the first column one row downwards in a cyclic manner. That is, the elements of the second column, from top to bottom, are... Similarly, the elements in the third column are the result of shifting the elements in the second column down one row, and so on (the elements in each subsequent column are the result of shifting the elements in the previous column down one row), thus determining... The 0-1 matrix represents all columns. Summarizing the above patterns, the polynomial... The number of 1s in the 0-1 matrix representation equals the number of polynomials. The number of non-zero terms in the formula is multiplied by q.

[0085] Step 2: Determine the polynomial ring F2[x] / (xo The parity-check matrix H′ is on +1).

[0086] H′ has the same number of rows and columns as the parity-check matrix H over the finite field, and H′ is defined to satisfy the following form:

[0087] in, α j ∈GF(2 q ), α1≠α2≠...≠α n It can be seen that any element in matrix H′ is the element in matrix H that has the same position as that element in the polynomial ring F2[x] / (x). o The elements corresponding to +1) are such that two elements in different matrices are in the same position, meaning that the two elements are in the same row and column position, and the row number and column number of the two elements are the same.

[0088] Based on the relationship between H and H′, the product operation of H and vector V can be transformed into the following form:

[0089] Equation 1: H × V T =H*×(H′) _01 ×V T )

[0090] H×V on the left side of the above equation T The operation method before the conversion involves complex multiplication operations over a finite field, which is difficult to implement in hardware. The vector V = [V1, V2, ..., V...] is as follows. n V contains n elements, numbered V1 to V2 respectively. n Each element in V can be composed of q bits. T It is the transpose of V. H*×(H′) on the right-hand side of the above equation _01 ×V T The transformed calculation method consists of two steps. The first step is to calculate H′. _01 With V T The second step is to calculate the product of H* and the result of the first step.

[0091] Among them, H' _01 It is the 0-1 matrix representation of the parity-check matrix H′ on the polynomial ring, i.e., H′ _01 It is the matrix obtained by replacing each element of H′ (which is a polynomial in the polynomial ring mentioned above) with the corresponding 0-1 matrix representation. In other words, H′ _01 It is a 0-1 matrix representing the elements of the parity-check matrix H over a finite field on a polynomial ring. For an explanation of the 0-1 matrix representation of polynomials, please refer to the previous section; it will not be repeated here.

[0092] H* is a 0-1 matrix with q rows and 0 columns, used to represent the polynomial ring F2[x] / (x O The polynomial in +1) is transformed into the finite field GF(2). q The elements corresponding to the first q columns in H* are shown. The submatrix formed by the first q columns in H* is a q×q identity matrix. It should be understood that an identity matrix is ​​a matrix where all elements on the diagonal from the top left corner to the bottom right corner (called the main diagonal) are 1, and all other elements are 0. A submatrix, also called a extracted matrix, is a new matrix formed by selecting certain rows and columns from a matrix (maintaining the relative order of rows and columns). Except for the first q columns, the (q+1)th to the 0th columns in the matrix H* correspond to x, respectively. q x q+1 ... x O-1 That is, the u-th column in H* corresponds to x u-1 q+1≤u≤O, the elements in the u-th column are x from top to bottom. u-1 The coefficients of the remainder polynomial obtained by dividing by p(x) are sorted from the least significant digit to the most significant digit.

[0093] It should be noted that, because H′ _01 Since both H and H* are 0-1 matrices, the above two steps are essentially pure XOR operations. Furthermore, since H′ is a polynomial ring F2[x] / (x... O The parity-check matrix H′ on +1) _01 It is a 0-1 matrix representation of H′, therefore H′ _01 ×V T The result of the operation is the result of the operation on the polynomial ring, matrix H′. _01 Multiply by vector V T The result of the operation is a vector, then multiply H* by H′. _01 ×V T The result of the operation can be converted from a polynomial ring back to a finite field.

[0094] Optionally, the vector V can be any vector that needs to be multiplied with the parity check matrix H during the RS encoding and decoding process; this application does not impose any specific limitations.

[0095] For example, V can be the received codeword vector of the decoding device. The decoding process of the decoding device needs to calculate the product of H and the received codeword vector (i.e., checksum calculation) to determine whether there is an error in the received codeword vector relative to the transmitted codeword vector of the encoding device. Therefore, the received codeword vector can be used as the vector V in the above formula, and then the checksum matrix H and V over the finite field can be used as the vector V. T The multiplication operation is converted into a 0-1 matrix representation of the parity check matrix H′ on the polynomial ring and V. T Perform the multiplication operation, then multiply H* by H′. _01×V T The result of the operation can be used to obtain the checksum.

[0096] If all the calculated checksums are 0, it indicates that the received codeword vector is error-free and no error correction is needed. If not all the checksums are 0, it indicates that the received codeword vector contains errors and error correction is required. The error correction process includes steps such as Chien search and Forney value calculation. Chien search is used to calculate the error location, and Forney value calculation is used to calculate the error value. Based on the calculated error location and error value, the received codeword vector can be corrected, which will not be discussed in detail here. Since Chien search and Forney value calculation also involve the multiplication of the checksum matrix H with a vector, this vector can be used as V in the above formula, thus converting it into H′. _01 and V T The multiplication operation is then performed, followed by multiplying H* by H′. _01 ×V T The result of the operation can be used to obtain the calculation result of the finite field.

[0097] As introduced above, given the parameters n, k, and q (these parameters can be set by the user or are default values; this application does not impose specific limitations), α1~α n They are all distinct and belong to the finite field GF(2). q ), α1~α n There can be one or more sets of values ​​(depending on 2). q The order of values ​​within the same group is not considered (values ​​are considered to be in the same group if they are all the same), and there is at least one different value between different groups. This is because the elements h in the parity-check matrix H over the finite field... i,j =α j i-1 Therefore, in α1~α n Each set of values ​​has a corresponding parity check matrix H, and the parity check matrix H is different for different sets of values. Polynomial ring F2[x] / (x o The elements of the parity matrix H′ on +1) And the same finite field element α j It can correspond to multiple polynomials in the polynomial ring, therefore, in α1~α n For each set of values, the parity check matrix H′ has multiple possible forms, which can be selected according to the needs of use.

[0098] To simplify the calculation, a suitable H′ can be selected according to the following principle: H×V on the left side of the above equation. T The total number of XOR operations, Number_1, is greater than H*×(H′) on the right side of the equation. _01 ×V TThe total number of XOR operations in the operation is Number_2, at which point H×V is used. T Convert to H*×(H′) _01 ×V T Performing calculations can improve the efficiency of RS encoding and decoding, and reduce the hardware implementation complexity and overhead of RS encoding and decoding. Once H′ is selected, α1~α n The value of H′ is then determined, and the corresponding values ​​of H and H′ are determined. _01 H* was also determined, thus completing the design of the RS code.

[0099] The following explains how Number_1 and Number_2 are calculated.

[0100] Number_1 = the number of 1s in the 0-1 matrix representation of H - the number of rows r of H. Here, all elements in the parity check matrix H belong to the finite field GF(2). q When q = 1, the 0-1 matrix representation of the parity check matrix H is H itself; when q ≠ 1, the 0-1 matrix representation of the parity check matrix H is obtained by replacing each element of the parity check matrix H with its own 0-1 matrix representation. The 0-1 matrix representation of each element in H is a q × q matrix. The 0-1 matrix of the parity check matrix H is a matrix with q × r rows and q × n columns.

[0101] Number_2=H′ _01 ×V T Total XOR operations + H * H′ _01 ×V T The total number of XOR operations in the result of the operation. H′ _01 ×V T The total number of XOR operations in the middle is H′ _01 The number of 1s in -H′ _01 The number of rows (r×O) of matrix H′ _01 ×V T The result of the operation is a vector with r elements (corresponding one-to-one with r checksums). Each element of the vector consists of O bits. H* multiplied by H′ _01 ×V T The total number of XOR operations in the result is equal to (the number of 1s in H* - the number of rows in H*) × (r-1).

[0102] Among them, H′ _01 H′ is the matrix obtained by replacing each element (a polynomial in the polynomial ring) with its own 0-1 matrix representation. The 0-1 matrix representation of each element in the first row of H′ is a q×q matrix, and the 0-1 matrix representation of each element in the remaining rows of H′ is an O×q matrix. Therefore, H′ _01It is a 0-1 matrix with 1×q+(r-1)×O rows and n×q columns.

[0103] It should be understood that, given parameters n, k, and q (which can be user-set or have default values), H′ satisfying the requirement Number_1 > Number_2 may have one or more forms. One of these forms can be selected as the final H′; any one or a specific one can be chosen. After selecting H′, the corresponding H and H′... _01 H* is thus determined, and H×V can then be calculated. T Convert to H*×(H′) _01 ×V T To simplify calculations, we can perform the calculations.

[0104] Optionally, the selected H′ satisfies the following conditions: the first element is any element in H′, and the elements in H that occupy the same position as the first element correspond to the polynomial ring F2[x] / (x o In the polynomials of +1), the first element is the polynomial with the fewest non-zero terms. In other words, given H (where α1~α...),... n (The value is determined), for any finite field element in H, replace the finite field element with the element itself in the polynomial ring F2[x] / (x O The optimal transformation in +1) yields H′ after all elements in H have been replaced in the above manner. Wherein, GF(2) q Each element of the finite field in ) can correspond to the polynomial ring F2[x] / (x o In the polynomials of +1), the optimal transformation of a finite field element is the polynomial with the smallest image weight among the multiple polynomials corresponding to the element in the polynomial ring. The image weight of a polynomial is defined as the number of non-zero terms in the polynomial (or the number of terms with non-zero coefficients / the number of terms with a coefficient of 1).

[0105] It should be understood that each of the above finite field elements is chosen based on its position within the polynomial ring F2[x] / (x). o The optimal transformation in +1) has the fewest non-zero terms in its polynomial, and the number of 1s in the 0-1 matrix representation of a polynomial in a polynomial ring equals the number of non-zero terms in that polynomial multiplied by q. Therefore, the resulting H′ _01 The number of 1s in H′ is also minimized, making H′ the smallest possible. _01 ×V T The required total number of XOR operations is also minimized, thus simplifying the computation and reducing the complexity of encoding and decoding.

[0106] Optionally, given parameters n, k, and q (these parameters can be set by the user or are default values) but not H, since α1~α n The elements h in H are distinct and belong to the finite field GF(2q), and the elements h in H are... i,j =α J I-1 Therefore, α1~α n There can be one or more sets of values, ranging from α1 to α2. n Each set of values ​​has a corresponding parity check matrix H, and the parity check matrix H is different for different sets of values. Polynomial ring F2[x] / (x o The elements of the parity matrix H′ on +1) And the same finite field element α j It can correspond to multiple polynomials in the polynomial ring, therefore, in α1~α n For each set of values, the parity-check matrix H′ has multiple possible forms. Here, we assume that H′ has y possible forms, denoted as H′1, H′2, ..., H′. y .

[0107] As introduced above, matrix H′ satisfies the following structure:

[0108] h′ i,j (x) is the element in the i-th row and j-th column of the above structure. All y possible forms of H′ satisfy the above structure, the difference between the y possible forms lies in the fact that the values ​​of the elements at each position are not exactly the same. To simplify the calculation as much as possible, one of the y possible forms can be selected as the final H′ according to the following formula: min{weight(H1), weight(H2), ..., weight(H Y )}

[0109] Here, weight() represents the number of 1s in the 0-1 matrix representation of the object within the parentheses, and the number of 1s in each possible form of the 0-1 matrix representation. wt(h′ ij (x) represents the polynomial h′ ij The number of non-zero terms in (x) (i.e., the image weight described above). The above formula represents selecting the 0-1 matrix representation with the fewest 1s from the possible forms of y as H′, in order to simplify the calculation as much as possible. Since q is selected, it is actually selecting the one that makes the matrix representation with the fewest 1s. The smallest possible form is the final H′.

[0110] It should be noted that during the checksum calculation process, the product of the checksum matrix H and the received codeword vector needs to be calculated. As described above, this can be transformed into a two-step calculation. The first step is to calculate H′. _01 The product of the received codeword vector and the result on the polynomial ring is obtained. The second step involves multiplying the result on the polynomial ring with the inverse transformation matrix H* to obtain the corresponding checksum (on the finite field). If all checksums are 0, it indicates that the received codeword vector is correct. As mentioned earlier, the finite field GF(2 q The element 0 in ) corresponds to the polynomial ring F2[x] / (x O The polynomials in +1 include a polynomial with all coefficients equal to 0. This polynomial with all coefficients equal to 0 uniquely corresponds to the element 0 in the finite field and will not correspond to any other element in the finite field. Therefore, if the result of the polynomial ring obtained in the first step is all 0 (corresponding to the polynomial with all coefficients equal to 0), then the checksum must also be all 0. Based on the above characteristics, when the result of the polynomial ring obtained in the first step is all 0, it can be determined that the checksum is all 0, that is, the received codeword vector is correct, and there is no need to actually perform the calculation in the second step (simplifying the calculation process). Only when the result of the polynomial ring obtained in the first step is not all 0 is it necessary to perform the calculation in the second step. If the result of the calculation in the second step is all 0, it means that the received codeword vector is correct; if the result of the calculation in the second step is not all 0, it means that the received codeword vector has an error.

[0111] In practical applications, the probability of receiving a correct codeword vector is higher than the probability of receiving an incorrect codeword vector. Therefore, as long as the XOR operation required for the product of the 0-1 matrix representation of H and the received codeword vector is Number_1 > H′, the probability of receiving a correct codeword vector is not higher. _01 The XOR operation number Number_3 required for the product with the received codeword vector can simplify the computation to some extent, reduce the complexity of the decoding implementation, and improve the decoding efficiency. Therefore, when designing H′, in addition to following the principle of Number_2 < Number_1 introduced earlier, it can also be designed according to the principle of Number_3 < Number_1. It should be understood that both principles can simplify the decoding process to some extent, but the former principle simplifies it to a greater extent than the latter because the former principle has stricter conditions, taking into account the XOR operation number required for the product with the inverse transformation matrix in the second step.

[0112] For details on the calculation of Number_1, please refer to the previous introduction; it will not be repeated here.

[0113] Number_3=H′ _01 ×V T The total number of XOR operations in H′. _01 ×V T The total number of XOR operations in the middle is H′_01 The number of 1s in -H′ _01 number of rows.

[0114] Based on the design process of RS code described above, the following describes an embodiment of the encoding and decoding method provided in this application.

[0115] Please refer to Figure 3, which is a flowchart illustrating an encoding method provided in an embodiment of this application. This method is applied to an encoding device, which may be a chip, a computing device (such as a server), a communication device, or a storage device, etc., and this application does not specifically limit its application. The method includes the following steps S301 to S302.

[0116] S301. Obtain the first matrix, where the first matrix is ​​a 0-1 matrix representing the elements of the second matrix on a polynomial ring, and the second matrix is ​​a finite field 2. q The parity check matrix has r rows and n columns. The first polynomial corresponding to the polynomial ring is an irreducible polynomial of degree q over the binary field. The number of 1s in the first matrix is ​​less than the number of 1s in the 0-1 matrix representation of the second matrix.

[0117] It should be noted that the polynomial ring mentioned above is the same as the polynomial ring F2[x] / (x) described earlier. O +1), the first matrix is ​​H′ described above. _01 The second matrix is ​​the finite field GF(2) described above. q The parity-check matrix H is given by the first polynomial p(x) of degree q irreducible over GF(2) as described above, and the inverse transformation matrix is ​​H* as described above. For details, please refer to the design process of RS codes introduced above, which will not be repeated here.

[0118] The first matrix described above can be stored in the memory of the encoding device or in the encoding chip, and this application does not specifically limit it.

[0119] The polynomial ring described above is the set of polynomials over a binary field whose degree is less than that of the first polynomial, and whose degree is divisible by x by the first polynomial. O The smallest positive integer value of O when +1 is reached. For details, please refer to the design process of the RS code introduced earlier, which will not be repeated here.

[0120] The above q is a positive integer, and this application does not specifically limit it. For example, q can be any one of 1, 3, 5, 6, 7, 8, 9, and 11. When q = 8, GF(2 q )=GF(2 8 ) = GF(256), where GF(256) is a commonly used finite field with 256 elements, denoted as 0 to 255. The q values ​​listed above are merely examples and do not constitute a limitation. In practical applications, q can also be other positive integers.

[0121] Optionally, the first polynomial is the polynomial with the smallest order among all irreducible polynomials of degree q over GF(2). In other words, there may be one or more irreducible polynomials of degree q over GF(2), and the polynomial with the smallest order can be selected from these one or more as p(x) to determine the corresponding polynomial ring. For details, please refer to the previous introduction, which will not be repeated here.

[0122] Optionally, the first element can be any element in the second matrix, corresponding to multiple polynomials in the polynomial ring. The submatrix corresponding to the first element in the first matrix is ​​a 0-1 matrix representation of the polynomial with the fewest non-zero terms among these multiple polynomials. In other words, for each element in the second matrix (which is a finite field element), its corresponding polynomial ring F2[x] / (x O The multiple polynomials in the second matrix (+1) can be represented by the polynomial with the fewest non-zero terms as the optimal transformation of the finite field element. Replacing each finite field element in the second matrix with the corresponding optimal transformation yields H′. Since each finite field element in the second matrix is ​​replaced with the corresponding optimal transformation, and the optimal transformation has the fewest non-zero terms, the 0-1 matrix representation of the optimal transformation also has the fewest 1s. Therefore, the 0-1 matrix representation of H′ (i.e., the first matrix H′) is... _01 The number of 1s in H′ is also relatively small, making H′ _01 The number of XOR operations required for the product of k information symbols is also less, thus simplifying the calculation.

[0123] Optionally, multiple third matrices are finite fields 2. q The parity check matrix has r rows and n columns. Multiple third matrices correspond to multiple fourth matrices. Each third matrix corresponds to at least one fourth matrix. Each fourth matrix is ​​a 0-1 matrix that represents the elements of the corresponding third matrix on a polynomial ring. The first matrix is ​​the matrix with the fewest 1s among the multiple fourth matrices.

[0124] As introduced earlier, given n, k, and q, α1~α n There can be one or more sets of values, such that H has one or more possible forms. Each possible form of H corresponds to multiple possible forms of H′. Therefore, H′ has a total of y possible forms, and the corresponding H′... _01 There are also y possible forms (H′ and H′) _01 (One-to-one correspondence), where y is a positive integer greater than 1. The aforementioned multiple fourth matrices are H′. _01 y possible forms, H′ _01The y possible forms each correspond to one possible form of H, and each of the third matrices mentioned above is a possible form of H. To simplify the calculation as much as possible, the form with the fewest 1s among the y possible forms is selected as the final H′. _01 H′ _01 The corresponding third matrix is ​​taken as the final H, at which point H′ _01 The number of 1s in H′ is minimized, so that H′ _01 It also requires the fewest XOR operations for multiplying with a vector.

[0125] Optionally, the sum of the number of 1s in the first matrix and the first value is less than the number of 1s in the 0-1 matrix representation of the second matrix. The first value is the product of the number of 1s in the inverse transformation matrix minus the value obtained by subtracting q and r-1. The inverse transformation matrix is ​​the matrix H* described above, which will not be elaborated here.

[0126] S302. Encode k information code elements according to the first matrix to obtain r check code elements, wherein each code element includes q data units, and each data unit includes at least one bit.

[0127] Optionally, the original data block (data to be encoded) can be divided according to the size of the information symbols, with each data block being considered as an information symbol, resulting in k information symbols. These k information symbols are used to represent certain information, and this application does not impose specific limitations on their use. When a data unit includes only one bit, an information symbol consists of q bits; when a data unit includes z bits, an information symbol consists of q × z bits, where z is a positive integer greater than 1. For example, in the field of communication, one bit is typically used as a data unit, in which case an information symbol consists of q bits. Similarly, in the field of storage, 4096 bits (the smallest processing unit of disk storage) are typically used as a data unit, in which case an information symbol consists of q × 4096 bits.

[0128] It should be noted that when H, H′, and H′ are selected according to the RS code design process described above... _01 After this, the RS code pattern is determined, and the codeword vector of the RS code should satisfy the following relationship: H×[m,p] T =H×[m1,m2,…,mk,p1,…,p r ] T =0

[0129] The above vector m = [m1, m2, ..., m k ], m1~m k For k information symbols, the vector p = [p1, ..., p2] r ], p1~p rThe RS encoding process generates r check bits (or redundant bits / parity bits) from k information bits. In other words, RS encoding is actually used to calculate r check bits. These r check bits are then concatenated with the k information bits to obtain the RS codeword [m, p]. Let H = [H1H2], where H1 is an r×k submatrix formed by selecting the first k columns of H, and H2 is an r×r submatrix formed by selecting the remaining r columns of H. That is, H2 is an r×r submatrix formed by selecting the reciprocal r columns of H. Therefore, the above relationship can be rewritten as follows:

[0130] Here, o is a vector of length r with all elements equal to 0. [m, o] is essentially a vector obtained by appending r × q zeros to vector m. As mentioned earlier, H × V T It can be converted to H*×(H′) _01 ×V T To simplify calculations, [m,o] in the above formula can be removed. T Consider it as V, therefore yes The 0-1 matrix representation is used, and the encoding device performs encoding calculations based on the above formula in step S302.

[0131] Optionally, the second codeword vector is obtained by first multiplying the first matrix with the k information symbols, and then the third codeword vector is obtained by multiplying the inverse transformation matrix with the second codeword vector. The inverse transformation matrix is ​​used to transform the polynomial in the polynomial ring into a finite field. q The fifth matrix is ​​a 0-1 matrix of elements in the second matrix; then, the product of the 0-1 matrix representation of the fifth matrix and the third codeword vector is calculated to obtain r check codes. The fifth matrix is ​​the inverse matrix of the submatrix composed of the inverse r columns of elements selected from the second matrix.

[0132] Specifically, the second codeword vector is obtained by multiplying the first matrix by the k information symbols, which is equivalent to calculating H′ as described above. _01 ×[m,o] T The calculated result is the second codeword vector. Since the first matrix is ​​a polynomial ring F2[x] / (x... o The parity-check matrix H′ on the polynomial ring (+1) is represented by a 0-1 matrix. Therefore, the second codeword vector is the result of operations on the polynomial ring and needs to be transformed back to the result of operations on the finite field. Thus, we continue to calculate the product of the inverse transformation matrix and the second codeword vector, which is to calculate H* and H′. _01 ×[m,o] T The product of the operation results is used to calculate the third codeword vector as H*×(H′). _01 ×[m,o] TThe result of the operation is the result of the operation on a finite field.

[0133] Next, the product of the 0-1 matrix representation of the fifth matrix and the third codeword vector is calculated to obtain the fourth codeword vector with a code length of n, which is the matrix calculation. The 0-1 matrix representation of H*×(H′) _01 ×[m,o] T The product of the results of the operations is used to obtain p. T This yields the fourth codeword vector p, which includes the aforementioned k information code elements and r check code elements. The r check code elements are the result of encoding the k information code elements. The fifth matrix is ​​the inverse matrix of the submatrix formed by selecting the reciprocal r columns of elements from the second matrix; the fifth matrix is ​​the matrix described earlier. matrix It is the inverse of matrix H2, and the 0-1 matrix representation of the fifth matrix is ​​as follows. For details, please refer to the previous introduction; it will not be repeated here.

[0134] Optionally, when the encoding device encodes k information symbols to obtain r check symbols, the k information symbols and r check symbols can be combined into a fourth codeword vector (e.g., the r check symbols are concatenated after the k information symbols), and then the fourth codeword vector is sent to the decoding device. This application does not limit the type or connection relationship between the encoding and decoding devices; please refer to the preceding description, which will not be repeated here.

[0135] Please refer to Figure 4, which is a flowchart illustrating a decoding method provided in an embodiment of this application. The decoding device can be a chip, a computing device (such as a server), a communication device, or a storage device, etc., and this application does not specifically limit it. The method includes the following steps S401 to S402.

[0136] S401. Obtain the first matrix, where the first matrix is ​​a 0-1 matrix representing the elements of the second matrix on a polynomial ring, and the second matrix is ​​a finite field 2. q The parity check matrix has r rows and n columns. The first polynomial corresponding to the polynomial ring is an irreducible polynomial of degree q over the binary field. The number of 1s in the first matrix is ​​less than the number of 1s in the 0-1 matrix representation of the second matrix.

[0137] It should be noted that the polynomial ring mentioned above is the same as the polynomial ring F2[x] / (x) described earlier. O +1), the first matrix is ​​H′ described above. _01 The second matrix is ​​the finite field GF(2) described above. qThe parity-check matrix H is given by the first polynomial p(x) of degree q irreducible over GF(2) as described above, and the inverse transformation matrix is ​​H* as described above. For details, please refer to the design process of RS codes introduced above, which will not be repeated here.

[0138] The aforementioned first matrix can be stored in the storage space of the decoding device or in the decoding chip; this application does not specifically limit this.

[0139] The polynomial ring described above is the set of polynomials over a binary field whose degree is less than that of the first polynomial, and whose degree is divisible by x by the first polynomial. O The smallest positive integer value of O when +1. The above q is a positive integer; this application does not impose specific limitations on it, but please refer to the previous introduction.

[0140] Optionally, the first polynomial is the polynomial with the smallest order among all irreducible polynomials of degree q over GF(2).

[0141] Optionally, the first element is any element in the second matrix, the first element corresponds to multiple polynomials in the polynomial ring, and the submatrix corresponding to the first element in the first matrix is ​​the 0-1 matrix representation of the polynomial with the fewest non-zero terms among these multiple polynomials.

[0142] Optionally, multiple third matrices are finite fields 2. q The parity check matrix has r rows and n columns. Multiple third matrices correspond to multiple fourth matrices. Each third matrix corresponds to at least one fourth matrix. Each fourth matrix is ​​a 0-1 matrix that represents the elements of the corresponding third matrix on a polynomial ring. The first matrix is ​​the matrix with the fewest 1s among the multiple fourth matrices.

[0143] Optionally, the sum of the number of 1s in the first matrix and the first value is less than the number of 1s in the 0-1 matrix representation of the second matrix. The first value is the product of the number of 1s in the inverse transformation matrix minus the value obtained by subtracting q and r-1. The inverse transformation matrix is ​​H* as described above.

[0144] S402. Decode the first codeword vector according to the first matrix to obtain the decoding result. The first codeword vector includes k information code elements and r check code elements, n = k + r. Each code element includes q data units, and each data unit includes at least one bit.

[0145] The first codeword vector can be sent from the encoding device to the decoding device. The first codeword vector received by the decoding device may contain errors compared to the codeword vector sent by the decoding device. The code length of the first codeword vector is n, including k information code elements and r check code elements, where n = k + r. Each information code element includes q data units, and each check code element includes q data units. Each data unit includes at least one bit.

[0146] It should be noted that once H and H′ are selected according to the RS code design process described above, the RS code pattern is determined. The decoding device will calculate the check vector S according to the following relationship: S = H × [m′, p′] T =H×[m′1,m′2,…,m′ k ,p′1,…,p′ r ] T

[0147] Where [m′,p′] is the first codeword vector of length n received by the decoding device, and m′=[m′1,m′2,…,m′] k [p′] represents the k information symbols in the first codeword vector, where p′ = [p′1, ..., p′] r [] represents the r check bits in the first codeword vector, each bit consisting of q data units. The check sub-vector S = [S1, S2, ..., Sr] contains r elements from S1 to Sr, each containing q data units. If all elements of the check sub-vector S are 0, the first codeword vector is considered correct; otherwise, an error exists within the first codeword vector.

[0148] As introduced above, H×V T It can be converted to H*×(H′) _01 ×V T Since the expression for calculating the check vector uses a pure XOR operation, [m′,p′] can be considered as V, and the expression can be rewritten as: S=H×[m′,p′] T =H * ×(H′ _01 ×[m′,p′] T )

[0149] In step S402, the decoding device calculates the check vector S based on the rewritten formula to simplify the calculation.

[0150] Specifically, the encoding device calculates the product of the first matrix and the first codeword vector to obtain the first check vector; if all elements of the first check vector are 0, the decoding result indicates that the first codeword vector is correct. Calculating the product of the first matrix and the first codeword vector here is equivalent to calculating H′ as described earlier. _01 With [m′,p′] TThe product of these elements yields the first check vector. The first check vector contains r elements, each corresponding one-to-one with one of the r checksums in the check vector S to be calculated by the encoding device. Each element in the first check vector is the result of the corresponding checksum over the polynomial ring. If all elements in the first check vector are 0, then the r checksums must also be 0 (refer to the previous explanation). Therefore, it is unnecessary to actually calculate the r checksums (i.e., one step of computation is reduced). With all elements in the first check vector being 0, the first codeword vector can be directly determined to be correct, and the k information symbols in the first codeword vector can then be used as the decoding result.

[0151] Optionally, if the elements of the first check vector are not all zero, then the product of the inverse transformation matrix and the first check vector needs to be calculated to obtain the second check vector. The inverse transformation matrix is ​​used to transform polynomials in the polynomial ring into finite fields. q The first codeword vector is a 0-1 matrix of elements in the second check vector. If all elements of the second check vector are 0, the decoding result indicates that the first codeword vector is correct. If not all elements of the second check vector are 0, the decoding result indicates that the first codeword vector has an error.

[0152] Here, the product of the inverse transformation matrix and the first parity vector is calculated, which is equivalent to calculating H. * With H'×[m′,p′] T The product of the operation results yields the second check vector, which is the check vector S described earlier, consisting of r check elements. If all r check elements are 0, the first codeword vector is confirmed to be correct, and the k information symbols in the first codeword vector can be directly used as the decoding result.

[0153] If not all r checksums are 0, then the first codeword vector is determined to have an error, and error correction is required to obtain the final encoding result. The error correction process includes steps such as Chien search and Forney value calculation. These steps may involve multiplication operations between H and the vector, which can be converted to H′ as described above. _01 The result of the multiplication operation with the vector is then multiplied by the inverse transformation matrix to convert back to the finite field. For details, please refer to the previous introduction, which will not be repeated here.

[0154] The decoding method in Figure 4 will be illustrated below with reference to Figures 5 to 14.

[0155] Example 1: Assume n = 256, k = 240, q = 8, and the data unit is 1 bit. In this case, r = nk = 256 - 240 = 16, GF(2 q )=GF(2 8 ) = GF(256), and the size of the finite field GF(256) is consistent with the code length n. As introduced above, α1~α256 The requirements are that they are all distinct and belong to the finite field GF(256), therefore α1~α 256 There can only be one set of values ​​(regardless of order), and the corresponding parity check matrix H also has only one form, as follows:

[0156] The verification matrix H is a matrix with 16 rows and 256 columns. Figure 5 shows the first 12 columns of the verification matrix H as an example.

[0157] Suppose we want to calculate the product of H and the first codeword vector received by the decoding device. The calculation methods include Method 1 and Method 2 as follows:

[0158] Method 1: Convert the parity check matrix H over the finite field into a 0-1 matrix, that is, convert each finite field element in H into an 8×8 0-1 matrix. Figure 6 shows the result of converting the 12 elements (3×4) in the upper left corner of matrix H into the corresponding 0-1 matrix. Then calculate the product of the 0-1 matrix representation of H and the first codeword vector. At this time, the finite field multiplication operation is converted into a pure XOR operation.

[0159] According to statistics, there are 123,932 ones in the 0-1 matrix representation of H. The 0-1 matrix representation of H is relatively dense (there are many ones). The total number of XOR operations required for the above operation = the number of ones in the 0-1 matrix representation of H - the number of rows in the 0-1 matrix representation of H = 123,932 - 8 × 16 = 123,804. The computational complexity is still relatively high.

[0160] Method 2: To simplify the calculation, the multiplication of H with the first codeword vector is performed in two steps. The first step is to calculate the product of the 0-1 matrix representation of H′ and the first codeword vector to obtain the first check vector. The second step is to calculate the product of the corresponding inverse transformation matrix H* of H′ and the first check vector to obtain the second check vector. In particular, if all elements of the calculated first check vector are 0, the second step can be omitted, and the first codeword vector can be directly considered correct. For details, please refer to the previous introduction, which will not be repeated here.

[0161] Specifically, as introduced above, in order to determine H′, we first need to choose p(x). p(x) is an irreducible polynomial of degree q over GF(2). Here, we choose the smallest irreducible polynomial of degree q over GF(2), that is, p(x) = x 8 +x 5 +x 4 +x 3 +1, whose order is p(x) divides x. o The smallest positive integer value of O when +1 is 17. After selecting p(x), the polynomial ring F2[x] / (x) is also determined. O+1)=F2[x] / (x O +1)=F2[x] / (x 17 +1), the polynomial ring is a set of polynomials whose coefficients are taken from GF(2) and whose degree is less than 17. The highest degree of the polynomials in the polynomial ring is 16.

[0162] For each element in the finite field GF(256), the element is in the polynomial ring F2[x] / (x 17 +1) corresponds to multiple polynomials. The polynomial with the smallest image weight (i.e., the number of non-zero terms) among these polynomials is taken as the optimal transformation of that element. Figure 7 shows some elements in this finite field and the image weights of their corresponding optimal transformations. Here, only finite field elements with image weights of 1 and 2 for optimal transformations are listed. Among the finite field elements not listed, except for the element 0 whose optimal transformation image weight is 0, the image weight of the optimal transformations of the other elements is 3. Replacing each element in the above parity matrix H with its own optimal transformation, we can obtain the parity matrix H′ on the polynomial ring. H′ is a matrix with 16 rows and 256 columns.

[0163] Then, each element in H′ is replaced with a corresponding 0-1 matrix to obtain the 0-1 matrix representation H′ of the parity check matrix H′. _01 Figure 8 shows the result of converting the 12 elements (3×4) in the upper left corner of matrix H′ into the corresponding 0-1 matrix, H′ _01 The number of 1s in H′ = the sum of the image weights of all elements in H′ × 8 = 9091 × 8 = 72728. Calculate H′. _01 The product of H′ and the first codeword vector yields the first check vector. _01 The number of XOR operations required for the product with the first codeword vector is 72728 - 8 × 1 - 17 × (16 - 1) = 72465. The first check vector includes 16 elements, which correspond one-to-one with the 16 check bits (S1 to S16) in the second check vector S to be calculated. Each element in the first check vector includes 17 bits.

[0164] Figure 9 shows the inverse transformation matrix H* corresponding to H′. Calculating the product of H* and the first check vector involves converting all operations to XOR operations since H* is a 0-1 matrix. The required number of XOR operations is (number of 1s in H* - number of rows in H*) × (16 - 1) = (48 - 8) × 15 = 600. It should be noted that since the product of H* and the first element of the first check vector is the first element itself (identity transformation), this product can be omitted in the actual calculation process; only the product of H* and the last 15 elements of the first check vector needs to be calculated.

[0165] Combining the XOR operations from the previous two steps, the total number of XOR operations for Method 2 is 72465 + 600 = 73065. Compared to the total number of XOR operations for Method 1 (123804), Method 2 reduces the total number of XOR operations by 40.98%, significantly lowering computational complexity. Furthermore, the calculation process in Method 2 is incremental, meaning the decoding device doesn't need to wait for the entire first codeword vector to be received before starting calculations. The decoding device can begin calculations as soon as it receives a portion of the codewords in the first codeword vector, making it more suitable for industrial applications.

[0166] Example 2: Assume n = 128, k = 120, q = 8, and the data unit is 1 bit. In this case, r = nk = 128 - 120 = 8, GF(2 q )=GF(2 8 )=GF(256). As introduced above, α1~α 128 The requirements are that they are all distinct and belong to the finite field GF(256), therefore α1~α 128 There can be multiple sets of values, and the corresponding parity check matrix H has multiple possible forms. The appropriate H and H′ are determined according to the design process of RS code.

[0167] As introduced above, in order to determine H′, we first need to choose p(x). p(x) should be an irreducible polynomial of degree q over GF(2). Here, we choose the smallest irreducible polynomial of degree q over GF(2), that is, p(x) = x 8 +x 5 +x 4 +x 3 +1, whose order is p(x) divides x. O The smallest positive integer value of O when +1 is 17. After selecting p(x), the corresponding polynomial ring F2[x] / (x) is also determined. O +1)=F2[x] / (x O +1)=F2[x] / (x 17 +1), the polynomial ring is a set of polynomials whose coefficients are taken from GF(2) and whose degree is less than 17. The highest degree of the polynomials in the polynomial ring is 16.

[0168] For each element in the finite field GF(256), the element is in the polynomial ring F2[x] / (x 17 +1) corresponds to multiple polynomials. The polynomial with the smallest image weight (i.e., the number of non-zero terms) among these polynomials is taken as the optimal transformation of that element. Figure 7 shows some elements in this finite field and the image weights of their corresponding optimal transformations. Only finite field elements with image weights of 1 and 2 for optimal transformations are listed here. Among the finite field elements not listed, except for the element 0 whose optimal transformation image weight is 0, the image weight of the optimal transformation of the other elements is 3.

[0169] Since the parity-check matrix H has multiple possible forms, the optimal transformation of replacing each element in each possible form of H with the element itself will yield one possible form of the parity-check matrix H′. The parity-check matrix H′ has a total of y possible forms. To simplify the calculation as much as possible, the form with the fewest 1s in the 0-1 matrix representation is selected as the final H′. Once H′ is determined, the corresponding H is also determined, as follows:

[0170] The above H is a matrix with 8 rows and 128 columns. Figure 10 shows the first 12 columns of the check matrix H.

[0171] Suppose we want to calculate the product of H and the first codeword vector received by the decoding device, the calculation methods include the following three and four methods:

[0172] Method 3: The multiplication of H with the first codeword vector received by the decoding device is calculated in two steps. The first step is to calculate the 0-1 matrix representation of H′. _01 The first step is to multiply the first codeword vector by the first check vector. The second step is to calculate the product of the inverse transformation matrix H* corresponding to H′ and the first check vector to obtain the second check vector.

[0173] Specifically, by replacing each element in the previously determined parity check matrix H′ with a corresponding 0-1 matrix, the 0-1 matrix representation of parity check matrix H′ can be obtained. Figure 11 shows the result of converting the 12 elements in the upper left corner of H′ (elements at the intersection of 3 rows × 4 columns) into the corresponding 0-1 matrix. The 0-1 matrix representation of H′ is shown in Figure 11. _01 The number of 1s in H′ = the sum of the image weights of all elements in H′ × 8 = 2123 × 8 = 16984. Calculate H′. _01 The product of H′ and the first codeword vector yields the first check vector. _01 The total number of XOR operations required for the product with the first codeword vector is 16984 - 8 × 1 - 17 × (8 - 1) = 16857. The first check vector includes 8 elements, which correspond one-to-one with the 8 check bits (S1 to S8) in the second check vector S to be calculated. Each element in the first check vector includes 17 bits.

[0174] Next, calculate the product of H* and the first check vector. Figure 9 shows the inverse transformation matrix H* corresponding to H′. Since H* is a 0-1 matrix, all operations are converted to XOR operations. The total number of XOR operations required is (number of 1s in H* - number of rows in H*) × (8-1) = (48-8) × 7 = 280. Combining the XOR operations from the previous two steps, the total number of XOR operations in method three is 16857 + 280 = 17137.

[0175] Method 4: Convert the parity-check matrix H over the finite field into a 0-1 matrix. This involves converting each finite field element in H into an 8×8 0-1 matrix. Figure 12 exemplarily shows the result of converting the top-left 12 elements (3×4) of matrix H into the corresponding 0-1 matrix. Then, calculate the product of the 0-1 matrix representation of H and the first codeword vector. In this case, the finite field multiplication operation is converted into a pure XOR operation. Statistically, there are 28996 ones in the 0-1 matrix representation of H. The total number of XOR operations required for the above operation is 28996 - 8×8 = 28932.

[0176] Compared to the total number of XOR operations of 28932 in method four, the total number of XOR operations of method three is reduced by 40.77% to 16857, greatly reducing the computational complexity.

[0177] Example 3: Assume n = 64, k = 60, q = 8, and the data unit is 1 bit. In this case, r = nk = 64 - 60 = 4, GF(2 q )=GF(2 8 )=GF(256). As introduced above, α1~α 64 The requirements are that they are all distinct and belong to the finite field GF(256), therefore α1~α 64 There can be multiple sets of values, and the corresponding parity check matrix H has multiple possible forms. The appropriate H and H′ are determined according to the design process of RS code.

[0178] As introduced above, in order to determine H′, we first need to choose p(x). p(x) should be an irreducible polynomial of degree q over GF(2). Here, we choose the smallest irreducible polynomial of degree q over GF(2), that is, p(x) = x 8 +x 5 +x 4 +x 3 +1, whose order is p(x) divides x. O The smallest positive integer value of O when +1 is 17. After selecting p(x), the corresponding polynomial ring F2[x] / (x) is also determined. O +1)=F2[x] / (x O +1)=F2[x] / (x 17 +1), the polynomial ring is a set of polynomials whose coefficients are taken from GF(2) and whose degree is less than 17. The highest degree of the polynomials in the polynomial ring is 16.

[0179] For each element in the finite field GF(256), the element is in the polynomial ring F2[x] / (x 17+1) corresponds to multiple polynomials. The polynomial with the smallest image weight (i.e., the number of non-zero terms) among these polynomials is taken as the optimal transformation of that element. Figure 7 shows some elements in this finite field and the image weights of their corresponding optimal transformations. Only finite field elements with image weights of 1 and 2 for optimal transformations are listed here. Among the finite field elements not listed, except for the element 0 whose optimal transformation image weight is 0, the image weight of the optimal transformation of the other elements is 3.

[0180] Since the parity-check matrix H has multiple possible forms, the optimal transformation of replacing each element in each possible form of H with the element itself will yield one possible form of the parity-check matrix H′. The parity-check matrix H′ has a total of y possible forms. To simplify the calculation as much as possible, the form with the fewest 1s in the 0-1 matrix representation is selected as the final H′. Once H′ is determined, the corresponding parity-check matrix H is also determined, as follows:

[0181] The above-mentioned check matrix H is a matrix with 4 rows and 64 columns. Figure 13 shows the first 12 columns of the check matrix H.

[0182] Suppose we want to calculate the product of H and the first codeword vector received by the decoding device, the calculation methods include the following methods five and six:

[0183] Method 5: The multiplication of H with the first codeword vector received by the decoding device is calculated in two steps. The first step is to calculate the product of the 0-1 matrix representation of H′ with the first codeword vector to obtain the first check vector. The second step is to calculate the product of the corresponding inverse transformation matrix H* of H′ with the first check vector to obtain the second check vector.

[0184] Specifically, by replacing each element in the previously determined parity check matrix H′ with a corresponding 0-1 matrix, we can obtain the 0-1 matrix representation H′ of the parity check matrix H′. _01 Figure 14 shows the result of converting the 12 elements in the top left corner of matrix H′ (elements at the intersection of 3 rows × 4 columns) into the corresponding 0-1 matrix. _01 The number of 1s in H′ = the sum of the image weights of all elements in H′ × 8 = 462 × 8 = 3696. Calculate H′. _01 The product of H′ and the first codeword vector yields the first check vector. _01 The total number of XOR operations required for the product with the first codeword vector is 3696 - 8 × 1 - 17 × (4 - 1) = 3637. The first check vector includes 4 elements, which correspond one-to-one with the 4 check bits (S1 to S4) in the second check vector S to be calculated. Each element in the first check vector includes 17 bits.

[0185] Next, calculate the product of H* and the first check vector. Figure 9 shows the corresponding inverse transformation matrix H* of H′. Since H* is a 0-1 matrix, all operations are converted to XOR operations. The total number of XOR operations required is (number of 1s in H* - number of rows in H*) × (4-1) = (48-8) × 3 = 120. Combining the XOR operations from the previous two steps, the total number of XOR operations in method five is 3637 + 120 = 3757.

[0186] Method Six: Convert the parity-check matrix H over the finite field into a 0-1 matrix. This involves converting each finite field element in H into an 8×8 0-1 matrix. Figure 12 exemplarily shows the result of converting the top-left 12 elements (3×4) of H into the corresponding 0-1 matrix. Then, calculate the product of the 0-1 matrix representation of H and the first codeword vector. In this case, the finite field multiplication operation is converted into a pure XOR operation. Statistically, there are 6056 ones in the 0-1 matrix representation of H, and the total number of XOR operations required is 6056 - 4×8 = 6024.

[0187] Compared to method six, method three reduces the total number of XOR operations by 37.63%, significantly lowering computational complexity.

[0188] In summary, this application achieves [success] in the finite field GF(2). q When designing RS codes, the parity-check matrix H over the finite field of the RS code is transformed into a polynomial ring F2[x] / (x O The parity-check matrix H′ on the +1) has multiple possible forms. The form with the sparsest 0-1 matrix representation is selected as the final parity-check matrix H′, thus determining the corresponding parity-check matrix H and completing the design of the RS code. Subsequently, the product operation of H with any vector V (such as the first codeword vector received by the decoding device) during the encoding and decoding process can be converted into the product operation of the 0-1 matrix representation of the parity-check matrix H′ and vector V (essentially a pure XOR operation), obtaining the result on the polynomial ring. Then, the result is multiplied by the inverse transformation matrix (also essentially a pure XOR operation) to convert the result on the polynomial ring back to the finite field, completing the calculation.

[0189] Since the above scheme is a pure XOR operation and the total number of XOR operations is low, the encoding and decoding efficiency is high, which can reduce the hardware implementation complexity and overhead of RS encoding and decoding (including reducing the power consumption and area of ​​the encoding and decoding chip). Furthermore, for any finite field GF(2... q For each finite field GF(2), a corresponding irreducible polynomial of degree q can be found, such that the finite field GF(2) has a polynomial of degree q. qThe mapping transformation between the elements in the polynomial ring and the elements in the corresponding polynomial ring can exist, and appropriate H and H′ can be selected to simplify the operation. Therefore, the above scheme is applicable to any finite field, and the scheme has no restrictions on the parameters n, k, q, and has a wide range of applications.

[0190] Please refer to Figure 15, which is a schematic diagram of the structure of an encoding device 1500 provided in an embodiment of this application, including an acquisition module 1501 and an encoding module 1502.

[0191] The acquisition module 1501 is used to: acquire a first matrix, wherein the first matrix is ​​a 0-1 matrix representing the elements of the second matrix on a polynomial ring, and the second matrix is ​​a finite field 2. q The parity check matrix has r rows and n columns. The first polynomial corresponding to the polynomial ring is an irreducible polynomial of degree q over the binary field. The number of 1s in the first matrix is ​​less than the number of 1s in the 0-1 matrix representation of the second matrix.

[0192] The encoding module 1502 is used to: encode k information code elements according to the first matrix to obtain r check code elements, wherein each code element includes q data units, and each data unit includes at least one bit.

[0193] Optionally, the polynomial ring described above is the set of polynomials over a binary field whose degree is less than that of the first polynomial, and whose degree is divisible by x by the first polynomial. O The smallest positive integer value of O when +1.

[0194] Optionally, the first polynomial is the polynomial with the smallest order among all irreducible polynomials of degree q over the binary field.

[0195] Optionally, the encoding module 1502 is specifically used to: calculate the product of the first matrix and k information symbols to obtain the second codeword vector; calculate the product of the inverse transformation matrix and the second codeword vector to obtain the third codeword vector, wherein the inverse transformation matrix is ​​used to convert the polynomial in the polynomial ring into a finite field. q The 0-1 matrix of the elements in the second matrix; calculate the product of the 0-1 matrix representation of the fifth matrix and the third codeword vector to obtain r check codes, where the fifth matrix is ​​the inverse matrix of the submatrix composed of the reciprocal r columns of elements selected from the second matrix.

[0196] Optionally, the sum of the number of 1s in the first matrix and the first value is less than the number of 1s in the 0-1 matrix representation of the second matrix. The first value is the product of the number of 1s in the inverse transformation matrix minus the value obtained by q and r-1.

[0197] Optionally, the first element is any element in the second matrix, the first element corresponds to multiple polynomials in the polynomial ring, and the submatrix corresponding to the first element in the first matrix is ​​the 0-1 matrix representation of the polynomial with the fewest non-zero terms among these multiple polynomials.

[0198] Optionally, multiple third matrices are finite fields 2. q The first matrix is ​​a check matrix with r rows and n columns. The plurality of third matrices correspond to a plurality of fourth matrices. Each third matrix corresponds to at least one fourth matrix. Each fourth matrix is ​​a 0-1 matrix that represents the elements of the corresponding third matrix on the polynomial ring. The first matrix is ​​the matrix with the fewest 1s among the plurality of fourth matrices.

[0199] Optionally, q can be one of 1, 3, 5, 6, 7, 8, 9, or 11.

[0200] It should be noted that the encoding device 1500 in Figure 15 is only exemplarily divided into an acquisition module 1501 and an encoding module 1502 according to function. In fact, the encoding device 1500 may also contain more or fewer modules. For example, one of the above modules can be split into multiple functional modules, two or more of the above modules can be merged into one functional module, and other functional modules can be added to the encoding device 1500. This application embodiment does not make specific limitations.

[0201] Please refer to Figure 16, which is a schematic diagram of the structure of a decoding device 1600 provided in an embodiment of this application, including an acquisition module 1601 and a decoding module 1602.

[0202] The acquisition module 1601 is used to: acquire a first matrix, wherein the first matrix is ​​a 0-1 matrix representing the elements of the second matrix on a polynomial ring, the second matrix is ​​a check matrix with r rows and n columns on a finite field 2q, the first polynomial corresponding to the polynomial ring is an irreducible polynomial of degree q on a binary field, and the number of 1s in the first matrix is ​​less than the number of 1s in the 0-1 matrix representation of the second matrix.

[0203] The decoding module 1602 is used to: decode the first codeword vector according to the first matrix to obtain the decoding result, wherein the first codeword vector includes k information code elements and r check code elements, n = k + r, each code element includes q data units, and each data unit includes at least one bit.

[0204] Optionally, the polynomial ring described above is a set of polynomials over a binary field whose degree is less than that of the first polynomial, and the degree is the smallest positive integer value of O when the first polynomial divides xO+1.

[0205] Optionally, the first polynomial is the polynomial with the smallest order among all irreducible polynomials of degree q over the binary field.

[0206] Optionally, the decoding module 1602 is specifically used to: calculate the product of the first matrix and the first codeword vector to obtain the first check vector; if all elements of the first check vector are 0, the decoding result indicates that the first codeword vector is correct.

[0207] Optionally, the decoding module 1602 is further configured to: if the elements of the first check vector are not all 0, calculate the product of the inverse transformation matrix and the first check vector to obtain the second check vector, wherein the inverse transformation matrix is ​​a 0-1 matrix used to convert the polynomial in the polynomial ring into the elements of the finite field 2q; if the elements of the second check vector are all 0, the decoding result indicates that the first codeword vector is correct; if the elements of the second check vector are not all 0, the decoding result indicates that the first codeword vector has an error.

[0208] Optionally, the sum of the number of 1s in the first matrix and the first value is less than the number of 1s in the 0-1 matrix representation of the second matrix. The first value is the product of the number of 1s in the inverse transformation matrix minus the value obtained by q and r-1.

[0209] Optionally, the first element is any element in the second matrix, the first element corresponds to multiple polynomials in the polynomial ring, and the submatrix corresponding to the first element in the first matrix is ​​the 0-1 matrix representation of the polynomial with the fewest non-zero terms among these multiple polynomials.

[0210] Optionally, the multiple third matrices are parity check matrices with r rows and n columns over a finite field 2q. The multiple third matrices correspond to multiple fourth matrices, and each third matrix corresponds to at least one fourth matrix. Each fourth matrix is ​​a 0-1 matrix representing the elements of the corresponding third matrix over the polynomial ring. The first matrix is ​​the matrix with the fewest 1s among the multiple fourth matrices.

[0211] Optionally, q can be one of 1, 3, 5, 6, 7, 8, 9, or 11.

[0212] It should be noted that the decoding device 1600 in Figure 16 is only exemplarily divided into an acquisition module 1601 and a decoding module 1602 based on function. In reality, the decoding device 1600 may also contain more or fewer modules. For example, one of the above modules may be split into multiple functional modules, or two or more of the above modules may be merged into one functional module. Other functional modules may also be added to the decoding device 1600. This application embodiment does not make specific limitations.

[0213] Please refer to Figure 17, which is a schematic diagram of the structure of a computing device 1700 provided in an embodiment of this application, including a bus 1702, a processor 1704, a memory 1706, and a communication interface 1708. The processor 1704, the memory 1706, and the communication interface 1708 communicate with each other via the bus 1702. The computing device 1700 can be a server, laptop, tablet, desktop computer, edge device, smartphone, smart screen, etc., and this application does not specifically limit it. This application also does not limit the number and type of processors and memory in the computing device 1700.

[0214] Bus 1702 can be a Peripheral Component Interconnect Express (PCIe) bus, or an Extended Industry Standard Architecture (EISA) bus, a Unified Bus (Ubus or UB), a Compute Express Link (CXL), a Cache Coherent Interconnect for Accelerators (CCIX), etc. Bus 1702 can be divided into address bus, data bus, control bus, etc. In addition to the data bus, Bus 1702 can also include a power bus, control bus, and status signal bus. However, for clarity, all buses are labeled as Bus 1702 in the diagram.

[0215] Processor 1704 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0216] The memory 1706 may include volatile memory, such as random access memory (RAM). The processor 1704 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0217] The memory 1706 stores executable program code. The processor 1704 executes the executable program code to implement the functions of the acquisition module 1501 and the encoding module 1502 in FIG. 15, thereby implementing the operation steps in the encoding method of FIG. 3 of this application. Alternatively, the processor 1704 executes the executable program code to implement the functions of the acquisition module 1601 and the decoding module 1602 in FIG. 16, thereby implementing the operation steps in the decoding method of FIG. 4 of this application.

[0218] The communication interface 1708 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 1700 and other devices or communication networks.

[0219] This application also provides a computing device cluster, which includes multiple computing devices 1700. The memory 1706 of the multiple computing devices 1700 in the computing device cluster may store the same instructions for implementing the methods of Figure 3 or Figure 4. In some possible implementations, the memory 1706 of the multiple computing devices 1700 in the computing device cluster may also store partial instructions for implementing the methods of Figure 3 or Figure 4. In other words, the combination of multiple computing devices 1700 can jointly execute the instructions for implementing the methods of Figure 3 or Figure 4. In some possible implementations, the multiple computing devices in the computing device cluster can be connected via a network. The network can be a wide area network (WAN) or a local area network (LAN), etc. Specifically, the connection to the network is made through the communication interface in each computing device.

[0220] This application also provides a chip including an interface and a processor. The interface is used to interact with external devices or modules of the chip, and the processor is used to execute the method of FIG3 or FIG4.

[0221] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that, when executed on a computing device, cause the computing device to perform the operation steps in the method of FIG3 or FIG4. This application also provides a computer program product containing instructions. The computer program product can be software or a program product containing instructions that can run on a computing device or be stored on any available medium. When the computer program product is executed on a computing device, it causes the computing device to perform the operation steps in the method of FIG3 or FIG4.

[0222] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.

Claims

1. A decoding method, comprising: The method is applied to a decoding device, and the method comprises: obtaining a first matrix, wherein the first matrix is a 0-1 matrix representing elements in a second matrix on a polynomial ring, the second matrix is a check matrix with r rows and n columns on a finite field 2 q , the polynomial ring corresponds to a first polynomial which is an irreducible polynomial of degree q on a binary field, and the number of 1s in the first matrix is less than the number of 1s in the 0-1 matrix representation of the second matrix; decoding a first codeword vector according to the first matrix to obtain a decoding result, wherein the first codeword vector comprises k information symbols and r check symbols, n=k+r, each symbol comprises q data units, and each data unit comprises at least one bit.

2. The method of claim 1, wherein, The polynomial ring is a set of polynomials over a binary field of degree less than the order of the first polynomial, the order being the highest power of x that divides the first polynomial O the smallest positive integer value of k for which O(k) = 0.

3. The method of claim 2, wherein, The first polynomial is a polynomial with the smallest order among all irreducible polynomials of the qth order over a binary field.

4. The method according to any one of claims 1 to 3, characterized in that, The decoding of the first codeword vector according to the first matrix to obtain a decoding result comprises: calculating a product of the first matrix and the first codeword vector to obtain a first syndrome vector; if all elements of the first syndrome vector are 0, the decoding result indicates that the first codeword vector is correct.

5. The method of claim 4, wherein, The method further comprises: If the elements of the first syndrome vector are not all zeros, then a second syndrome vector is calculated by multiplying an inverse transform matrix with the first syndrome vector, wherein the inverse transform matrix is a 0-1 matrix used to convert a polynomial in the polynomial ring into an element in the finite field GF(2) q ​ if all elements of the second syndrome vector are 0, the decoding result indicates that the first codeword vector is correct; if not all elements of the second syndrome vector are 0, the decoding result indicates that the first codeword vector has an error.

6. The method of claim 5, wherein, The sum of the number of 1s in the first matrix and a first numerical value is less than the number of 1s in the 0-1 matrix representation of the second matrix, and the first numerical value is a product of a numerical value obtained by subtracting q from the number of 1s in the inverse transformation matrix and r-1.

7. The method according to any one of claims 1 to 6, characterized in that, A first element is any element in the second matrix, the first element corresponds to a plurality of polynomials in the polynomial ring, and a submatrix corresponding to the first element in the first matrix is a 0-1 matrix representation of a polynomial with the least non-zero term among the plurality of polynomials.

8. The method according to any one of claims 1 to 7, characterized in that, The plurality of third matrices are each a parity check matrix of row number r and column number n over a finite field 2 q , the plurality of third matrices corresponding to a plurality of fourth matrices, each third matrix corresponding to at least one fourth matrix, each fourth matrix being a 0-1 matrix representing elements in the corresponding third matrix over the polynomial ring, the first matrix being one with the least number of 1s among the plurality of fourth matrices.

9. The method according to any one of claims 1 to 8, characterized in that, The q is one of 1, 3, 5, 6, 7, 8, 9 and 11.

10. An encoding method characterized by comprising: The method is applied to an encoding device, and the method comprises: obtaining a first matrix, wherein the first matrix is a 0-1 matrix representing elements in a second matrix on a polynomial ring, the second matrix is a check matrix with r rows and n columns on a finite field 2 q , the polynomial ring corresponds to a first polynomial which is an irreducible polynomial of degree q on a binary field, and the number of 1s in the first matrix is less than the number of 1s in the 0-1 matrix representation of the second matrix; encoding k information symbols according to the first matrix to obtain r check symbols, wherein each symbol comprises q data units, and each data unit comprises at least one bit.

11. The method of claim 10, wherein, The polynomial ring is a set of polynomials over a binary field of degree less than the order of the first polynomial, the order being the highest power of x that divides the first polynomial O the smallest positive integer value of k for which O(k) = 0.

12. The method of claim 11, wherein, The first matrix is a polynomial with the smallest order among all irreducible polynomials of the qth order over the binary field.

13. The method according to any one of claims 10 to 12, characterized in that, The encoding of the k information symbols according to the first matrix to obtain r check symbols comprises: calculating a product of the first matrix and the k information symbols to obtain a second codeword vector; computing a product of an inverse transform matrix and the second codeword vector, wherein the inverse transform matrix is a 0-1 matrix for converting polynomials in the polynomial ring to elements in the finite field GF(2) q ; and calculating a product of a 0-1 matrix representation of a fifth matrix and the third codeword vector to obtain the r check symbols, wherein the fifth matrix is an inverse matrix of a submatrix composed of r columns of inverse elements selected from the second matrix.

14. The method of claim 13, wherein, The sum of the number of 1s in the first matrix and a first numerical value are less than the number of 1s in the 0-1 matrix representation of the second, and the first numerical value is a product of a numerical value obtained by subtracting q from a number of 1s in the inverse transformation matrix and r-1.

15. The method according to any one of claims 10 to 14, characterized in that, A first element is an arbitrary element in the second matrix, the first element corresponds to a plurality of polynomials in the polynomial, and a submatrix corresponding to the first element in the first matrix is a 0- 1 matrix representation of a polynomial with the least non-zero term among the plurality of polynomials.

16. The method according to any one of claims 10 to 15, characterized in that, The plurality of third matrices are each a parity check matrix of row number r and column number n over a finite field 2 q , the plurality of third matrices correspond to a plurality of fourth matrices, each third matrix corresponds to at least one fourth matrix, each fourth matrix is a 0-1 matrix representing elements in the corresponding third matrix over the polynomial ring, and the first matrix is one of the plurality of fourth matrices having the least number of 1s.

17. The method according to any one of claims 10 to 16, characterized in that, q is one of 1, 3, 5, 6, 7, 9, 8 and 11.

18. A decoding apparatus, comprising: The module is used for performing the method according to any one of claims 1 to 9.

19. An encoding apparatus, comprising: comprising a module for performing the method of any of claims 10-17.

20. A chip, characterized by comprising a processor and an interface for data interaction with external devices or modules of the chip, the processor configured to perform the method of any of claims 1-9 or 10-17.

21. A computing device, comprising: comprising a processor and a memory, the processor configured to execute instructions stored in the memory, causing the computing device to perform the method of any of claims 1-9 or 10-17.

22. A computer-readable storage medium, characterized in that, comprising instructions that, when executed on a computing device, cause the computing device to perform the method of any of claims 1-9 or 10-17.

23. A computer program product comprising instructions, characterized in that, comprising instructions that, when executed on a computing device, cause the computing device to perform the method of any of claims 1-9 or 10-17.