+ All Categories
Home > Documents > MSIS 4523 Ch10.Error Detection Correction_Short

MSIS 4523 Ch10.Error Detection Correction_Short

Date post: 07-Apr-2018
Category:
Upload: alicia-kay-morris
View: 235 times
Download: 0 times
Share this document with a friend

of 53

Transcript
  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    1/53

    Data Communications SystemsCh 10: Error Detection and Correction

    JinKyu Lee, Ph.D.

    [email protected]

    Include the course code (MSIS4523) in every email subject!!

    Layer2~4

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    2/53

    Topics

    Error Detection vs. Correction vs. Retransmission

    Block Codes Hamming Distance

    Exclusive OR (XOR) operation

    Linear Block Codes, Parity Check, Hamming Codes

    Cyclic Codes

    Cyclic Redundancy Check (CRC)

    Checksums

    Internet Checksum

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    3/53

    3

    Error checking methods

    Block codes

    Cyclic codes

    Checksums

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    4/53

    4

    Single-bit error

    Burst error of length 8

    An error-detecting code can detectonly the types of errors for which it is

    designed; other types of errors may

    remain undetected.

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    5/53

    5

    The structure of encoder and decoder

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    6/53

    6

    Block Coding

    In block coding, we divide our message into blocks,each of k bits, called datawords. We add r redundant

    bits to each block to make the length n = k + r. The

    resulting n-bit blocks are called codewords

    Since n > k, the number of possible codewords isgreater than the number of datawords

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    7/537

    Datawords and codewords in block coding

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    8/538

    Process of error detection in block coding

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    9/539

    Table 10.1 A code for error detection (Example 10.2)

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    10/5310

    Let us assume that k = 2 and n = 3. Table 10.1 shows thelist of datawords and codewords. Later, we will see how

    to derive a codeword from a dataword.

    Assume the sender encodes the dataword 01 as 011 and

    sends it to the receiver. Consider the following cases:

    1. The receiver receives 011. It is a valid codeword. Thereceiver extracts the dataword 01 from it.

    Example 10.2

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    11/5311

    2. The codeword is corrupted during transmission, and

    111 is received. This is not a valid codeword and is

    discarded.

    3. The codeword is corrupted during transmission, and000 is received. This is a valid codeword. The receiver

    incorrectly extracts the dataword 00. Two corrupted

    bits have made the error undetectable.

    Example 10.2 (continued)

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    12/5312

    Error Correction

    is NOT asking again when an error isdetected.

    Receiver needs to be aware that an error

    is present (error detection); then with the available data from the

    sender, must identify the error and correct

    it

    Much more difficult than detection

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    13/53

    Process of error detection in block coding

    13

    Structure of encoder and decoder in errorcorrection

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    14/53

    14

    Let us add more redundant bits to Example 10.2 to see

    if the receiver can correct an error without knowing

    what was actually sent!

    Add 3 redundant bits to the 2-bit dataword to make 5-bit

    codewords (Table 10.2). If the dataword is 01, thesender creates the codeword 01011. The codeword is

    corrupted during transmission, and 01001 is received.

    Can we correct the error?What if we assume that there is only 1 bit corrupted?

    Example 10.3

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    15/53

    15

    Table 10.2 A code for error correction (Example 10.3)

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    16/53

    16

    1. Comparing the received codeword with the first

    codeword in the table (01001 versus 00000), the receiver

    decides that the first codeword is not the one that was

    sent because there are two different bits.

    2. By the same reasoning, the original codeword cannot bethe third or fourth one in the table.

    3. The original codeword must be the second one in the

    table because this is the only one that differs from the

    received codeword by 1 bit. The receiver replaces 01001with 01011 and consults the table to find the dataword

    01.

    Example 10.3 (solution)

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    17/53

    17

    Hamming Distance

    The Hamming Distance between two words (of

    the same size) is the number of differences

    between corresponding bits

    The Minimum Hamming Distance is thesmallest Hamming Distance possible between

    all pair in a set of words

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    18/53

    18

    Modular Arithmetic

    Need to embedded error detection in the message

    Block coding adds redundant data to message; thenconducts a mathematical calculation

    Modulo-N arithmetic uses only the integers in the range 0to N-1, inclusive

    Often Modulo-2 is used with an XOR (exclusive OR)function If two bits are the same, result is a 0

    If bits are different, result is 1

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    19/53

    19

    XORing of two single bits or two words

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    20/53

    20

    Let us find the Hamming distance between two pairs of

    words.

    1. The Hamming distance d(000, 011) is 2 because

    Example 10.4

    2. The Hamming distance d(10101, 11110) is 3 because

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    21/53

    21

    Solution

    We first find all Hamming distances.

    Example 10.5 minimum Hamming distance of the coding scheme in Table 10.1?

    The dmin in this case is 2.

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    22/53

    22

    Parameters for Hamming Distances

    To guarantee the detection of up to n errors inall cases, the minimum Hamming distance in ablock code must be

    dmin = n + 1.

    To guarantee correction of up to n errors in allcases, the minimum Hamming distance in ablock code must be

    dmin >= 2n + 1.

    dmin = minimum hamming distances

    # of errors that can be detected = dmin -1

    # of errors that can be corrected

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    23/53

    23

    The minimum Hamming distance for our first code

    scheme (Table 10.1) is 2. This code guarantees

    detection of only a single error. For example, if the

    third codeword (101) is sent and one error occurs, the

    received codeword does not match any validcodeword. If two errors occur, however, the received

    codeword may match a valid codeword and the errors

    are not detected.

    Example 10.7

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    24/53

    24

    Our second block code scheme (Table 10.2) has dmin

    = 3.

    This code can detect up to two errors. Again, we see that

    when any of the valid codewords is sent, two errors create a

    codeword which is not in the table of valid codewords. The

    receiver cannot be fooled.

    However, some combinations of three errors change a

    valid codeword to another valid codeword. The receiver

    accepts the received codeword and the errors areundetected.

    Example 10.8

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    25/53

    25

    A code scheme has a Hamming distance dmin = 4. What is

    the error detection and correction capability of this

    scheme?

    Solution

    This code guarantees thedetection of up tothree errors

    (s = 3), but it cancorrect up toone error.

    If this code is used for error correction, part of its

    capability is wasted. Error correction codes need to

    have an odd minimum distance (3, 5, 7, . . . ).

    Example 10.9

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    26/53

    26

    10-3 LINEAR BLOCK CODES10-3 LINEAR BLOCK CODES

    Almost all block codes used today belong to a subsetcalledlinear block codes. A linear block code is a code

    in which the exclusive OR (XOR) of two valid

    codewords creates another valid codeword.

    Do the two codes in Table 10.1 and Table 10.2 belong to theclass of linear block codes? YES!

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    27/53

    27

    Linear Block Codes

    In a linear block code, the exclusive OR (XOR) of any

    two valid codewords creates another valid codeword The Minimum Hamming Distance is the number of 1s

    in the nonzero codeword with the smallest number of

    1s. A simple parity-check code is a single-bit error-

    detecting code

    in which c = d+ 1 with dmin = 2.

    * c = Length(codewords), d= Length(datawords)

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    28/53

    28

    Parity Check

    A simple parity-check code can detect an oddnumber of errors

    Parity checks can be two dimensional

    Note an even number of 1s is represented by 0

    and an odd number of 1s is represented by 1 inparity bits The resulting codewords will always have even # of 1s!

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    29/53

    29

    Simple parity-check code C(5, 4)

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    30/53

    30

    Encoder and decoder for simple parity-check code

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    31/53

    31

    Assume the sender sends the dataword 1011. The codeword

    created from this dataword is 10111, which is sent to thereceiver.

    1. No error occurs. 10111 is received.

    The syndrome is 0. The dataword 1011 is created.

    2. One single-bit error changes a1. - 10011 is received.

    The syndrome is 1. No dataword is created.

    3. One single-bit error changes r0. - 10110 is received.The syndrome is 1. No dataword is created.

    Example 10.12

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    32/53

    32

    4. An error changes r0 and a second error changes a3.

    - 00110 is received.

    The syndrome is 0. The dataword 0011 is created.

    * Note that here the dataword is wrongly created

    due to the syndrome value.

    5. Three bitsa3, a2, and a1are changed by errors.

    - 01011 is received.

    The syndrome is 1. The dataword is not created.

    The simple parity check, guaranteed to detect one single

    error, can also find any odd number of errors.

    Example 10.12 (continued)

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    33/53

    33

    Two-dimensional parity-check code

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    34/53

    34

    Two-dimensional parity-check code

    0 0 0

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    35/53

    35

    Two-dimensional parity-check code

    0

    0

    0

    0 0

    00

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    36/53

    36

    Hamming Codes

    Originally designed with c = 7, d = 4, dmin=3

    , where c = Length(codewords), d=

    Length(datawords)

    (See Table 10.4 )

    Used for error correction Can detect two errors

    Can correct 1 error

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    37/53

    37

    Hamming code C(7, 4)

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    38/53

    38

    The structure of the encoder and decoder for a Hamming code

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    39/53

    39

    Generating & Checking Parity Bits

    The parity check bits handle 3 of the 4 bits in the

    dataword r0 = a2 + a1 + a0 modulo -2

    r1 = a3 + a2 + a1 modulo -2

    r2 = a1 + a0 + a3 modulo -2

    The decoder creates a 3-bit syndrome in which each bit isthe parity check for the 4 (3 data+1 parity) of the 7 bitsreceived s0 = b2 + b1 + b0 + q0 modulo -2

    s1 = b3 + b2 + b1 + b1 modulo -2 s2 = b1 + b0 + b3 + b2 modulo -2

    Should always be 0s if no error occurred.

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    40/53

    Dataword: 1 1 0 1 0 1 1Dataword: 1 0 0 1 0 1 0

    40

    Logical decision made by the correction logic analyzer

    Hamming Code Error Correction Examples

    Senders sidea3 a2 a1 a0 r2 r1 r0

    Dataword: 0 0 0 1Dataword: 1 0 0 1

    Receivers sideb3 b2 b1 b0 q2 q1 q0 s2 s1 s0

    Dataword: 0 0 0 1 1 0 1Dataword: 1 0 0 1 0 1 1

    1 0 1

    1 1 0

    0 0 0

    0 0 0

    1 1 0

    1 0 0

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    41/53

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    42/53

    42

    A CRC code with C(7, 4)

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    43/53

    43

    CRC encoder and decoder

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    44/53

    44

    Division in CRC encoder

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    45/53

    45

    Division in the CRC decoder for two cases

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    46/53

    46

    Checksum

    An error detection method used in the

    Internet: Internet Checksum Uses 1s Complement

    1. Suppose our data is a list of five numbers (7, 11, 12, 0, 6) that

    we want to send to a destination. The sum of these numbers is

    36.2. When the sender transmits these numbers, it can include -36,

    the negative of the sum (the complement), at the end of the five

    numbers. In this case, we send (7, 11, 12, 0, 6, 36). The

    attached 6th number is called the checksum.

    3. The receiver can add all the received numbers including the

    checksum. If the result is 0, it assumes no error, so accepts the

    five numbers and discards the checksum. Otherwise, there is

    an error somewhere, and the data are not accepted.

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    47/53

    47

    Checksum concept

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    48/53

    48

    Using a limited space: 4-bit word-wise Addition & Complements

    0

    1 111

    1

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    49/53

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    50/53

    50

    Sender site:1. The message is divided into 16-bit words.2. The value of the checksum word is set to 0.

    3. All words including the checksum are

    added using ones complement addition.4. The sum is complemented and becomes the

    checksum.

    5. The checksum is sent with the data.

    Internet Checksum

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    51/53

    51

    Receiver site:1. The message (including checksum) is

    divided into 16-bit words.

    2. All words are added using ones

    complement addition.3. The sum is complemented and becomes the

    new checksum.

    4. If the new checksum value is 0, the

    message is accepted; otherwise, it is

    rejected.

    Internet Checksum

    I

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    52/53

    The header is divided

    into 16-bit sections.

    All the sections are

    added and the sum iscomplemented. The

    result is inserted in

    the checksum field.

    Internet

    Checksum for

    IP Header

    (Sender side)

    4

    11

    10001011 10110001

    35,761

    35761

    Once the checksum iscalculated, the checksum

    is plugged into the

    checksum field, and then

    the packet is sent off.

    I t t

  • 8/3/2019 MSIS 4523 Ch10.Error Detection Correction_Short

    53/53

    10001011 10110001

    35,761

    11111111 1111111100000000 00000000

    35761

    On the receivers side

    4Internet

    Checksum for

    IP Header

    (Receiver side)


Recommended