lecture focus: data communications and networking data link layer error control lecture 19 cscs...

57
Lecture Focus: Data Communications and Networking Data Link Layer Error Control Lecture 19 CSCS 311

Upload: buddy-justin-peters

Post on 21-Jan-2016

235 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Lecture Focus:

Data Communications and Networking

Data Link Layer Error Control

Lecture 19

CSCS 311

Page 2: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Control

Page 3: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error ControlError Detection and Correction

Some applications can tolerate a small level of error. e.g. errors in audio or video transmissions may be tolerable.

When we transfer text, we expect a very high level of accuracy.

Data can be corrupted during transmission. Many factors can alter one or more bits of a message.

For reliable communication, errors must be detected and corrected.

Page 4: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error ControlTypes of Errors

Single-Bit Error

Burst Error

Page 5: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error ControlTypes of Errors

Single-Bit Error

Only one bit in the given data unit is changed. A 0 is changed to a 1 OR a 1 to a 0.

0 11 0

Transmitter Receiver

Data unit = A byte, character, or packet

0 1Transmitter Receiver

1 0Medium

Page 6: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error ControlTypes of Errors

Single-Bit Error

Single-bit errors are the least likely type of error in serial data transmission.

Page 7: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Types of ErrorsBurst Error

Data unit = A byte, character, or packet

When 2 or more bits in the data unit are changed. A burst error does not necessarily mean that the errors occur in

consecutive bits. Length of the burst is measured from the first corrupted bit to the

last corrupted bit. Some bits in between may not have been corrupted.

A burst error is more likely to occur than a single-bit error.

Page 8: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Redundancy Parity Check Cyclic Redundancy Check (CRC) Checksum

We look only to see if any error has occurred.

Error Detection:

Page 9: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection and Correction

Redundancy

Redundancy = Adding extra bits

The central concept in detecting or correcting errors is redundancy.

To be able to detect or correct errors, we need to send some extra bits with our data. These redundant bits are added by the sender with the original data.

Their presence allows the receiver to detect or correct corrupted bits. The receiver uses these bits to detect the error(s).

If the received message is error free, these redundant bits are removed and the remaining data is accepted.

If the received message is not error free, the whole message is discarded by the receiver.

Page 10: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection and Correction

Redundancy

Page 11: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection and Correction

Coding

Redundancy is achieved through various coding schemes.

The sender adds redundant bits through a process that creates a relationship between the redundant bits and the actual data bits.

The receiver checks the relationships between the two sets of bits to detect or correct the errors.

The ratio of redundant bits to the data bits and the robustness of the process are important factors in any coding scheme.

We can divide coding schemes into two broad categories: Block coding Convolution coding (Not to be studied)

Page 12: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection and Correction

Coding

Structure of Encoder and Decoder

Encoder

Message

Generator

Message and redundancy

Sender Receiver

Decoder

Message

Checker

Received data

Accept, Correct or Discard

Unreliable

Transmission

Page 13: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection and Correction

Coding

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.

Dataword Redundant bits Codeword+ =r bitsk bits n bits

Size n = k + r

Page 14: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection and Correction

Coding

Block Coding

We have a set of datawords, each of size k, and a set of codewords, each of size of n.

With k bits, we can create a combination of 2k datawords. With n bits, we can create a combination of 2n codewords.

Since n > k, the number of possible codewords is larger than the number of possible datawords.

The block coding process is one-to-one; the same dataword is always encoded as the same codeword.

This means that we have 2n - 2k codewords that are not used. We call these codewords invalid or illegal.

Page 15: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection and Correction

Coding

Block Coding

2k Datawords, each of k bits

k bits k bits k bits .… k bits k bits

2n Codewords, each of n bits (only 2k of these are valid)

n bits n bits n bits n bits n bits.…

Page 16: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection and Correction

Coding

Block Coding

Example: 4B/5B block coding:

In this coding scheme, k =4 and n =5.

We have: 2k = 24 = 16 datawords 2n = 25 = 32 codewords

16 out of 32 codewords are used for message transfer. The rest are either used for control purposes or unused.

Page 17: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection in Block Coding

If the following two conditions are met, the receiver can detect a change in the original codeword:

1. The receiver has (or can find) a list of valid codewords.2. The original codeword has changed to an invalid one.

Page 18: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection in Block Coding

Encoder

Dataword

Generator

Codeword

Sender Receiver

Decoder

Dataword

Checker

Codeword

Extract

Unreliable

Transmission

k bits

n bits

k bits

n bits

Discard

Process

Page 19: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection in Block Coding

Process

The sender creates codewords out of datawords by using a generator that applies the rules and procedures of encoding.

Each codeword sent to the receiver may change during transmission. If the received codeword is the same as one of the valid codewords, the

