Cyclic Redundancy Check (CRC)

Redundancy

CRC check and the like Hamming, also valid information (k bits) + check information (r bits) is necessary to satisfy N = K + r≤2 R & lt -1

 

Generating polynomial G (X)

It is defined : a transceiver mutually agreed upon a (r + 1) bit binary number, the sender using a G (X) to make the information polynomial modulo 2 addition operation to generate a checksum. Recipient using G (X) encoding the received polynomial modulo 2 operator to make the error detection and error locator addition.

 

To meet the conditions:

  1. Highest and lowest bit must be 1;
  2. When any one message is transmitted (CRC code) error occurs, except by the generator polynomial should do after the remainder is not 0;
  3. Different bit error occurs, the mold 2 after the addition remainder operation different;
  4. For the remainder is not 0 proceed modulo 2 addition operation cycles should be the remainder.

Get the generator polynomial

From the highest power-reduction start position, then there is 1 is not 0

E.g:

G (x) polynomials G(x)
x3+x+1(x0) 1011
x3+x2 1100
x4+x2+1 10101

When using G (X) to make the information polynomial modulo 2 addition operation, the principle of operation (actually calculating an exclusive OR operation)

  1. The first portion of the remainder of 0 is 1, List 1, the number of subtraction; (beginning and the remainder is 1, then the other one)
  2. Remainder of the first number is 0, the quotient is zero, minus 0 (the beginning of the remainder is 0, the quotient is zero, below minus 0)
  3. When the rest of a number of bits smaller than the number of the divisor, the last remainder is the remainder. (End calculation conditions)

 

 

By an example to become familiar with the process

The four valid cyclic redundancy check code compiled information 1001, selecting a generator polynomial x3 + x1 + x0, Write the encoding process

1. In accordance with a generator polynomial, to obtain G (x) = 1011

2. Effective information is 4 bits, k = 4, into the formula r≤2 + K R & lt -1, to give r≥3

3. First, temporarily add redundancy code bit r 0 of the effective back information 1001, i.e. 1001000, 1001000/1011 calculated to obtain the remainder 110

4. Alternatively remainder valid redundancy information later, it becomes 1001110

 

remainder

The dislocation

(A 7 A 6 A 5 A 4 A 3 A 2 A 1 )

000 no
001 7
010 6
100 5
011 4
110 3
111 2
101 1

 

 

When transferring data, if the transmission of data over the past two-mode operation, to obtain the remainder is not 0, the data changes, our comparison table, which one changes occur can be obtained by the remainder.

For example, if we obtain the transmission data is 1001111, we divided by G (x)

 

 The remainder of division 101, check the table is the first error.

 

Guess you like

Origin www.cnblogs.com/Mayfly-nymph/p/11100021.html