Cyclic Codes for Error Detection - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Cyclic Codes for Error Detection

Description:

Presented by Ian Strascina 11/7/03. Why do we need Error Detection/Correction??? We want messages/values to remain ... We want our astronauts to return safely! ... – PowerPoint PPT presentation

Number of Views:173
Avg rating:3.0/5.0
Slides: 43
Provided by: ianstr5
Category:

less

Transcript and Presenter's Notes

Title: Cyclic Codes for Error Detection


1
Cyclic Codes for Error Detection
  • W. W. Peterson and D. T. Brown

Presented by Ian Strascina 11/7/03
2
Why do we need Error Detection/Correction???
  • We want messages/values to remain correct if
    something corrupts them, or at least know there
    was an error to try to fix it
  • The following is a practical example

3
(No Transcript)
4
(No Transcript)
5
(No Transcript)
6
(No Transcript)
7
(No Transcript)
8
X
BAD!!!
Shuttle

9
(No Transcript)
10
v
GOOD
11
Error Detecting vs. Error Correcting
  • Error Detecting no correction
  • appropriate for communication-like environments
  • data can be resent if necessary
  • more efficient, useful for serial
  • Error Correcting corrects corrupted data
  • appropriate for memory-like environments
  • less efficient, useful for parallel

12
Relationship between them
  • Error detection is used for error correction
  • A code can detect 2t errors ? It can correct t
    errors
  • Example Take t1 (can detect 2 errors, can
    correct 1 error)
  • ? Assume code can detect 2 errors
  • To correct one error, it could just try flipping
    bits until it was found If any bit other than
    the actual error was flipped, it would create a
    2nd error bit, which it can detect by assumption
  • ? Assume code can correct 1 error
  • To be shown, but not at all based on the
    assumption (theorem 3)

13
Polynomial representation of bit strings
  • Coding a k-bit message by appending n-k check
    bits and transmitting all n of them together
  • Convenient to think of a bit string as a
    polynomial of the dummy variable X (even though
    we know X2)
  • Example
  • The bit string
  • can be represented
  • by the polynomial

110101
101011
1XX3X5
X5X3X1
14
Polynomial representation of bit strings
  • Normal rules of algebra apply to polynomials,
    except we will use modulo 2 addition (? addition
    modulo 2)
  • addition/subtraction w/o carry/borrow (resp.)
  • Thus
  • 1Xa 1Xa 0Xa 1Xa 0Xa 1Xa 0Xa 1Xa
  • 0Xa 0Xa 0Xa -1Xa 1Xa

15
Polynomial representation of bit strings
  • Simple examples of addition and multiplication
    (resp.)
  • X3 X1 X1
  • X2X1 X1
  • X3X2 X1
  • X2X___
  • X2 1
  • This corresponds to the binary operation
  • Associativity, Distributivity, Commutativity, and
    Unique factorization of primes also hold

XOR!!!
16
A little math review/preview
  • The degree of polynomial is the largest exponent
    which appears in the polynomial with a non-zero
    coefficient
  • a b read a divides b if there exists an
    integer q s.t. b aq
  • Thus 6 12 (for q2)
  • However, 12 does not divide 6 (there is no q s.t.
    6 12q), but 12 is divisible by 6. Confused
    yet?
  • Let ngt0, a?Z, then ?! q,r?Z s.t. aqnr, 0rltn
    (division algorithm)
  • (G, ?) is a group (in the domain G) under the
    operation ? if
  • G is closed under ?
  • ? is associative
  • identity inverse exist in domain
  • (Z,) is a group, but (Z,) is not
  • More on groups??? Take Math 331

17
Cyclic Codes
  • Cyclic code defined in terms of a generator
    polynomial P(X) of degree n-k
  • A polynomial of degree n is a code ? it is
    divisible by P(X)
  • Cyclic codes form a group with an added property
    the cyclic shift of a code vector is also a
    code vector
  • Group? Let C(X)D(X)P(X) and F(X)G(X)P(X)
    W(X)Z(X)P(X) be codes
  • C(X)F(X) (D(X)G(X))P(X) still a code
  • (C(X)F(X))W(X) ((D(X)G(X))Z(X))P(X)
    (D(X)(G(X)Z(X)) )P(X) C(X)(F(X)W(X))
  • Identity is 0 A codes inverse is itself
  • Consider only codes for which P(X) is not
    divisible by X (important for rest of paper!!!)
  • if it is, P(X) (and all codes) will have X0 0
  • This (coefficient) is useless as it gives no
    information