word is accepted; the corresponding dataword is extracted for use. If the received codeword is not valid, it is discarded. If the codeword is corrupted during transmission but the received word still

matches a valid codeword, the error remains undetected.

This type of coding can detect only single errors. Two or more errors may remain undetected.

Page 20: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection in Block Coding

Process

Example: Assume that k =2 and n =3. Table below shows the list of datawords and codewords.

Page 21: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection in Block Coding

Example:

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. The

receiver extracts the dataword 01 from it.

2. The codeword is corrupted during transmission, and 111 is received (the leftmost bit is corrupted). This is not a valid codeword and is discarded.

3. The codeword is corrupted during transmission, and 000 is received (the right two bits are corrupted). This is a valid codeword. The receiver incorrectly extracts the dataword 00. Two corrupted bits have made the error undetectable.

Page 22: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Page 23: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Simple Parity-Check Code

The most familiar error-detecting code.

In this code, a k-bit dataword is changed to an n-bit codeword where n = k + 1.

The extra bit, called the parity bit, is selected to make the total number of 1s in the codeword even.

Some implementations specify an odd number of 1s.

The code is a single-bit error-detecting code. It cannot correct any error.

In parity check, a parity bit is added to every data unit so that the total number of 1s is even (or odd for odd-parity).

Page 24: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Simple Parity-Check Code

Possible structure of an encoder and a decoder

The encoder uses a generator that takes a copy of a 4-bit dataword (a0, a1, a2, and a3) and generates a parity bit r0.

The dataword bits and the parity bit create the 5-bit codeword. The parity bit that is added makes the number of 1s in the

codeword even.

This is normally done by adding the 4 bits of the dataword (modulo-2); the result is the parity bit.

If the number of 1s is even, the result is 0; if the number of 1s is odd, the result is 1.

In both cases, the total number of 1s in the codeword is even.

Page 25: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Simple Parity-Check Code: Encoder and Decoder

Encoder

Generator

Codeword

Sender

Parity bit

Dataword

a3 a2 a1 a0

a3 a2 a1 a0 r0

Receiver

Decoder

Checker

Codeword

Syndrome

Dataword

a3 a2 a1 a0

b3 b2 b1 b0 q0

Unreliable

Transmission

Decision Logic

Dis

card

Accept

s0

Page 26: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Simple Parity-Check Code: Encoder and a decoder

The sender sends the codeword which may be corrupted during transmission.

The receiver receives a 5-bit word. The checker at the receiver does the same thing as the

generator in the sender with one exception: The addition is done over all 5 bits. The result, which is called the syndrome, is just 1 bit. The syndrome is 0 when the number of 1s in the received

codeword is even; otherwise, it is 1.

The syndrome is passed to the decision logic analyzer. If the syndrome is 0, there is no error in the received codeword; the

data portion of the received codeword is accepted as the dataword; if the syndrome is 1, the data portion of the received codeword is discarded. The dataword is not created.

Page 27: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Simple Parity-Check Code: Encoder and a decoder

Even-parity concept

Page 28: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Simple Parity-Check Code: Encoder and a decoder

Even-parity concept

Suppose the sender wants to send the word world. In ASCII the five characters are coded as

w o r l d1110111 1101111 1110010 11011001100100

The following shows the actual bits sent 11101110 11011110 11100100 11011000

11001001

Page 29: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Simple Parity-Check Code: Encoder and a decoder

Even-parity concept

Now suppose the word world is received by the receiver without being corrupted in transmission.

11101110 11011110 11100100 11011000 11001001

The receiver counts the 1s in each character and comes up with even numbers (6, 6, 4, 4, 4).

The data are accepted.

Example:

Page 30: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Simple Parity-Check Code: Encoder and a decoder

Even-parity concept

Example:

Now suppose the word world in Example 1 is corrupted during transmission.

11111110 11011110 11101100 11011000 11001001 The receiver counts the 1s in each character and comes up with

even and odd numbers (7, 6, 5, 4, 4). The receiver knows that the data are corrupted, discards them, and

asks for retransmission.

Page 31: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Simple Parity-Check Code: Encoder and a decoder

Even-parity concept

Simple parity check can detect all single-bit errors. It can detect burst errors only if the total number of errors in

each data unit is odd.

Page 32: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Two-Dimensional Parity-Check:

In this method, the dataword is organized in a table (rows and columns).

For each row and each column, 1 parity-check bit is calculated.

The whole table is then sent to the receiver, which finds the syndrome for each row and each column.

The two-dimensional parity check can detect up to three errors that occur anywhere in the table.

However, errors affecting 4 bits may not be detected.

In two-dimensional parity check, a block of bits is divided into rows and redundant bits are added to the whole block.

Page 33: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Two-Dimensional Parity-Check:

