Real-time recursive CRC method and apparatus, and computer storage medium and program
The CRC verification method based on recursive decomposition and iterative merging solves the problem of real-time verification of data streams of unknown length in the prior art, and achieves a reduction in logarithmic computational complexity and high-speed CRC verification.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- SUZHOU UNIVERSITY OF TECHNOLOGY
- Filing Date
- 2025-10-30
- Publication Date
- 2026-05-07
AI Technical Summary
Existing technologies cannot achieve real-time ultra-high-speed CRC verification when processing binary data streams of unknown length, and the inflexible parallel bit width setting results in high computational time complexity, failing to meet the requirements of high-speed data transmission.
A recursive method is used to truncate the real-time bit stream into binary sequences of non-fixed length, divide them into left and right halves, and merge them level by level to calculate the CRC check value and check matrix. Modulo-2 multiplication and modulo-2 addition are used for iterative calculation to achieve a logarithmic computation time complexity.
It enables flexible parallel computation of data streams of unknown length, meets the requirements of real-time ultra-high-speed CRC verification, reduces computation time complexity, and improves processing efficiency.
Smart Images

Figure CN2025131133_07052026_PF_FP_ABST
Abstract
Description
A real-time recursive CRC check method, apparatus, computer storage medium, and program.
[0001] This invention claims priority to Chinese Patent Application No. 202411545944.7, filed with the China National Intellectual Property Administration on November 1, 2024, entitled "A Real-Time Recursive CRC Verification Method, Apparatus, Computer Storage Medium and Program", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This invention relates to the field of digital information transmission error detection technology, and in particular to a real-time recursive CRC verification method, apparatus, computer storage medium, and program. Background Technology
[0003] CRC encoding is a commonly used error checking code used to ensure the correctness of information transmission under various protocol formats. According to the general principle of CRC encoding, both generating the CRC check bit and verifying the received sequence are achieved by division modulo an intermediate polynomial. The division circuit typically uses a feedback shift register, a traditional serial calculation method, which suffers from slow processing speed.
[0004] Chinese patent CN103199873A employs a hybrid structure of multi-channel and parallel bit-width to achieve fast CRC calculation. Data is segmented and input into multiple channels, and multiple processing units perform parallel calculations. Within each channel, serial calculations with parallel bit-width are used. This method requires prior knowledge of the binary information sequence length to perform multi-channel segmentation of the binary sequence, making real-time processing of binary data streams impossible. Furthermore, the fixed bit-width of the parallel bits reduces flexibility. While facilitating unified calculation and storage of the check matrix, longer parallel bit-width settings require larger check matrix storage space, while shorter parallel bit-width settings require longer serial calculation times. The time complexity of check value calculation remains sublinear, failing to meet the demands of ultra-high-speed real-time computation. Summary of the Invention
[0005] To address the shortcomings of the prior art, this invention provides a real-time recursive CRC check method and apparatus, aiming to meet the requirements of ultra-high-speed real-time computing. This invention also provides corresponding computer storage media and programs.
[0006] The technical solution of the present invention is as follows:
[0007] A real-time recursive CRC check method includes the following steps:
[0008] The real-time bitstream a1a2a3… is sequentially truncated into binary sequences S1S2…S… of non-fixed length. i …;
[0009] For each binary sequence S i Divide the subsequence into left and right equal parts to obtain a subsequence, and repeat the left and right equal division of the subsequence until the length of the final subsequence is less than a preset value;
[0010] Calculate the CRC check value and check matrix for each final subsequence, and then merge the left and right subsequences upwards level by level to obtain the final check value of the entire real-time bit stream.
[0011] Furthermore, in CRC value verification mode, it is determined whether the final verification value is all zeros. If it is all zeros, it indicates that the verification is correct; otherwise, it indicates an error.
[0012] Furthermore, in the binary sequence S i When the length is odd, in the binary sequence S i Add a "0" to the beginning of the character and then divide it into left and right parts.
[0013] Furthermore, the CRC check value C of each final subsequence N Sum of check matrices F (N) The calculation method is as follows:
[0014] This represents modulo 2 multiplication. Let B represent modulo 2 addition, N represent the length of the final subsequence, P represent the m×1 vector of coefficients of the generator polynomial, and F represent the m-order square matrix. n n = 1, 2, ..., N-1 represents F raised to the power of n in modulo 2.
[0015] The method for obtaining the final checksum of the entire real-time bitstream by merging the left and right subsequences upwards is as follows: First, merge the left and right subsequences upwards to obtain the binary sequence S. i The check value C i Sum check matrix Then all binary sequences S i The final check value R is obtained by iterative calculation of the check value and the check matrix;
[0016] When merging the left and right subsequences upwards step by step, let the left subsequence be... and right subsequence The parent sequence segment S is obtained by merging and calculating. j check value Sum check matrix
[0017] If S j The length is odd.
[0018] If S j The length is even.
[0019] All binary sequences S i When the check value and check matrix are iteratively calculated to obtain the final check value R, for the binary sequence S1S2…S… i-1 S i Its CRC check value This process is repeated sequentially until the end of the real-time bit stream to obtain the final check value R.
[0020] Another technical solution of the present invention is:
[0021] A real-time recursive CRC check device, comprising:
[0022] The truncation module is used to sequentially truncate the real-time bitstream a1a2a3… into binary sequences S1S2…S with non-fixed lengths. i …;
[0023] The equal-splitting module is used for each binary sequence S. i Divide the subsequence into left and right equal parts to obtain a subsequence, and repeat the left and right equal division of the subsequence until the length of the final subsequence is less than a preset value;
[0024] In addition, there is a calculation module, which is used to calculate the CRC check value and check matrix of each final subsequence, and merge the left and right subsequences upwards level by level to obtain the final check value of the entire real-time bit stream.
[0025] Furthermore, it includes a verification module, used to determine whether the final verification value is all zeros in CRC value verification mode. If it is all zeros, it indicates that the verification is correct; otherwise, it indicates an error.
[0026] Another technical solution of the present invention is:
[0027] A computer storage medium storing a computer program, which, when executed by a processor, implements the real-time recursive CRC check method.
[0028] Another technical solution of the present invention is as follows:
[0029] A computer program product, when executed by a processor, implements the real-time recursive CRC check method.
[0030] Compared with the prior art, the present invention has the following advantages:
[0031] Extracting real-time bitstreams of unknown length into sequences of variable length offers advantages such as flexibility and ease of parallel computation.
[0032] For each sequence segment, a recursive method is used to simultaneously solve for the check value and check matrix. The sequence segment is decomposed layer by layer to the minimum segment length before calculation, and then the check value and check matrix are calculated by backtracking layer by layer, achieving a logarithmic computation time complexity.
[0033] Each segment of the binary sequence is calculated independently, and parallel processing units can be used to further improve efficiency.
[0034] This invention fully utilizes the characteristics of CRC and adopts a combination of iterative and recursive methods to calculate the check value of variable-length binary sequence streams in real time, achieving a logarithmic computation time complexity and meeting the CRC operation requirements of real-time ultra-high-speed data streams. Attached Figure Description
[0035] Figure 1 is a flowchart of the real-time recursive CRC check method.
[0036] Figure 2 is a schematic diagram of the recursive calculation of the check value and check matrix of the binary sequence segment.
[0037] Figure 3 is a schematic diagram of the final verification value calculated by segmenting and iteratively calculating the binary sequence stream.
[0038] Figure 4 is a comparison of the computation time of the traditional serial method, the method of this invention, and the multi-channel parallel method. Detailed Implementation
[0039] The present invention will be further described below with reference to embodiments, but these are not intended to limit the scope of the invention.
[0040] The real-time recursive CRC check device in this embodiment includes:
[0041] The truncation module is used to sequentially truncate the real-time bitstream a1a2a3… into binary sequences S1S2…S with non-fixed lengths. i …;
[0042] The equal-splitting module is used for each binary sequence S. i Divide the subsequence into left and right equal parts to obtain a subsequence, and repeat the left and right equal division of the subsequence until the length of the final subsequence is less than a preset value;
[0043] The calculation module is used to calculate the CRC check value and check matrix of each final subsequence, and to merge the left and right subsequences upwards level by level to obtain the final check value of the entire real-time bit stream.
[0044] And a verification module, used in CRC value verification mode to determine whether the final verification value is all zeros. If it is all zeros, it indicates that the verification is correct; otherwise, it indicates an error.
[0045] The real-time recursive CRC check method implemented by this real-time recursive CRC check device is as follows:
[0046] First, for a real-time bitstream a1a2a3…, its corresponding generator polynomial G(X)=p m X m +p m-1 X m-1 The coefficients of …+p1X+p0 yield an m×1 vector P and an m-order square matrix F, i.e.
[0047] Then, as shown in Figure 1, the following steps are included:
[0048] Step 1: Extract binary sequences S1S2…S from the real-time bit stream a1a2a3… in sequence, regardless of their length. i …
[0049] Step 2: Calculate each binary sequence segment S using a recursive method. i The check value C i Sum check matrix
[0050] Step 3: Iteratively calculate the check value and check matrix of each segment to obtain the final check value R.
[0051] Step 4: Determine the verification result based on the working mode and the final verification value R.
[0052] Referring to Figure 2, in step 2, the binary sequence segment S... i The check value C i Sum check matrix It is obtained through recursive synchronous computation, as detailed below:
[0053] Step 2.1: If the binary sequence segment S i The length L is odd, S i After adding one zero to the first part, the two parts are divided equally. If S i If the length is even, it is directly bisected. The left and right subsequences of the bisected sequence are: and
[0054] Step 2.2: As described in Step 2.1, continue to divide the left and right subsequences equally until the length N of the subsequence is less than the set minimum value, that is, the minimum segment length for CRC value calculation.
[0055] Step 2.3: Calculate the binary sequence segment B of length N = [b1b2…b N The check value C N Sum of check matrices F (N) ,
[0056] symbol Modulo 2 multiplication, symbol This represents modulo 2 addition.
[0057] Step 2.4: Left subsequence with minimum segment length and right subsequence The parent sequence segment S is obtained by merging and calculating. j check value Sum check matrix
[0058] If S j The length is odd.
[0059] If S j The length is even.
[0060] Step 2.5: As described in Step 2.4, obtain the sequence segment S. j By using the checksum and check matrix of the parent sequence, and tracing back layer by layer upwards, the sequence segment S is finally obtained. i The check value C i Sum check matrix
[0061] Referring to Figure 3, in step 3, the final check value R is obtained by iterative calculation based on the check value of each segment and the check matrix. The specific details are as follows:
[0062] Step 3.1: Using the check value C1 of the binary sequence segment S1 and the check matrix... The check value R1 = C1 can be obtained for the binary sequence S1;
[0063] Step 3.2: Using the check value C2 of the binary sequence segment S2 and the check matrix... The check value of the binary sequence S1S2 can be obtained.
[0064] Step 3.3: Iterative calculation yields the binary sequence S1S2…S i-1 The CRC check value is R i-1 ;
[0065] Step 3.4: From binary sequence segment S i The check value C i Sum check matrix The binary sequence S1S2…S can be obtained. i-1 S i CRC check value
[0066] Step 3.5: Ri With the next sequence segment S i+1 The check value C i+1 Sum check matrix Calculate and obtain The final checksum R is obtained until the real-time bitstream ends.
[0067] Step 4 determines the verification result based on the working mode and the final verification value R. Specific details are as follows:
[0068] If the mode is to generate a CRC checksum, the value of R is the generated CRC checksum; if the mode is to verify a CRC checksum, the value of R is all zeros, indicating a correct verification, otherwise an error occurs.
[0069] The following example uses a specific real-time bitstream sequence a1a2a3… to illustrate the difference in computation time between the traditional serial method, the method of this invention, and the multi-channel parallel method (CN103199873A). The encoding length of this real-time bitstream a1a2a3… is m = 8, and the generator polynomial G(x) = X 8 +X 7 +X 4 +X 3 +X+1, the transmitted sequence is a bit string of length 40000, 1010…1010, where 10 appears alternately. In the method of this invention, the upper limit of the minimum segment length is set to 5, that is, N≤5, and the number of channels in the multi-channel parallel method is set to 4.
[0070] When generating CRC checksums, the parallel bit width for multi-channel parallel processing is set to 10000. When verifying CRC checksums, the processing sequence a1a2a3…r is used. m …r1 has a length of 40008 and a parallel bit width of 10002.
[0071] Based on the generator polynomial G(x), we can obtain
[0072] In step 1, the processed binary sequence is divided into four equal parts. When generating the CRC check value, S i The length is 10000. When verifying the CRC check value, S i The length is 10002.
[0073] When generating the CRC checksum, the final checksum R is 11010111, which is the checksum of the 40000-bit bit string 1010…1010. The binary bit string and the checksum are concatenated to form 1010…101011010111 to generate the transmission sequence. When verifying the CRC value, the final checksum R is 00000000, indicating that the transmission sequence was received without errors.
[0074] As shown in Figure 4, the three computation methods have different time consumption orders. The traditional serial method is the most time-consuming, the multi-channel parallel method reduces the time consumption by one order of magnitude, and the method of this invention reduces the time consumption by another order of magnitude. The reduction in time consumption is mainly determined by their linear, sublinear, and logarithmic computational complexities.
[0075] Finally, it should be noted that the specific methods of the above embodiments can form a computer program product. Therefore, the computer program product implemented in this application can be stored on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.).
Claims
1. A real-time recursive CRC check method, characterized in that, Includes the following steps: The real-time bitstream a1a2a3… is sequentially truncated into binary sequences S1S2…S… of non-fixed length. i …; For each binary sequence S i Divide the subsequence into left and right equal parts to obtain a subsequence, and repeat the left and right equal division of the subsequence until the length of the final subsequence is less than a preset value; Calculate the CRC check value and check matrix for each final subsequence, and merge the left and right subsequences upwards level by level to obtain the final check value of the entire real-time bit stream; The CRC checksum C for each final subsequence N Sum of check matrices F (N) The calculation method is as follows: F (N) =F N-1 ; This represents modulo 2 multiplication. Let B represent modulo 2 addition, N represent the length of the final subsequence, P represent the m×1 vector of coefficients of the generator polynomial, and F represent the m-order square matrix. n n = 1, 2, ..., N-1 represents F raised to the power of n in modulo 2. The method for obtaining the final checksum of the entire real-time bitstream by merging the left and right subsequences upwards is as follows: First, merge the left and right subsequences upwards to obtain the binary sequence S. i The check value C i Sum check matrix Then all binary sequences S i The final check value R is obtained by iterative calculation of the check value and the check matrix; When merging the left and right subsequences upwards step by step, let the left subsequence be... and right subsequence The parent sequence segment S is obtained by merging and calculating. j check value Sum check matrix If S j The length is odd. If S j The length is even. All binary sequences S i When the check value and check matrix are iteratively calculated to obtain the final check value R, for the binary sequence S1S2…S… i-1 S i Its CRC check value This process is repeated sequentially until the end of the real-time bit stream to obtain the final check value R.
2. The real-time recursive CRC check method according to claim 1, characterized in that, In CRC check mode, it is determined whether the final check value is all zeros. If it is all zeros, it indicates that the check is correct; otherwise, it indicates an error.
3. The real-time recursive CRC check method according to claim 1, characterized in that, In binary sequence S i When the length is odd, in the binary sequence S i Add a "0" to the beginning of the character and then divide it into left and right parts.
4. A real-time recursive CRC check device, characterized in that, include: The truncation module is used to sequentially truncate the real-time bitstream a1a2a3… into binary sequences S1S2…S with non-fixed lengths. i …; The equal-splitting module is used for each binary sequence S. i Divide the subsequence into left and right equal parts to obtain a subsequence, and repeat the left and right equal division of the subsequence until the length of the final subsequence is less than a preset value; And, a calculation module, used to calculate the CRC check value and check matrix of each final subsequence, and to merge the left and right subsequences upwards level by level to obtain the final check value of the entire real-time bit stream; The CRC checksum C for each final subsequence B Sum of check matrices F (B) The calculation method is as follows: F (B) =F B-1 ; This represents modulo 2 multiplication. Let B represent modulo 2 addition, N represent the length of the final subsequence, P represent the m×1 vector of coefficients of the generator polynomial, and F represent the m-order square matrix. b n = 1, 2, ..., N-1 represents F raised to the power of n in modulo 2. The method for obtaining the final checksum of the entire real-time bitstream by merging the left and right subsequences upwards is as follows: First, merge the left and right subsequences upwards to obtain the binary sequence S. i The check value C i Sum check matrix Then all binary sequences S i The final check value R is obtained by iterative calculation of the check value and the check matrix; When merging the left and right subsequences upwards step by step, let the left subsequence be... and right subsequence The parent sequence segment S is obtained by merging and calculating. j check value Sum check matrix If S j The length is odd. If S j The length is even. All binary sequences S i When the check value and check matrix are iteratively calculated to obtain the final check value R, for the binary sequence S1S2…S… i-1 S i Its CRC check value This process is repeated sequentially until the end of the real-time bit stream to obtain the final check value R.
5. The real-time recursive CRC check device according to claim 4, characterized in that, It includes a verification module, which is used to determine whether the final verification value is all zeros in CRC value verification mode. If it is all zeros, it indicates that the verification is correct; otherwise, it indicates an error.
6. The real-time recursive CRC check device according to claim 4, characterized in that, The module is divided in binary sequence S i When the length is odd, in the binary sequence S i Add a "0" to the beginning of the character and then divide it into left and right parts.
7. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the real-time recursive CRC check method according to any one of claims 1 to 3.
8. A computer program product, characterized in that, When the computer program product is executed by the processor, it implements the real-time recursive CRC verification method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Rapid configuration method for two-stage CRC (Cyclic Redundancy Check) operation
CN103199873A
Density evolution based polarization code constructing method and polarization code coding and decoding system
CN105811998A
Segmented cyclic redundancy check method for polarization codes
CN106230555A
Real-time recursive CRC (Cyclic Redundancy Check) method and device, computer storage medium and program
CN119070829A
High performance CRC calculation with small footprint
US20150318867A1