18
Cyclic Codes
  • Could form a code poly. by multiplying any poly.
    C(X) (s.t. degree(C(X)) lt k) by P(X)
  • More advantageous multiplying message poly.
    G(X) by Xn-k, divide this by P(X) and
    add(subtract) the remainder R(X) to the result of
    the multiplication
  • Xn-kG(X) Q(X)P(X) R(X) or
  • F(X) Xn-kG(X) R(X) Q(X)P(X)
  • F(X) code poly. Q(X) quotient of division
  • Since degree(P(X)) n-k, degree(R(X)) lt n-k (by
    division alg.)
  • Xn-kG(X) has zeros in n-k lowest order positions
  • So F(X) has coefficients of R(X) in the low order
    n-k positions (check bits) and coefficients of
    G(X) in the k highest-order positions (message
    bits)

F(X) G(X) R(X), degree(F(X))n k positions
n-k positions
19
Cyclic Codes
  • Example take n8, k5, n-k3
  • Take P(X) X3X1 (1011) and G(X) X4X2X1
    (10111)
  • Xn-kG(X) X3(X4X2X1) X7X5X4X3
  • Xn-kG(X) / P(X) (X41) (X1) (long division
    omitted)
  • Xn-kG(X) (X41)(X3X1) (X1)
  • Q(X) P(X) R(X)
  • F(X) Xn-kG(X) R(X) X7X5X4X3X1
    (10111011)
  • message check

20
Principles of Error Detection/Correction
  • Can represent an encoded message containing
    errors by
  • H(X) F(X) E(X)
  • Where F(X) is the correct message and E(X) has a
    term for each erroneous position
  • As previously stated, a code poly. is one that is
    divisible by P(X)
  • Thus, if P(X) does not divide H(X), then clearly
    H(X) has one or more errors
  • Since we already know P(X) divides F(X), it is
    enough to show that P(X) does not divide E(X)
  • Good checks will make sure that no E(X) we wish
    to detect is divisible by P(X)

21
Principles of Error Detection/Correction
  • So to look for errors, we can just divide H(X) by
    P(X)
  • if remainder is not zero, we found an error
  • if it is zero, then either no errors or
    undetectable errors exist
  • Example Take P(X) X3X1 from last example,
    let
  • F(X) X5X2X1 (X21)P(X) 100111
  • E(X) X4 010000
  • H(X) X5 X4X2X1 110111
  • We get the remainder of H(X)/P(X) is X2X
  • This is the same result as E(X)/P(X)

22
Error Detection Schemes
  • Single-Error Detection
  • Double- and Triple-Error Detection
  • Burst-Error Detection
  • Detecting Two Bursts of Errors
  • Implementation

23
Detection of Single Errors
  • Theorem 1 A cyclic code generated by a
    polynomial P(X) with more than one term detects
    all single errors.
  • Proof An error at the ith position of an encoded
    message it represented by the error poly. E(X)
    Xi. To detect this, we must only show the P(X)
    does not divide Xi or Xi ? P(X)Q(X) for some
    poly. Q(X). Clearly, we can find no such Q(X) if
    P(X) has more than one term
  • The simplest such P(X) is X1.

24
Detection of Single Errors
  • Theorem 2 Every polynomial divisible by X1 has
    an even number of terms
  • Proof Let F(X) XaXbXn (X1)Q(X)
  • If we evaluate F with X1, we get
  • F(X) 111 (11)Q(1) 0
  • Since the result is 0, then there must have been
    an even number of terms for the additions (xors)
    to equal 0.
  • Corollary 1 The term X1 can detect any odd
    number of errors, acting as a parity check to
    ensure an even number of ones
  • Corollary 2 If a polynomial has a term Xc1 then
    it can detect any odd number of errors, since
    Xc1 (X1)(Xc-1Xc-21).