Page 34: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Cyclic Redundancy Check (CRC):

In the encoder, the dataword has k bits; the codeword has n bits.

The size of the dataword is augmented by adding n – k (generally) 0s to the right-hand side of the word.

The n-bit result is fed into the generator.

The generator uses a divisor of size n - k + I (generally ), predefined and agreed upon.

The generator divides the augmented dataword by the divisor (modulo-2 division).

The quotient of the division is discarded; the remainder (r2r1r0) is appended to the dataword to create the codeword.

Page 35: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Cyclic Redundancy Check:

The decoder receives the possibly corrupted codeword. A copy of all n bits is fed to the checker which is a replica of the

generator. The remainder produced by the checker is a syndrome of n - k

bits, which is fed to the decision logic analyzer.

The analyzer has a simple function.

If the syndrome bits are all 0s, the 4 leftmost bits of the codeword are accepted as the dataword (interpreted as no error); otherwise, the 4 bits are discarded (error).

Page 36: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Cyclic Redundancy Check:

Encoder

Generator

Codeword

Sender

Remainder

Dataword

a3 a2 a1 a0

a3 a2 a1 a0 r2

Receiver

Decoder

Checker

Codeword

Syndrome

Dataword

a3 a2 a1 a0

b3 b2 b1 b0

Unreliable

Transmission

Decision Logic

Dis

card

Accept0 0 0

r1 r0

Divisord3d2d1d0

q2 q1 q0

s2 s1 s0

Page 37: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Cyclic Redundancy Check:

CRC generator and checker

Page 38: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Cyclic Redundancy Check:

CRC generator

Page 39: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Cyclic Redundancy Check:

CRC checker

Page 40: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Polynomial:

A better way to understand cyclic codes and how they can be analyzed is to represent them as polynomials.

A pattern of 0s and 1s can be represented as a polynomial with coefficients of 0 and 1.

The power of each term shows the position of the bit; the coefficient shows the value of the bit.

Figure below shows a binary pattern and its polynomial representation.

Figure also shows how the polynomial can be shortened by removing all terms with zero coefficients and replacing x1 by x and x0 by 1.

Page 41: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Polynomial:

1 0 0 0 0 1 1

1x6 0x5 0x4 0x3 0x2 1x1 1x0

1 0 0 0 0 1 1

1x6 1x1 1x0

= x6 + x + 1

Page 42: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Polynomial:

1 0 0 0 0 1 1

1x6 1x1 1x0

= x6 + x + 1

Figure shows one immediate benefit; a 7-bit pattern can be replaced by three terms.

The benefit is even more conspicuous when we have a polynomial such as x23 + X3 + 1.

Here the bit pattern is 24 bits in length (three Is and twenty-one 0s) while the polynomial is just three terms.

Page 43: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Polynomial:

Degree of a Polynomial: The degree of a polynomial is the highest power in the

polynomial. For example, the degree of the polynomial x6 + x + 1 is 6. Note that the degree of a polynomial is 1 less that the number

of bits in the pattern. The bit pattern in this case has 7 bits.

Page 44: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Polynomials

Shifting: Shifting to the left means adding extra 0s as rightmost bits; shifting to

the right means deleting some rightmost bits. Shifting to the left is accomplished by multiplying each term of the

polynomial by xn, where n is the number of shifted bits; Shifting to the right is accomplished by dividing each term of the

polynomial by xn. We do not have negative powers in the polynomial representation.

Shifting left 3 bits: 10011 becomes 10011000 x4 + x + 1 becomes x7 + x4 + x3

Shifting right 3 bits: 10011 becomes 10 x4 + x + 1 becomes x

When we augment the dataword in the encoder, we actually shift the bits to the left.

Error Detection Methods

Page 45: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection Error Detection Methods

Cyclic Code Encoder Using Polynomials

Creation of a codeword from a dataword: The dataword 1001 is represented as x3 + 1. The divisor 1011 is represented as x3 + x + 1. To find the augmented dataword, we left-shift the dataword 3

bits (multiplying by x3). The result is x6 + x3

The divisor in a cyclic code is normally called the generator polynomial or simply the generator.

Page 46: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection Error Detection Methods

Cyclic Code Encoder and Decoder Using Polynomials

Cyclic Code AnalysisWe can analyze a cyclic code to find its capabilities by using

polynomials.We define the following, where f(x) is a polynomial with binary

coefficients.Dataword: d(x) Codeword: c(x) Generator: g(x)Syndrome: s(x) Error: e(x)

If s(x) is not zero, then one or more bits is corrupted. If s(x) is zero, either no bit is corrupted or the decoder failed to detect any errors.

Algorithm:In a cyclic code,

1. If s(x) 0, one or more bits is corrupted.2. If s(x) =0, either

a. No bit is corrupted. orb. Some bits are corrupted, but the decoder failed to detect

