To check the communication reliability, You Need To 'check'. The verification is performed from the data itself. It relies on a certain form of mathematical conventions for inspection. The verification result is reliable or unreliable, if it is reliable, the data will be processed. If it is not reliable, it will be discarded for re-transmission or repair.
The CRC code is composed of two parts. The first part is the Information Code, that is, the information to be verified, and the latter part is the verification code. If the CRC code has a total length of N bits, the Information Code is K bits, it is called the (n, k) code. Its Encoding Rules are:
1. First, shift the original information code (kbit) to the left (K + R = N)
2. Use a generated polynomial g (x) (which can also be regarded as a binary number) to divide the formula above with mod 2, and the remainder is the verification code.
It is very simple. It should be noted that MoD 2 Division is the addition of mod 2 in the division process. mod 2 addition is actually an exclusive or operation we are familiar with, that is, the addition does not consider carry. The formula is:
0 + 0 = 1 + 1 = 0 + 0 = 0 + 1 = 1
That is to say, 'ise' is true, while 'nonise' is false.
The obtained theorem is as follows: A + B + B = A, that is, the 'modulo 2 shares' AND THE 'modulo 2 add' direct value table are identical.
With addition and subtraction, the modulo 2 division can be defined, and the CRC check code can be generated using the generated polynomial g (x.
For example, g (x) = X4 + X3 + X2 + 1, (110), the CRC code generated by information code is:
101
11101 |
111 01
1 0100
1 1101
1001
The remainder is 1001, so the CRC code is
The standard CRC code is, CRC-CCITT and CRC-16, and their generative polynomials are:
CRC-CCITT = x16 + X12 + X5 + 1
CRC-16 = x16 + x15 + X2 + 1
Set the original information polynomial Before encoding to p (x), the maximum power of P (x) plus 1 equals K, the generated polynomial to G (x), g (x) the maximum power of is equal to R; the CRC polynomial is R (x); the encoded information polynomial with CRC is T (X ).
Sender's encoding method: multiply p (x) by XR (that is, the corresponding binary code sequence shifts the r bit left) and divide it by G (x). The obtained remainder is R (X ). Expressed
T (x) = xrp (x) + R (X)
Receiver decoding method: Divide T (x) by G (x). If the remainder is 0, no error occurs during transmission. Otherwise, the transmission is incorrect.
The division of Modulo 2 is similar to the division of arithmetic division, but the result of Division (subtraction) of each bitwise does not affect other bitwise, that is, it does not take the last bitwise. So it is actually an exclusive or. Then shift the shift to reduce the modulo 2 of the next position. The procedure is as follows:
A. Use the divisor to perform a modulo 2 reduction on the maximum number of divisor digits without any borrow space.
B. Remove one digit from the right. If the maximum remainder is 1, the quotient is 1, and the remainder is reduced by 2. If the remainder is 0, the quotient is 0, and the divisor is shifted to the right.
C. When the number of digits of the remainder is smaller than the divisor, the remainder is the final remainder. The Division in CRC is not a simple binary division. The result calculated by the calculator in the non-credit attachment is different from the result.
The binary division of CRC is as follows:
1111000 dividend
1101 Divisor
----
The number of divisor digits is 1.
More than 0010 (the difference between the first four digits of the divisor and the divisor)
----
100 remove the number of delimiters by 5th
1101 Divisor
----
Division not enough, business 0
1000 remove the number of delimiters by 6th
1101 Divisor
----
The number of divisor digits is 1.
More than 0101 (still exception or)
----
1010 remove the number of delimiters by 7th
1101 Divisor
----
The number of divisor digits is 1.
More than 0111 (still exception or)
----
Total number of delimiters: 7
As a result, we got 1011 million vendors, and the remaining 111 million