25
Detection of Double and Triple Errors
  • Definition A poly. P(X) is said to belong to an
    exponent e if e is the least positive integer
    s.t. P(X) divides Xe1.
  • Theorem 3 A code generated by the poly. P(X)
    detects all single and double errors if the
    length n of the code is no greater than the
    exponent e to which P(X) belongs
  • Proof Two errors are represented by the error
    poly. E(X) Xj Xi (iltj). So we must show P(X)
    does not divide Xj Xi. We can factor Xj Xi
    into Xi(Xj-i1). P(X) is assumed not to be
    divisible by X (and thus Xi), so we only need to
    show P(X) does not divide Xj-i1. Since j-iltne,
    cleary P(X) cannot divide Xj-i1. So this code
    can detect 2 errors. Since P(X) not divisible by
    X and certainly not just be the constant 1, it
    has more than one term. Thus, by theorem 1 it
    detects single errors also.

26
Detection of Double and Triple Errors
  • Definition It can be shown (dont know how???)
    that for any m there exists at least one poly.
    P(X) of degree m that belongs to e2m-1. This is
    the maximum possible value for e. These type of
    polys. are called primitive polys. and are always
    irreducible.

27
Detection of Double and Triple Errors
  • For any m, there is a double-error detecting code
    of length n2m-1 generated by a poly. P(X) of
    degree m. The code thus has m check bits and
    2m-1-m message bits. These can be shown (not by
    me) to be equivalent to single-error correcting
    Hamming codes

28
Detection of Double and Triple Errors
  • Theorem 4 A code generated by P(X) (X1)P1(X)
    detects all single, double, and triple errors if
    the length n of the code is no greater than the
    exponent e to which P1(X) belongs.
  • Proof The factor X1 detects all single and
    triple errors by theorem 2. The double errors
    are caught because P1(X) belongs to e and ne, as
    we just saw in theorem 3.
  • If P1(X) is a primitive poly., a code of maximal
    length is produced. These are equivalent to
    single-error correcting, double-error detecting
    (SECDED) Hamming codes.

29
Detection of Burst-Errors
  • Definition A burst-error of length b is any
    pattern of errors for which the number of symbols
    between the first and last errors (inclusive) is
    b.
  • Thus for E(X)
  • X31 (1001), X3X1 (1011),
  • X3X21 (1101), X3X2X1 (1111)
  • all have burst-errors of length 4, even though
    they contain a different number of errors.
  • For bgt3, there are 2b-2 different possible error
    polys. of burst-length b.
  • It also follows that for any b, there are a total
    of 2b-1 different error polys. of burst-length b

30
Detection of Burst-Errors
  • Theorem 5 Any cyclic code generated by a poly.
    P(X) of degree n-k detects any burst-error of
    length b n-k.
  • Proof We can factor any burst-error into XiE1(X)
    and degree(E1(X)) is b-1. This burst can be
    detected if P(X) does not divide E(X). P(X) is
    already assumed to not divisible by X (and
    therefore Xi), so we must show P(X) does not
    divide E1(X). We know degree(E1(X)) is b-1,
    which is at most n-k-1. P(X) is assumed to be of
    degree n-k. Since P(X) is of a higher degree
    than E1(X), P(X) clearly cannot divide it.
  • Next, we show that some bursts of length bgtn-k
    can even be detected

31
Detection of Burst-Errors
  • Theorem 6 The fraction of bursts of length bgtn-k
    that are undetectable is
  • 2-(n-k) if bgtn-k1, 2-(n-k-1) if bn-k1
  • Proof Error poly. is E(X) XiE1(X) where
    degree(E1(X)) b-1. We know E1(X) has the terms
    Xb-1 and X0 with b-2 terms in between. Each of
    these could have a coefficient of either 0 or 1,
    so there are 2b-2 different polys. for E1(X). We
    can only detect this error if P(X) divides E1(X)
    (E1(X) P(X)Q(X) for some poly. Q(X)). Since
    P(X) has degree n-k then Q(X) must have degree
  • b-1-(n-k). So if bn-k1 then Q(X) is 1 (degree
    0), and the only possible error is E1(X) P(X).
    So 1 undetectable error out of the total number
    of possible bursts is 1/2b-2 2-(n-k-1). On the
    other hand, if bgtn-k1, Q(X) has terms X0,
    Xb-1-(n-k), and b-2-(n-k) other coefficients. So
    there are 2b-2-(n-k) possibilities for Q(X). So
    now that ratio of undetectable to total patterns
    is 2b-2-(n-k)/2b-2 or 2-(n-k).

