Vous êtes sur la page 1sur 4

CRC

12,16 Jul. 2013

1 Generating a Frame with CRC at the Sending DLC


Consider a message of n bits given by M = [bn1 , bn2 , , b0 ], where bi {0, 1}, i = 0, 1, , n 1. Note that the bit string M can be represented by a polynomial with bi as the coefcient of xi . Thus, we dene the message polynomial
n 1

M( x ) :=

i =0

bi x i .

To the message bits, we wish to append a kbit CRC R = [rk1 , rk2 , , r0 ] generated using a generator polynomial C ( x ) of degree k. The CRC polynomial R( x ) (that represents R) is obtained as follows: R( x ) := Remainder M( x) xk C(x) .

Since the degree of C ( x ) is k, the degree of R( x ) can be at most k 1. The transmitting node generates a frame P = [bn1 , bn2 , , b0 , rk1 , rk2 , , r0 ], which is represented by the polynomial P ( x ) = M ( x ) x k + R ( x ).

Errors Caused by Channel

Any bits can be corrupted, and for each i = 0, 1, , n + k 1 let ei = 1 indicate that ith bit is received in error, and ei = 0 indicate noerror. Thus, the error vector is given by E = [en+k1 , en+k2 , , e0 ], which is represented by the polynomial E( x ). Note that the receiver receives P( x ) = P( x ) + E( x ).1 Note that the receiver knows only P( x ) (i.e., it does not know P( x ) and E( x ) separately).

Error Detection at the Receiving DLC


P( x ) C(x)

The receiving DLC does the following operation: D(x)


1. In this note, + denotes modulo 2.

:=

Remainder

Note that if there was no error, i.e., E( x ) = 0, then D ( x ) = 0. Thus, the receiving DLC accepts the frame as errorfree if D ( x ) = 0, and rejects the frame if D ( x ) = 0.

Error Detecting Capability of CRC


1. Does it detect all 1 bit errors? 2. Does it detect all 2 bit errors? 3. Does it detect all odd number of bit errors? 4. What is the maximum error burst that can be detected? 5. What is the probability that a random bit string of length n + k is accepted by the receiving DLC?

To analyse the error detecting capability of CRC, we pose the following questions:

We note here that there can be 2k choices for a polynomial of degree k, of which some choices for CRC are pretty bad; for example, C ( x ) = xi for some i = 0, 1, , k. Our interest is in showing the properties of good C ( x ) that answers satisfactorily all the ve questions we posed.

4.1

Detecting 1 Bit Errors

For one bit errors, E( x ) = xi for some i = 0, 1, , n + k 1. We choose the following choice for C ( x ): C ( x ) = x k + + 1. Suppose C ( x ) divides E( x ). Hence,2 x i = ( x ) ( x k + + 1). Let be the degree of ( x ). Thus, in the RHS, there are at least two terms x k+ and x , whereas in the LHS there is only one term, which is a contradiction. Hence, C ( x ) does not divide xi for any i. Thus all one bit errors are detected.

4.2

Detecting 2 Bit Errors

For two bit errors, E( x ) = xi + x j for some i, j {0, 1, , n + k 1}, i = j. Without loss of generality, let j < i. Hence, E( x ) = x j ( xi j + 1). We choose C ( x ) = x k + + 1, and hence, x j is not divisible by C ( x ). Thus, E( x ) is divisible by C ( x ) if x p + 1 is divisible by C ( x ) for some p = 1, 2, , n + k 1. Peterson and Davie says that if C ( x ) has a factor with at least 3 terms, then all two bits are detected. A Counterexample: Consider n = 5, k = 3, and C ( x ) = ( x2 + x + 1)( x + 1) = x3 + 1. Note that C ( x ) satises the requirement stated by Peterson and Davie. However, if E( x ) = x3 + 1, then it is
2. Throughout this note, ( x ) denotes a polynomial.

divisible by C ( x ) (yielding a remainder of zero), and hence, a two bit error at the zeroth and third bit positions go undetected! The following argument works out for two bit errors! We want a polynomial C ( x ) = x k + + 1 such that it does not divide the following polynomials: x + 1, x2 + 1, , x n+k1 + 1. From the theory of nite elds, one can show that there exists polynomials of the form x h + 1 that are divisible by C ( x ); also, let m be the lowest degree of these polymonials, i.e., m = min h : x h + 1 is divisible by C ( x ) . The theory of nite elds, also, say that m 2k 1.

Also, there exists polynomials of degree k such that the mvalue of these polynomials is exactly 2k 1. Such polynomials are called primitive polynomials. We choose a primitive polynomial (which has the form x k + + 1) for C ( x ). Thus, all two bit errors x + 1, x2 + 1, , x m1 + 1 are detected. Note that m = 2k 1, or x m1 + 1 = k x2 2 + 1. Thus, we require 2k 2 n + k 1 to detect all the two bit errors in a frame of length n + k. This is possible, if we choose the frame length n + k 2k 1.

4.3

Detecting All Odd Number of Errors

Here E( x ) has odd number of terms. We choose C ( x ) = ( x + 1)( x k1 + + 1). Claim: C ( x ) = ( x + 1)( x k1 + + 1) corrects odd number of errors. As usual, we show the property by contradiction. Suppose C ( x ) divides E( x ), and let the quotient be ( x ). Thus, E( x ) = ( x + 1)( x k1 + + 1)( x ) Note that the RHS has even number of terms whereas the LHS has odd number of terms, which is a contradiction. Hence, C ( x ) does not divide E( x ).

4.4

Burst Error Detecting Capability

A burst of errors of length b is dened as E( x ) = xi+b1 + xi+b2 + + xi , for some i = 0, 1, , n + k b. Note that x i ( x b + 1) E( x ) = x+1

As usual, we suppose that E( x ) is divisible by C ( x ) = x k + + 1. Thus, C ( x ) divides (as it does not divide xi ). Therefore, xb + 1 x+1 or, x b + 1 or, x + 1
b

x b +1 x +1

= C ( x )( x ) = ( x + 1)( x k + + 1)( x ) = ( x k +1 + + 1 ) ( x )
k can

The degree of the polynomial on the RHS is at least k + 1. Hence, any burst of length b be detected.

4.5

Probability of a Random Bit String Being Accepted

There are 2n+k bit strings of length n + k, each of which can be chosen with probability 2(n+k) . In the random string chosen, there can be only one kbit CRC out of 2k choices. Hence, we have P {Random string being accepted} = 2n+k 1 1 = 2 k . 2n + k 2k

Vous aimerez peut-être aussi