Top Banner

of 46

I2IT Cyclic Block Codes

Apr 05, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/31/2019 I2IT Cyclic Block Codes

    1/46

    1

    Targets todayTaxonomy of codingWhy cyclic codes are used?How cyclic codes are defined?Systematic and nonsystematic codesHow their performance is defined?

    How practical encoding and decoding circuits arerealized?How to construct cyclic codes?

  • 7/31/2019 I2IT Cyclic Block Codes

    2/46

    2

    Cyclic block codesCyclic codes are a subclass of linear block codes.Encoding and syndrome calculation are easilyperformed using feedback shift-registers.

    Hence, relatively long block codes can beimplemented with a reasonable complexity.

    BCH and Reed-Solomon codes are cyclic codes.

  • 7/31/2019 I2IT Cyclic Block Codes

    3/46

    3

    BackgroundCoding is used for

    error detection and/or error correction (channelcoding)ciphering (security) and compression (source coding)

    In coding extra bits are added or removed in datatransmissionChannel coding can be realized by two approaches

    FEC (forward error coding)block coding, often realized by cyclic coding

    convolutional codingARQ (automatic repeat request)

    stop-and-waitgo-back-N

    selective repeat etc.

  • 7/31/2019 I2IT Cyclic Block Codes

    4/46

    4

    Why cyclic codes?For practical applications rather large n and k must be used. This isbecause in order to correct up to t errors it should be that

    Hence for , large n and k must be used (next slide)Cyclic codes are

    linear : sum of any two code words is a code word

    cyclic : any cyclic shift of a code word produces another codewordAdvantages: Encoding, decoding and syndrome computation easy byshift registers

    12 1 ...1 2n k

    n

    t i

    ni

    n n nt

    number of syndromes

    (or check-bit error patterns)number of error pattersin encoded word

    2 1

    11 log note: (1 )C C

    t

    i

    n

    i R q n k n Rn

    / 1C R k n

    (n,k )block coder

    k -bits n-bits

  • 7/31/2019 I2IT Cyclic Block Codes

    5/46

    5

    ExampleConsider a relatively high SNR channel such that only 1 or 2 biterrors are likely to happen. Consider the ration

    Take a constant code rate of Rc=k/n=0.8 and consider e with somevalues of larger n and k :

    This demonstrates that long codes are more advantages when a highcode rate and high error correction capability is required

    (10,8) 0.35, (32,24) 0.89, (50,40) 0.97e e e

    (n,k )block coder

    k -bits n-bits

    Number of 2-bit error patternsNumber of check-bits

    / C R k n2

    1

    2

    11 log

    ( , )log

    1 2

    t

    ci

    n R

    in

    n k n k

    n ne

    =

  • 7/31/2019 I2IT Cyclic Block Codes

    6/46

    6

    Cyclic CodesCyclic codes are parity check codes with additional propertythat cyclic shift of codeword also a codewordIf (C n-1 , C n-2 ,, C 1 , C 0) is a codeword, (C n-2 , C n-3 ,, C 0 , C n-1 ) is also codewordParity check codes require complex encoding, decodingcircuit using arrays of EX-OR gates, AND gates, etc.Cyclic codes require far less hardware, in form of linearfeedback shift registersCyclic codes are used in sequential storage devices, e.g.

    tapes, disks, and data linksAn (n, k) cyclic code can detect single bit errors, andmultiple adjacent bit error affecting fewer than (n-k) bits,burst transient errors.

  • 7/31/2019 I2IT Cyclic Block Codes

    7/467

    Cyclic Code and Polynomials

    Cyclic codes depend on the representation of data bypolynomialIf (Cn-1 , C n-2 ,, C 1, C 0) is a codeword, its polynomialrepresentation

    C(x) = C n-1 xn-1 + C n-2 xn-2 + + C 1 x1 + C 0Cyclic codes are characterized by its generatorpolynomial g(x)g(x) is a polynomial of degree (n-k) for an (n, k) code,with unity coefficient in (n-k) termExample: for (7, 4) code,

    C(x) = C 6 x6 + C 5 x5 + + C 1 x1 + C 0g(x) = x 3 + x + 1

  • 7/31/2019 I2IT Cyclic Block Codes

    8/468

    Cyclic codes - examples

  • 7/31/2019 I2IT Cyclic Block Codes

    9/469

    Cyclic And Polynomial AlgebraDefinition: A cyclic code is a parity check code, whereevery cyclic shift of a code word is a code word, e.g. if (C n-1 ,Cn-2 ,, C 1, C 0) is a code word, then (C n-2 , C n-3 ,, C 0 , C n-1 ) is also a code word

    Cyclic codes are conveniently described as polynomials C(x)= C n-1 xn-1 + C n-2 xn-2 + + C 1 x1 + C 0

    Use key concept of polynomial division using Euclideandivision algorithm: f(x) = q(x)p(x) + r(x) , degree (r(x)) binary logiccircuits applicableFor each cyclic code, there exists only one generator polynomial whose degree equals the number of check bits q=n-k in the encodedword

    1 2

    1 2 1 0( )n n

    n n p x p x p x p x

    X

    1 2 1 0( )n n x x x x X 2 3 0 1' ( )n n n x x x x X

    1 22 3 0 1'( ) n nn n n p x p x p x p x X

  • 7/31/2019 I2IT Cyclic Block Codes

    14/4614

    Example: Generating of (7,4) cyclic code,by generator polynomial G (p)=p 3 +p+1

    3 2

    3

    3 3 2 3 2 3 2

    6 5 3

    (1101) 1

    (1011) 1

    ( 1 ) ( 1 ) 1

    p p

    p p

    p p p p p p p p

    p p p

    M

    G

    X MG4 3

    p p 3 2

    6 5 4 3 2

    11 (1111111)

    p p p p p p p p p

  • 7/31/2019 I2IT Cyclic Block Codes

    15/4615

    Rotation of cyclic code yields another cyclic codeTheorem: A single cyclic shift of X is obtained by multiplication of pX where after division by the factor pn+1 yields a cyclic code at theremainder:

    and by induction, any cyclic shift i is obtained by

    Example:

    Important point of implementation is is that the division by pn+1 can berealized by a tapped shift register.

    '( ) ( )mod( 1)n p p p p X X

    ( ) ( )( ) ( )mod( 1)i i n p p p p X X

    not a three-bit code (1010),divide by the common factor

    3 3

    ( )

    1 0111

    1

    1

    p p p

    p p X

    3( ) p p p p X

    2101 ( ) 1 p p X

    3 3

    3

    1

    1

    1

    1

    p p p

    p

    p

    n-1 bit rotated code word

    Shift left by 1 bit:

  • 7/31/2019 I2IT Cyclic Block Codes

    16/4616

    Prove that

    Note first that

    then, by using (1) and (2)

    Repeating the same division with higher degrees of p yields then

    '( ) ( )mod( 1)n p p p p X X

    1 2

    1 2 1 0( )n n

    n n p p x p x p x p x p X

    1

    1 2

    1 2 1 0

    1 1

    1 2

    2 1 0 1

    1 )

    '( )

    n

    n n n

    n n

    n

    n n

    n

    n n

    x

    p x p x p x p x p

    x p x

    x p x p x p x p

    X

    1 2

    1 2 1 0( )n n

    n n p x p x p x p x

    X

    (1)

    (2)

    ( ) ( )( ) ( )mod( 1)i i n p p p p X X

  • 7/31/2019 I2IT Cyclic Block Codes

    17/4617

    Cyclic codes and the common factor p n+1Theorem: Cyclic code polynomial X can be generated by multiplying

    the message polynomial M of degree k -1 by the generator polynomialG of degree q=n-k where G is an q-th order factor of pn + 1.Proof: assume message polynomial:

    and the n-1 degree code is

    or in terms of G

    Consider then a shifted code version

    1 2

    1 01 2( )k k

    k k p m p m p m p x

    M

    1 2

    1 01 2( ) ( ) ( ) ( ) ( )k k

    k k p p m p p m p p m p p x

    X MG G G G G

    1 2

    1 2 1 0( )n n

    n n p x p x p x p x

    X

  • 7/31/2019 I2IT Cyclic Block Codes

    18/4618

    Now, if and assume G is a factor of pn+1 (not M ),then X( p) must be a multiple of G that we actually already proved:

    Therefore, X can be expressed by M 1G for some other data vectorM 1 and X is must be a code polynomial. Continuing this way for p (i)X ( p), i = 2,3 we can see that X,X

    etc are all code polynomial generated by the multiplication MG of therespective, different message polynomials Therefore, the ( n,k ) linear code X , generated by MG is indeed cyclicwhen G is selected to be a factor of pn+1

    2

    2

    1

    1

    1

    1 2 1 0

    1

    2 1 0 1

    ( )

    ( 1) ( )

    ( 1) '( )

    n

    n

    n

    n

    n n

    n n

    n

    n n

    p p x p x p x p x p

    x p x p x p x p x

    x p p p

    X

    X MG

    ( ) p p pX MG

    '( ) mod( 1)n X p p p MG

    G is a factor of p n+1term has the factor p n+1 must be a multiple of G

  • 7/31/2019 I2IT Cyclic Block Codes

    19/4619

    Cyclic Codes & Common Factor2

    2

    1

    1

    1

    1 2 1 0

    1

    2 1 0 1

    ( )

    ( 1) ( )( 1) '( )

    n

    n

    n

    n

    n n

    n n

    n

    n n

    p p x p x p x p x p

    x p x p x p x p x x p p p

    1M G

    X

    X MG

  • 7/31/2019 I2IT Cyclic Block Codes

    20/4620

    Factoring cyclic code generator polynomialAny factor of p n+1 with the degree of q= n-k

    generates an ( n,k ) cyclic code Example: Consider the polynomial p7+1. This can be factored as

    Both the factors p3+p+1 or p3,+ p2+1 can be used to generate anunique cyclic code. For a message polynomial p2 +1 the followingencoded word is generated:

    and the respective code vector (of degree n-1 or smaller) is

    Hence, in this example

    7 3 3 21 ( 1)( 1)( 1) p p p p p p

    2 3 5 2( 1)( 1) 1 p p p p p p

    (n,k )cyclic encoder

    k -bits n-bits

    0101 0100111

    0100111

    3

    7 4

    q n k

    n k

  • 7/31/2019 I2IT Cyclic Block Codes

    21/4621

    Examples of cyclic code generator polynomialsThe generator polynomial for an (n,k) cyclic code is defined by

    and G ( p) is a factor of pn+1, as noted earlier. Any factor of pn+ 1 thathas the degree q (the number of check bits) may serve as thegenerator polynomial. We noticed earlier that a cyclic code isgenerated by the multiplication

    where M ( p) is the k -bit message to be encodedOnly few of the possible generating polynomials yield high qualitycodes (in terms of their minimum Hamming distance)

    11 1( ) 1,q q q p p p g pg q n k G

    ( ) ( ) ( ) p p pX M G

    Some cyclic codes:

    3( ) 0 1 p p p G

  • 7/31/2019 I2IT Cyclic Block Codes

    22/46

    22

    Systematic cyclic codesDefine the length q=n-k check vector C and the length- k message

    vector M by

    Thus the systematic n:th degree codeword polynomial is

    11 1 0( ) k k p m p m p m M

    1

    1 1 0( )q

    q p c p c p c C

    1

    1 1 0

    1

    1 1 0

    ( ) ( )

    ( ) ( )

    n k k

    k

    q

    q

    q

    p p m p m p mc p c p c

    p p p

    X

    M C

    How to determine the check-bits??

    Question: Why these denote the message bits stillthe message bits are M (p) ???

    check bits

    message bits

    (n,k )cyclic encoder

    k -bits n-bits

  • 7/31/2019 I2IT Cyclic Block Codes

    23/46

    23

    Determining check-bits

    Note that the check-vector polynomial is the remainder leftover after dividing

    ( ) ( ) ( ) ( ) ( )q p p p p p p X M G M C

    ( ) ( )( )( ) ( )

    n k p p p p p p

    M CMG G

    ( ) / ( )n k p p pM G( ) pC

    Example: (7,4) Cyclic code:

    ( ) mod ( ) / ( )n k p p p p C M G

    1010 -> 1010001

    3 2

    3

    7 4 6 4

    ( ) 1

    ( )

    ( )

    p p p

    p p p

    p p p p

    G

    M

    M

    3 2

    3 3 6 4

    ( )( )

    ( ) / ( ) 1 1

    ( ) ( ) ( ) 1 1

    n k

    n k

    p p

    p p p p p

    p p p p p p p p

    CQ

    M G

    M C

    Definition of systematic cyclic code

    7 7 5 11

    5 5

  • 7/31/2019 I2IT Cyclic Block Codes

    24/46

    24

    Division of the generated code by the generatorpolynomial leaves no reminder

    3 2

    3 2 6 4

    6 5 3

    5 4 3

    5 4 2

    3 2

    3 2

    1

    1 1

    1

    1

    1

    p p

    p p p p

    p p p

    p p p

    p p p p p

    p p

    3 2

    3 3 6 4

    ( )( )

    ( ) / ( ) 1 1

    ( ) ( ) ( ) 1 1

    n k

    n k

    p p

    p p p p p

    p p p p p p p p

    C

    QM G

    M C

    3 2

    3

    7 4 6 4

    ( ) 1( )

    ( )

    p p p p p p

    p p p p

    GM

    M

    This can be used for errordetection/correction as we inspect later

  • 7/31/2019 I2IT Cyclic Block Codes

    25/46

    25

    Cyclic Codes

  • 7/31/2019 I2IT Cyclic Block Codes

    26/46

    26

    Circuit for encoding systematic cyclic codes

    We noticed earlier that cyclic codes can be generated by using shiftregisters whose feedback coefficients are determined directly by thegenerating polynomialFor cyclic codes the generator polynomial is of the form

    In the circuit, first the message flows to the shift register, and feedback switch is set to 1, where after check -bit-switch is turned on, and thefeedback switch to 0, enabling the check bits to be outputted

    1

    0

    1 2

    1 2 1( ) 1q q q

    q q p p p g p g pg

    G

  • 7/31/2019 I2IT Cyclic Block Codes

    27/46

    27

    Cyclic Codes Implementation

    The Cyclic code is implemented by the shift-register encoder with(n-k) stages

    rn-k-1

    Encoding starts with the feedback switch closed, the output switch in themessage bit position, and the register initialised to the all-zero state.The k message bits are shifted into the register and delivered to thetransmitter.After k shift cycles, the register contains the b check bits.The feedback switch is now opened and the output switch is moved to thecheck bits to deliver them to the transmitter.

  • 7/31/2019 I2IT Cyclic Block Codes

    28/46

    28

    Cyclic Codes Implementation example

    The shift-register encoder for the (7,4) Hamming Code has (7-4=3) stages

    When the input message is 0011, after 4 shift cycles the redundancy bits are delivered

  • 7/31/2019 I2IT Cyclic Block Codes

    29/46

    29

    Cyclic Codes Implementation Exercise

    The shift-register encoder for the (7,4) Hamming Code has (7-4=3) stages

    When the input message is 1001, after 4 shift cycles the redundancy bits are delivered

    1

    0

    0

    1

    0

    0

    1

    1

    0

    1

    1

    1

    0

    1

    0

    1

    0

    1

    1

    1

    1

    1

    1

    1

    1

    0

    1

    0

    The check bitsis 011

  • 7/31/2019 I2IT Cyclic Block Codes

    30/46

    30

    Cyclic Codes Implementation Exercise

    The shift-register encoder for the (7,4) Hamming Code has (7-4=3) stages

    When the input message is 1100?

  • 7/31/2019 I2IT Cyclic Block Codes

    31/46

    31

    Decoding cyclic codesEvery valid, received code word R (p) must be a multiple of G (p),otherwise an error has occurred. (Assume that the probability of noiseto convert code words to other code words is very small.)Therefore dividing the R (p)/ G (p) and considering the remainder as asyndrome can reveal if an error has happed and sometimes also toreveal in which bit (depending on code strength)

    Division is accomplished by a shift registersThe error syndrome of q= n-k bits is therefore

    This can be expressed also in terms of the error E (p) and thecode word X(p) while noting that the received word is in terms of

    error

    ( ) mod ( ) / ( ) p p pS R G

    ( ) ( ) ( ) p p p R X E

    ( ) mod ( ) ( ) / ( )

    ( ) mod ( ) / ( )

    p p p p

    p p p

    S X E G

    S E G

    hence

  • 7/31/2019 I2IT Cyclic Block Codes

    32/46

    32

    Decoding cyclic codes: syndrome table

    16.20 ( ) mod ( ) / ( )s x e x g xUsing denotation of this example:

  • 7/31/2019 I2IT Cyclic Block Codes

    33/46

    33

    ( )g x

    ( ) mod ( ) / ( )s x r x g x

    Table 16.6Decoding cyclic codes: error correction

  • 7/31/2019 I2IT Cyclic Block Codes

    34/46

    34

    Decoding circuit for (7,4) codesyndrome computation

    To start with, the switch is at 0 position Then shift register is stepped until all the received code bits haveentered the registerThis results is a 3-bit syndrome ( n - k = 3 ):

    that is then left to the registerThen the switch is turned to the position 1 that drives the syndromeout of the registerNote the tap order for Galois-form shift register

    3( ) 1 p p p G

    10

    received code syndrome x0 x1 xn-1

    ( ) mod ( ) / ( ) p p pS R G

  • 7/31/2019 I2IT Cyclic Block Codes

    35/46

    35

    Cyclic block codes2. Find the generator and parity check matrices, G and H ,

    respectively.

    10110000101100

    0010110

    0001011

    )1101(),,,(1011)( 321032

    G

    g gggg X X X X

    Not in systematic form.We do the following:

    row(4)row(4)row(2)row(1)

    row(3)row(3)row(1)

    1000101

    0100111

    0010110

    0001011

    G

    1110100

    0111010

    1101001

    H

    44I

    33I T PP

  • 7/31/2019 I2IT Cyclic Block Codes

    36/46

    360.

    Figure 10.15 Division in CRC encoder

  • 7/31/2019 I2IT Cyclic Block Codes

    37/46

    370.

    Figure 10.16 Division in the CRC decoder for two cases

  • 7/31/2019 I2IT Cyclic Block Codes

    38/46

    380.

    Figure 10.22 CRC division using polynomials

  • 7/31/2019 I2IT Cyclic Block Codes

    39/46

    390.

    In a cyclic code,If s (x) 0, one or more bits is corrupted. If s (x) = 0, either

    a. No bit is corrupted. or

    b. Some bits are corrupted, but thedecoder failed to detect them.

    Note

  • 7/31/2019 I2IT Cyclic Block Codes

    40/46

    400.

    In a cyclic code, those e (x) errors thatare divisible by g (x) are not caught.

    Received codeword (c(x) + e(x))/g(x) =c(x)/g(x) + e(x)/gxThe first part is by definition divisible the

    second part will determine the error. If0 conclusion -> no error occurred.

    Note : that could mean that an error wentundetected.

    Note

  • 7/31/2019 I2IT Cyclic Block Codes

    41/46

    410.

    If the generator has more than one termand the coefficient of x 0 is 1,

    all single errors can be caught.

    Note

  • 7/31/2019 I2IT Cyclic Block Codes

    42/46

    420.

    If a generator cannot divide x t + 1

    (t between 0 and n 1),then all isolated double errorscan be detected.

    Note

  • 7/31/2019 I2IT Cyclic Block Codes

    43/46

    430.

    A generator that contains a factor ofx + 1 can detect all odd-numbered errors.

    Note

  • 7/31/2019 I2IT Cyclic Block Codes

    44/46

    440.

    All burst errors with L r will bedetected.

    All burst errors with L = r + 1 will bedetected with probability 1 (1/2) r 1.

    All burst errors with L > r + 1 will be

    detected with probability 1 (1/2) r .

    Note

    Why cyclic codes?

  • 7/31/2019 I2IT Cyclic Block Codes

    45/46

    45

    Why cyclic codes?We started with restricting our attention to linear codes:

    Advantages minimal distance dmin (C ) is easy to compute if C is a linear code

    it is easy to specify a particular code

    simple encoding and (kind of :) reasonable decoding proceduresDisadvantages

    linearity is heavy restriction, however it is not that clear whether

    we really could gain that much by abandoning it

    However, most of known "good" codes are in addition cyclic. Cyclic

    codes also have a simpler decoding procedures.

  • 7/31/2019 I2IT Cyclic Block Codes

    46/46

    Lessons learnedYou can construct cyclic codes starting from a givenfactored pn+1 polynomial by doing simple calculations inGF(2)You can estimate strength of designed codesYou understand how to apply shift registers with cycliccodes

    You can design encoder circuits for your cyclic codesYou understand how syndrome decoding works withcyclic codes and you can construct the respect decodercircuit