Extended Hamming code encoding and decoding method, device, equipment and medium
By constructing a large generation matrix to generate uniform sub-generating matrix and check matrix, the problem of large resource consumption in the existing technology is solved, and the encoding and decoding function with high clock rate and multi-data bit width is realized, which meets the performance indicators of correction and detection. .
Patent Information
- Application Number
- CN202411270050.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-31
AI Technical Summary
In the existing extended Hamming code encoding and decoding algorithms, there are many check matrix elements 1, which leads to complex logic operations, large resource consumption, and it is difficult to implement high clock rate and multi-data bit width encoding and decoding functions.
By constructing a large generation matrix, a sub-generation matrix and a check matrix corresponding to different data bit widths can be generated, so that the number of check bits participating in the data bits is uniform, with a maximum of no more than 1, reducing physical resource consumption and achieving higher clock frequency operation .
It realizes resource saving and high clock rate when meeting the performance indicators of correction and detection, and supports multi-data bit width encoding and decoding functions, reducing resource consumption and timing complexity.
Smart Images

Figure CN119232174A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data error correction, and in particular to an extended Hamming code encoding and decoding method, device, equipment and medium. Background Art
[0002] The existing extended Hamming code encoding and decoding algorithm is implemented based on the principle of binary division. There are more 1 elements in the check matrix, resulting in more bits involved in logical operations. In addition, the distribution of 1 elements in the check matrix is more divergent, resulting in a large difference in the number of elements involved in the calculation of each data bit, which will reduce the upper limit of the operating clock frequency. In the existing method, each data bit width needs to correspond to a separate check matrix. For scenarios with data of various bit widths for encoding and decoding, more resources are needed to store or manage these check matrices from a physical implementation perspective. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide an extended Hamming code encoding and decoding method, device, equipment and medium, which can reduce physical resource consumption, run at a higher clock rate, and realize the encoding and decoding functions of any data bit width corresponding to the matrix while meeting the performance indicators of extended Hamming code error correction and error detection (correction of one and detection of even).
[0004] The technical solution adopted by the present invention to solve the technical problem is: to provide an extended Hamming code encoding method, comprising the following steps:
[0005] Constructing a sub-generator matrix of the required check bit width based on the large generator matrix;
[0006] Encoding information bits using the sub-generator matrix to obtain a transmission codeword;
[0007] Wherein, the large generator matrix is expressed as:
[0008]
[0009] The constructing of a sub-generator matrix of the required data width based on the large generator matrix specifically includes:
[0010] Determine the number of bits k of the information bits, and set the required check bit width m based on the number of bits k of the information bits;
[0011] Select the submatrix P of the last m columns and the first k rows of the large generator matrix, and compare the submatrix P with the k×k identity matrix I k×k splicing to form the sub-generator matrix [I k×k P].
[0012] The method of using the sub-generator matrix to encode the information bits to obtain a transmission codeword is specifically: multiplying the information bits with the sub-generator matrix to obtain a transmission codeword, wherein the first k bits in the transmission codeword are the information bits, the last nk bits are check bits, and n is the number of bits of the transmission codeword.
[0013] The technical solution adopted by the present invention to solve the technical problem is: to provide an extended Hamming code decoding method, comprising the following steps:
[0014] Constructing a check matrix of required check bit width based on the large generator matrix;
[0015] Decoding the received codeword using the check matrix to obtain a syndrome;
[0016] Based on the syndrome, according to the single-bit error mapping relationship, a corresponding error pattern is found;
[0017] Obtaining a decoding result according to the received codeword and the error pattern;
[0018] Wherein, the large generator matrix is expressed as:
[0019]
[0020] The construction of a check matrix with a required check bit width based on a large generator matrix specifically includes:
[0021] Determine the number of information bits k and the required check bit width m according to the received codeword;
[0022] Select the submatrix P of the last m columns and the first k rows of the large generator matrix, and add the transpose of the submatrix P to the identity matrix I of (nk)×(nk) (n-k)×(n-k) splicing to form the check matrix [P T |I (n-k)×(n-k) ], where n is the number of bits of the received codeword and nk=m.
[0023] The step of decoding the received codeword using the check matrix to obtain a syndrome is specifically: multiplying the received codeword by the transpose of the check matrix to obtain a syndrome.
[0024] The technical solution adopted by the present invention to solve the technical problem is: to provide an extended Hamming code encoding device, comprising:
[0025] A generator matrix construction module is used to construct a sub-generator matrix of the required check bit width based on the large generator matrix;
[0026] An encoding module, used to encode information bits using the sub-generator matrix to obtain a transmission codeword;
[0027] Wherein, the large generator matrix is expressed as:
[0028]
[0029] The technical solution adopted by the present invention to solve the technical problem is: to provide an extended Hamming code decoding device, comprising:
[0030] A check matrix construction module, used for constructing a check matrix of required check bit width based on a large generator matrix;
[0031] A decoding module, used for decoding the received codeword using the check matrix to obtain a syndrome;
[0032] A mapping module, configured to find a corresponding error pattern based on the syndrome and according to a single-bit error mapping relationship;
[0033] A decoding module, used to obtain a decoding result according to the received codeword and the error pattern;
[0034] Wherein, the large generator matrix is expressed as:
[0035]
[0036] The technical solution adopted by the present invention to solve its technical problem is: to provide an electronic device, including a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above method when executing the computer program.
[0037] The technical solution adopted by the present invention to solve its technical problem is: providing a computer-readable storage medium, on which a computer program is stored, and the computer program implements the steps of the above method when executed by a processor.
[0038] Beneficial Effects
[0039] Due to the adoption of the above-mentioned technical scheme, the present invention has the following advantages and positive effects compared with the prior art: the present invention expands sub-generator matrices and check matrices corresponding to different data bit widths through a large generator matrix, and the number of data bits required to participate in all the check bits of the encoding is uniform, and does not exceed 1 at most, so that the comprehensive timing converges better, thereby being able to run at a higher clock frequency. Since the generator matrices corresponding to different data bit widths are generated based on the same large generator matrix, the physical resource consumption is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a flow chart of an extended Hamming code encoding method according to a first embodiment of the present invention;
[0041] Figure 24 is a flowchart of an extended Hamming code decoding method according to a second embodiment of the present invention. DETAILED DESCRIPTION
[0042] The present invention will be further described below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention. In addition, it should be understood that after reading the content taught by the present invention, those skilled in the art can make various changes or modifications to the present invention, and these equivalent forms fall within the scope limited by the appended claims of the application equally.
[0043] The first embodiment of the present invention relates to an extended Hamming code encoding method, such as Figure 1 As shown, the following steps are included:
[0044] Step 1: construct a sub-generator matrix of the required check bit width based on the large generator matrix.
[0045] In this step, the number of information bits k is first determined, and the required check bit width m is set based on the number of information bits k. Then, a submatrix P with the last m columns and the first k rows in the large generator matrix is selected, and the submatrix P is compared with the k×k unit matrix I k×k splicing to form the sub-generator matrix [I k×k P]. The large generator matrix is as follows:
[0046]
[0047] The large generation matrix in this embodiment can construct a sub-generation matrix with a check bit width of 4-11. When the required check bit width is 4, the constructed sub-generation matrix can realize the encoding of the data width [2,4]; when the required check bit width is 5, the constructed sub-generation matrix can realize the encoding of the data width [5,11]; when the required check bit width is 6, the constructed sub-generation matrix can realize the encoding and decoding of the data width [12,26]; when the required check bit width is 7, the constructed sub-generation matrix can realize the encoding and decoding of the data width The sub-generator matrix can encode the data width [27,57]; when the required check bit width is 8, the constructed sub-generator matrix can encode the data width [58,120]; when the required check bit width is 9, the constructed sub-generator matrix can encode the data width [121,247]; when the required check bit width is 10, the constructed sub-generator matrix can encode the data width [248,502]; when the required check bit width is 11, the constructed sub-generator matrix can encode the data width [503,1013].
[0048] Step 2: Encode the information bits using the sub-generator matrix to obtain a transmission codeword. This step is specifically: encode the information bits U = {u0, u1, ..., u k-1} and the sub-generator matrix [I k×k P] to obtain the transmitted codeword C, that is, C = {c0, c1, ..., c n-1}=U*[I k×k P]={u0,u1,...,u k-1 ,p0,p1,...,p n-k-1}, wherein the first k bits in the transmission codeword are the information bits, the last nk bits are check bits, and n is the number of bits of the transmission codeword. Finally, the transmission codeword obtained after the above encoding is transmitted.
[0049] A second embodiment of the present invention relates to an extended Hamming code decoding method, such as Figure 2 As shown, the following steps are included:
[0050] Step 1: construct a check matrix with the required check bit width based on the large generator matrix.
[0051] In this step, the number of information bits k and the required check bit width m are first determined according to the received codeword, and then the submatrix P of the last m columns and the first k rows of the large generator matrix is selected, and the transpose of the submatrix P is added to the unit matrix I of (nk)×(nk) (n-k)×(n-k) splicing to form the check matrix [P T |I (n-k)×(n-k) ], where n is the number of bits of the received codeword. The large generator matrix is as follows:
[0052]
[0053] The large production matrix in this implementation can construct a check matrix with a check bit width of 4-11. When the required check bit width is 4, the constructed check matrix can realize the decoding of the data width [2,4]; when the required check bit width is 5, the constructed check matrix can realize the decoding of the data width [5,11]; when the required check bit width is 6, the constructed check matrix can realize the decoding of the data width [12,26]; when the required check bit width is 7, the constructed check matrix can realize the decoding of the data width [ 27,57]; when the required check bit width is 8, the constructed check matrix can realize the decoding of data width [58,120]; when the required check bit width is 9, the constructed check matrix can realize the decoding of data width [121,247]; when the required check bit width is 10, the constructed check matrix can realize the decoding of data width [248,502]; when the required check bit width is 11, the constructed check matrix can realize the decoding of data width [503,1013].
[0054] Step 2, using the check matrix to decode the received codeword to obtain a syndrome; this step is specifically: the received codeword R = {r0, r1, ..., r n-1} and the check matrix [P T |I (n-k)×(n-k) ] and multiply the transpose of the two to get the syndrome S, that is, S = R*[P T |I (n-k)×(n-k) ].
[0055] Step 3: Based on the syndrome S, find the corresponding error pattern according to the single-bit error mapping relationship. Specifically, map the elements in the syndrome S with 13 single-bit error patterns (1 bit is 1, and the other bits are 0) and 1 all-0 correct pattern to obtain the error pattern e′.
[0056] Step 4, obtaining a decoding result C' according to the received codeword and the error pattern, that is, C'=R+e'.
[0057] The decoding method of this embodiment completes the parity check function by judging the parity of the number of bits of 1 in the syndrome, so that the performance can correct 1-bit errors and detect even-bit errors.
[0058] The following takes 8-bit data (corresponding to 5 check bits), assumes that the information bits are {d0, d1, d2, d3, d4, d5, d6, d7, d8}, the check bits are {p0, p1, p2, p3, p4}, and the accompanying codeword bits are {s0, s1, s2, s3, s4} as an example to further illustrate the first and second embodiments of the present invention.
[0059] The entire encoding process is as follows:
[0060] 1. Select the first 8 rows of the last 5 columns of the above large production matrix G and concatenate them with the 8×8 unit matrix as the sub-generator matrix A of 8-bit data. The sub-generator matrix A is as follows:
[0061]
[0062] 2. Encoding, that is, multiplying the information bits {d0, d1, d2, d3, d4, d5, d6, d7, d8} by the sub-generator matrix A to obtain the transmitted codeword C = {d0, d1, d2, d3, d4, d5, d6, d7, p0, p1, p2, p3, p4}, where
[0063]
[0064] The entire decoding process is as follows:
[0065] 1. Receive the received codeword R corresponding to the transmitted codeword C = {d′0, d′1, d′2, d′3, d′4, d′5, d′6, d′7, p′0, p′1, p′2, p′3, p′4};
[0066] 2. Select the first 8 rows of the last 5 columns of the above large production matrix G and transpose them, and then concatenate them with the 5×5 unit matrix to obtain the check matrix B. The check matrix B is as follows:
[0067]
[0068] 3. Multiply the received codeword R by the transpose of the check matrix B to obtain the syndrome S, where the bits in the syndrome S are:
[0069]
[0070] 4. The syndrome S is mapped with 13 single-bit error patterns (1 bit is 1, and the other bits are 0) and 1 all-0 correct pattern to obtain the error pattern e′. Finally, the decoding result C′=R+e′.
[0071] It is not difficult to find that the present invention expands the generating matrices for different data bit widths by constructing a large generating matrix. The number of data bits required to participate in all the check bits of the encoding is uniform, and does not exceed 1 at most, so that the comprehensive timing converges better, thereby being able to run at a higher clock frequency. Since the generating matrices corresponding to different data bit widths are generated based on the same large generating matrix, the physical resource consumption is reduced.
[0072] A third embodiment of the present invention relates to an extended Hamming code encoding device, comprising:
[0073] A generator matrix construction module is used to construct a sub-generator matrix of the required check bit width based on the large generator matrix;
[0074] An encoding module, used to encode information bits using the sub-generator matrix to obtain a transmission codeword;
[0075] Wherein, the large generator matrix is expressed as:
[0076]
[0077] The generation matrix construction module comprises:
[0078] A first determining unit, configured to determine the number of bits k of the information bits, and to set a required check bit width m based on the number of bits k of the information bits;
[0079] The sub-generator matrix forming unit is used to select a sub-matrix P of the last m columns and the first k rows in the large generator matrix, and to combine the sub-matrix P with the k×k identity matrix I k×k splicing to form the sub-generator matrix [I k×k |P]
[0080] The encoding module multiplies the information bits by the sub-generator matrix to obtain a transmission codeword, wherein the first k bits in the transmission codeword are the information bits, the last nk bits are check bits, and n is the number of bits of the transmission codeword.
[0081] A fourth embodiment of the present invention relates to an extended Hamming code decoding device, comprising:
[0082] A check matrix construction module, used for constructing a check matrix of required check bit width based on a large generator matrix;
[0083] A decoding module, used for decoding the received codeword using the check matrix to obtain a syndrome;
[0084] A mapping module, configured to find a corresponding error pattern based on the syndrome and according to a single-bit error mapping relationship;
[0085] A decoding module, used to obtain a decoding result according to the received codeword and the error pattern;
[0086] Wherein, the large generator matrix is expressed as:
[0087]
[0088] The check matrix construction module comprises:
[0089] A second determining unit, used to determine the number k of information bits and the required check bit width m according to the received codeword;
[0090] The check matrix forming unit is used to select a submatrix P of the last m columns and the first k rows in the large generator matrix, and to compare the transpose of the submatrix P with the unit matrix I of (nk)×(nk) (n-k)×(n-k) splicing to form the check matrix [P T |I (n-k)×(n-k) ], where n is the number of bits of the received codeword and nk=m.
[0091] The decoding module multiplies the received codeword by the transpose of the check matrix to obtain a syndrome.
[0092] A fifth embodiment of the present invention relates to an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the extended Hamming code encoding method of the first embodiment and / or the extended Hamming code decoding method of the second embodiment are implemented.
[0093] The sixth embodiment of the present invention relates to a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the extended Hamming code encoding method of the first embodiment and / or the extended Hamming code decoding method of the second embodiment are performed.
[0094] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.
[0095] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0096] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction method, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0097] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0098] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. An extended Hamming code encoding method, characterized in that: The following steps are involved: Constructing a sub-generator matrix of the required check bit width based on the large generator matrix; Encoding information bits using the sub-generator matrix to obtain a transmission codeword; Wherein, the large generator matrix is expressed as:
2. The extended Hamming code encoding method according to claim 1, characterized in that: The constructing of a sub-generator matrix of the required data width based on the large generator matrix specifically includes: Determine the number of bits k of the information bits, and set the required check bit width m based on the number of bits k of the information bits; select a submatrix P with the last m columns and the first k rows in the large generator matrix, and compare the submatrix P with the k×k unit matrix I k×k splicing to form the sub-generator matrix [I k×k P].
3. The extended Hamming code encoding method according to claim 1, characterized in that: The method of using the sub-generator matrix to encode the information bits to obtain a transmission codeword is specifically: multiplying the information bits with the sub-generator matrix to obtain a transmission codeword, wherein the first k bits in the transmission codeword are the information bits, the last nk bits are check bits, and n is the number of bits of the transmission codeword.
4. An extended Hamming code decoding method, characterized in that: The following steps are involved: Constructing a check matrix of required check bit width based on the large generator matrix; Decoding the received codeword using the check matrix to obtain a syndrome; Based on the syndrome, according to the single-bit error mapping relationship, a corresponding error pattern is found; Obtaining a decoding result according to the received codeword and the error pattern; Wherein, the large generator matrix is expressed as:
5. The extended Hamming code decoding method according to claim 4, characterized in that: The construction of a check matrix of required check bit width based on a large generator matrix specifically includes: Determine the number of information bits k and the required check bit width m according to the received codeword; Select the submatrix P of the last m columns and the first k rows of the large generator matrix, and add the transpose of the submatrix P to the identity matrix I of (nk)×(nk) (n-k)×(n-k) splicing to form the check matrix [P T |I (n-k)×(n-k) ], where n is the number of bits of the received codeword and nk=m.
6. The extended Hamming code decoding method according to claim 4, characterized in that: The adopting the check matrix to decode the received codeword to obtain a syndrome is specifically: multiplying the received codeword by the transpose of the check matrix to obtain a syndrome.
7. An extended Hamming code encoding device, characterized in that: include: A generator matrix construction module is used to construct a sub-generator matrix of the required check bit width based on the large generator matrix; An encoding module, used for encoding information bits using the sub-generator matrix to obtain a transmission codeword; Wherein, the large generator matrix is expressed as:
8. An extended Hamming code decoding device, characterized in that: include: A check matrix construction module, used for constructing a check matrix of required check bit width based on a large generator matrix; A decoding module, used for decoding the received codeword using the check matrix to obtain a syndrome; A mapping module, configured to find a corresponding error pattern based on the syndrome and according to a single-bit error mapping relationship; A decoding module, used to obtain a decoding result according to the received codeword and the error pattern; Wherein, the large generator matrix is expressed as:
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.