Cyclic redundancy code

1. Meaning

Cycle redundancy code, also known as a plural style code. The working method of the CRC is to generate a redundancy code at the transmitting end, and the information is sent to the receiving end together, and the information received by the receiving end is verified by the same algorithm in the transmitting end, if the error is found, Then notify the sender retransmission.

In the field of data storage and data communication, in order to ensure the correct data is correct, the error detection means must be used. In many error-wrong means, CRC is the most famous one. Its features are: extremely detected, small overhead, easy to use encoder and detection circuit. From its error detection ability, the chance of mistakes that it cannot be found is only 0.0047% or less. From performance and overhead, it is far better than parity and arithmetic and check. Thus, in the field of data storage and data communication, the CRC is unwitten: the famous communication protocol X.25 FCS (frame error detection sequence) is adopted by CRC-CCITT, WinRAR, Nero, ARJ, LHA and other compression tool software adopted It is CRC32 and the disk drive read and write uses CRC16, universal image storage formats GIF, TIFF, etc. also uses CRC as an error mean.

CRC The nature is the remainder of the mold-2 division, and the divisor is different, and the type of CRC is different. Typically, the divisor of the CRC is represented by a generated polynomial.

According to the application environment and habits, CRC can be divided into the following criteria:

1) CRC-12 yard;

2) CRC- 16 yards;

3) CRC-CCIT code;

4) CRC-32 code.

CRC-12 code is usually used to transmit 6-bit string.

CRC-16 and CRC-CCITT code are used to transmit 8-bit strings, where CRC-16 is adopted in the United States, while CRC-CCITT is used in European countries. The CRC-32 code is mostly in a synchronous transmission called Point-to-point.

2. Basic principle to generate the CRC code

Any code consisting of a binary bit string can be used only of the factor only '0' and '1'. One-way. For example, the polynomial corresponding to the code 1010111 is X6 + X4 + X2 + X + 1, and the polynomial is the code 101111 corresponding to X5 + X3 + X2 + X + 1.

Cyclic redundancy code

Common CRC cycle redundancy check standard polynomial is as follows:

CRC (12 bits) = x ^ 12 + x ^ 11 + x ^ 3 + x ^ 2 + x + 1

CRC (16 bits) = x ^ 16 + x ^ 15 + x ^ 2 + 1

CRC (ccitt) = x ^ 16 + x ^ 12 + x ^ 5 +1

CRC (32-bit) = x ^ 32 + x ^ 26 + x ^ 23 + x ^ 22 + x ^ 16 + x ^ 12 + x ^ 11 + x ^ 10 + x ^ 8 + X ^ 7 + x ^ 5 + x ^ 4 + x ^ 2 + x + 1

Take the CRC (16-bit) polynomial as an example, and its corresponding check binary bit is 1 1000 0000 00000101.

The coefficients of each of the polynomials are binary, and the four operations involved still follow the calculation rules of the second mold.

(Note: The four operations refer to the two-model two bits between the two binary numbers involved in the calculation, the XOR is different or calculated, namely: 1 xor 1 = 0, 0 XOR 0 = 0, 1 xor 0 = 1, 0 xor 1 = 1, that is, the same is 0, different is 1)

3. Principle

if set The codeword length is n, the information field is k bit, the check field is R bit (n = k + r), then for the CRC code, any code word, exist and only one R times polynomial G (x), makes V (x) = a (x) g (x) = XRM (x) + R (x); wherein: m (x) is k time information polynomial, R (X) is R-1 check polynomial, g ( X) is called generating polynomial: g (x) = g0 + g1x + g2x2 + ... + g (r-1) x (r-1) + GRXR sender generates CRC code words by specified G (X), receive Based on the G (x) to verify the received CRC codeword.

4. CRC check code software generation method

The remaining number is the check field by means of a polynomial division. For example: Information field code is: 1011001; Corresponde M (x) = x6 + x4 + x3 + 1 hypothesis generated polynomial: g (x) = x4 + x3 + 1;, the corresponding g (x) code is: 11001x4m ( x) = X10 + x8 + x7 + x4 Corresponding code is: 10110010000; Adjustable division: The number of density is: 1010 (ie the calibration field is: 1010) Send party: The transmitted transmission field is: 10110011010 Information field verification Field Receiver: Use the same generation code to check: The received field / generation code (binary division) If it can be removed, it is correct, gives the calculation steps of the remainder (1010): division without mathematical meanings, and It is a model of the computer, that is, the divisor and the divisor are different or calculated 10110010000/11001 = 111101111011100 = 1010

5. Features

If the generated polynomial selection is properly selected, the CRC is one Very effective error check method. In theory, the error detection capability of the cyclic redundant check code can be proved that the following features:

1) All odd errors can be detected;

2) can detect all double bits Error;

3) You can detect a continuous error that is less than or equal to the length of the calibration bit;

4) Detects a continuous error greater than the length of the check bit with considerable probability .

Related Articles
TOP