32
Detection of Two Bursts of Errors
  • Theorem 7 The cyclic code generate by P(X)
    (X1)P1(X) detects any combination of two
    burst-errors of length 2 or less if the length of
    the code n is no greater than e, the exponent to
    which P1(X) belongs.
  • Proof We can see four patterns of two bursts,
    each length 2 or less
  • 1) E(X) Xj Xi 2) E(X) Xj (Xi1 Xi)
  • 3) E(X) (Xj1 Xj) Xi 4) E(X) (Xj1 Xj)
    (Xi1 Xi)
  • Cases 2 and 3 are automatically covered by the
    factor X1 since they have an odd number of
    errors (Corollary 2 of theorem 2). For case 4,
    we can rewrite E(X) to be (X1)(XjXi). The X1
    terms cancel out, so we must show that P1(X) does
    not divide XjXi (the same for case 1). We
    already showed this by theorem 3. So all 4 cases
    are not divisible by P(X) and are thus
    detectable.

33
Detection of Two Bursts of Errors
  • These are equivalent to Abramson codes, which
    correct single and double adjacent errors. They
    are also the same as the SECDED Hamming codes of
    theorem 6.
  • Theorem 8 The cyclic code generated by
  • P(X) (Xc1)P1(X)
  • will detect any combination of two bursts
  • E(X) XjE2(X) XiE1(X)
  • provided
  • c1 the sum of the lengths of both bursts
  • P1(X) is irreducible and of degree length of
    the shorter burst
  • length of the code the least common multiple of
    c and the exponent e to which P1(X) belongs
  • Proof (next slide)

34
(No Transcript)
35
Implementation
  • Recap
  • To encode a message G(X), we multiply it by Xn-k,
    divide this by P(X), and take the remainder R(X)
    and add it to Xn-kG(X).
  • The only thing yet unseen polynomial division
    (modulo 2)
  • Example X5X4X3X / X21
  • X3 X2 0X 1
  • X20X1 / X5 X4 X3 0X2 X 0 lt
    dividend
  • divisor X5 0X4 X3
  • 0 X4 0X3 0X2 X 0
  • X4 0X3 X2
  • 0 0 X2 X 0
  • X2 0X 1
  • X 1

36
Implementation
  • Quotient is unnecessary for us just need the
    remainder
  • The variables are also unnecessary just need
    the coefficients
  • Algorithm for modulo 2 division to find remainder
  • Line up the highest degree term of the dividend
    with the highest degree term of the divisor and
    add/subtract (xor) each coefficient
  • Line up the highest degree term of the
    addition/subtraction with the highest degree term
    of the divisor and subtract again
  • Repeat until the difference has a lower degree
    than divisor

________________ 1 0 1 1 1 1 0 1 0
1 0 1 1 0 0 1
0 1 1 1 0
1 0 1 1 1 1 1 corresponds
to X1
37
Implementation
  • This can be implemented by a shift register and
    XOR gates
  • Number of registers is equal to the degree of
    P(X)
  • Place XOR gates at positions where P(X) has a
    coefficient of one for the corresponding term

dividend
?
?
?
Shift register for dividing by X5X4X21
38
Implementation
  • Can modify initial design to be able to check for
    errors or encode a message

dividend
OR
Delay of n-k shifts
G1
?
?
?
G2
One method of encoding on detecting errors (P(X)
X5X4X21)
39
Implementation
  • Can modify again to avoid the delay of n-k shifts.

OR
dividend
G1
?
?
G2
?
More efficient circuit for encoding and error
detection (P(X) X5X4X21)
40
A little bit on Error Correction
  • More difficult than detection
  • Can be shown that each different correctable
    error pattern corresponds to a different
    remainder when dividing by P(X)
  • Can be achieved in the follow manner
  • divide received message H(X)F(X)E(X) by P(X) to
    get remainder
  • get error E(X) corresponding to the remainder
    from a lookup table or some calculation
  • Subtract E(X) from H(X) to obtain the correct
    trasmitted message F(X)
  • More complex equipment for error
    lookup/computation
  • Entire H(X) must be temporarily stored while
    computing the remainder and then E(X)
  • Step 2 calculation can be done with a shift
    register for burst- or single-error correcting
    codes

41
Conclusion
  • Messages can be corrupted and we would at least
    like to be able to detect them
  • Can represent a message bit string in terms of a
    polynomial
  • Encoded message F(X) Xn-kG(X) R(X)
    Q(X)P(X)
  • The methods of detection are highly efficient and
    easily implementable with shift registers
  • We want our astronauts to return safely!!!

42
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com