them.

Page 47: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection Error Detection Methods

Cyclic Code Using Polynomials

Page 48: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Checksum

The checksum is used in the Internet by several protocols. Like block and cyclic codes, the checksum is based on the

concept of redundancy.

Suppose our data is a list of five 4-bit numbers that we want to send to a destination.

In addition to sending these numbers, we send the sum of the numbers.

For example, if the set of numbers is (7, 11, 12, 0, 6), we send (7, 11, 12,0,6,36), where 36 is the sum of the original numbers.

The receiver adds the five numbers and compares the result with the sum. If the two are the same, the receiver assumes no error, accepts the five numbers, and discards the sum.

Otherwise, there is an error somewhere and the data are not accepted.

Page 49: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Checksum

We can make the job of the receiver easier if we send the negative (complement) of the sum, called the checksum.

In this case, we send (7, 11, 12, 0, 6, -36). Receiver can add all the numbers received (including the checksum).

If the result is 0, it assumes no error; otherwise, there is an error.

One's Complement The previous example has one major drawback. All of our data can be written as a 4-bit word (they are less than 15) except for

the checksum. One solution is to use one's complement arithmetic. In this arithmetic, we can represent unsigned numbers between 0 and 2n - 1

using only n bits. If the number has more than n bits, the extra leftmost bits need to be added to

the n rightmost bits (wrapping). In one's complement arithmetic, a negative number can be represented by inverting all bits (changing a 0 to a 1 and a 1 to a 0). This is the same as subtracting the number from 2n - 1.

Page 50: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Checksum

Example: How can we represent the number 21 in one's complement arithmetic using only four bits?

Solution:The number 21 in binary is 10101 (it needs five bits). We can wrap the leftmost bit and add it to the four rightmost bits. We have (0101 + 1) = 0110 or 6.

Example: How can we represent the number -6 in one's complement arithmetic using only four bits?

Solution:In one's complement arithmetic, the negative or complement of a number is found by inverting all bits. Positive 6 is 0110; negative 6 is 100I. If we consider only unsigned numbers, this is 9. In other words, the complement of 6 is 9. Another way to find the complement of a number in one's complement arithmetic is to subtract the number from 2n - I (16 - 1 in this case).

Page 51: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection

Error Detection Methods

Checksum

Example:

Let us redo previous exercise (7, 11, 12, 0, 6) using one's complement arithmetic.

Figure below shows the process at the sender and at the receiver. The sender initializes the checksum to 0 and adds all data items and the checksum (the checksum is considered as one data item). The result is 36. However, 36 can’t be expressed in 4 bits. The extra two bits are wrapped and added with the sum to create the wrapped sum value 6. The sum is then complemented, resulting in the checksum value 9 (15 - 6 = 9).

The sender now sends six data items to the receiver including the checksum 9.

(Continued)

Page 52: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection Error Detection Methods

Checksum

Example:The receiver follows the same procedure as the sender. It adds all data items (including the checksum); the result is 45. The sum is wrapped and becomes 15. The wrapped sum is complemented and becomes 0.

Since the value of the checksum is 0, this means that the data is not corrupted. The receiver drops the checksum and keeps the other data items.

If the checksum is not zero, the entire packet is dropped.

Page 53: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection Error Detection Methods

Checksum

Page 54: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection Error Detection Methods

Checksum

The sender follows these steps:The unit is divided into k sections, each of n bits.All sections are added using one’s complement to get the sum.The sum is complemented and becomes the checksum.The checksum is sent with the data.

The receiver follows these steps:The unit is divided into k sections, each of n bits.All sections are added using one’s complement to get the sum.The sum is complemented.If the result is zero, the data are accepted: otherwise, rejected.

Page 55: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection Error Detection Methods

Checksum

Suppose the following block of 16 bits is to be sent using a checksum of 8 bits.

10101001 00111001

The numbers are added using one’s complement 10101001 00111001

----------------Sum = 11100010Checksum = 00011101

The pattern sent is 10101001 00111001 00011101

Page 56: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection Error Detection Methods

Checksum

Now suppose the receiver receives the pattern sent and there is no error.

10101001 00111001 00011101

When the receiver adds the three sections, it will get all 1s, which, after complementing, is all 0s and shows that there is no error.

1010100100111001 00011101 ----------------

Sum = 11111111 Complement = 00000000

It means that the pattern is OK.

Page 57: Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311

Error Detection Error Detection Methods

Checksum

Now suppose there is a burst error of length 5 that affects 4 bits. 10101111 11111001 00011101

When the receiver adds the three sections, it gets 1010111111111001 00011101

Partial Sum 1 11000101Carry 1Sum 11000110 Complement 00111001

It means the pattern is corrupted.

10101001 00111001 00011101