data communication and networking

43
Data Communication and Networking 332 Hardware Components of Data Communications

Upload: hollye

Post on 25-Feb-2016

39 views

Category:

Documents


0 download

DESCRIPTION

Data Communication and Networking. 332 Hardware Components of Data Communications. Lecture Overview. Error Detection Single-Bit Error Burst Error Error Detection Mechanism Redundancy Parity Check CRC Checksum Block Code Hamming Code. Error Detection and Correction. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Data Communication and Networking

Data Communication and Networking332 Hardware Components of Data Communications

Page 2: Data Communication and Networking

Lecture Overview• Error Detection• Single-Bit Error• Burst Error• Error Detection Mechanism• Redundancy• Parity Check• CRC• Checksum• Block Code• Hamming Code

Page 3: Data Communication and Networking

Error Detection and Correction

• Data can be corrupted during transmission. For reliable communication, errors must be detected and corrected.

• Types of Error:– Single-Bit Error– Burst Error

Page 4: Data Communication and Networking

Single-bit Error• In a single-bit error, only one bit

in the data unit has changed

Page 5: Data Communication and Networking

Burst Error• A burst error means that 2 or

more bits in the data unit have changed.

Page 6: Data Communication and Networking

Error Detection Mechanism

• The two broad categories of error detection mechanisms are:– Forward error control– Feedback error control

Page 7: Data Communication and Networking

Forward Error Control Character frame contains a more

comprehensive form of redundant information. So that the receiver is able to detect and correct the erroneous information.

It is used in simplex communication mode and in situation where retransmission is not possible. For example: Radio broadcast in which there are many receivers for one transmission.

Disadvantages: Expensive and number of additional bits (oh) increases rapidly as the number of information bits increases.

Page 8: Data Communication and Networking

Feedback Error Control Character frame includes only sufficient

additional information for the receiver to detect errors are present and employ retransmission to request the another correct copy of the erroneous information be sent.

Advantages: It is simple to use and extremely effective.

Disadvantage: The multiple retransmission can reduce the throughput to a small fraction of the link’s capacity.

Page 9: Data Communication and Networking

Types of Error Detection

i) Redundancy

ii) Parity Check

iii) Cyclic Redundancy Check (CRC)

iv) Checksum

Page 10: Data Communication and Networking

Redundancy• Error detection uses the concept of

redundancy, which means adding extra bits for detecting errors at the destination.

Page 11: Data Communication and Networking

Parity Check• Common in ‘small’ information• Common when probability of error is low• Can be odd or even• Only one extra bit is added

In parity check, a parity bit is added to every data unit so that the total number of 1s is even or odd . With even parity, another bit is added to produce an even number of binary 1s. With odd parity, another bit is added to produce an odd number of binary 1s.

Page 12: Data Communication and Networking

Even-Parity Check

Page 13: Data Communication and Networking

Odd-Parity Check

0

Page 14: Data Communication and Networking

Parity Check

0

Example 1

Suppose the sender wants to send the word world. In ASCII the five characters are coded as 1110111 1101111 1110010 1101100 1100100

The following shows the actual bits sent if EVEN parity is used.

11101110 11011110 11100100 11011000 11001001

Page 15: Data Communication and Networking

Parity CheckExample 2

Now suppose the word world in Example 1 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.

Page 16: Data Communication and Networking

Parity CheckExample 3

Now suppose the word world in Example 1 is corrupted during transmission. 11111110 11011110 11101100 11011000 11001001The 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.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 17: Data Communication and Networking

Two Dimensional Paritya.k.a BCC or 2 coordinate parity check

Page 18: Data Communication and Networking

Two Dimensional ParityExample 4

Suppose the following block is sent: 10101001 00111001 11011101 11100111 10101010 However, it is hit by a burst noise of length 8, and some bits are corrupted. 10100011 10001001 11011101 11100111 10101010 When the receiver checks the parity bits, some of the bits do not follow the even-parity rule and the whole block is discarded. 10100011 10001001 11011101 11100111 10101010

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

Page 19: Data Communication and Networking

Two Dimensional Parity

10101001 00111001 11011101 11100111 10101010

1 0 1 0 0 0 1 1

0 0 0 0 1 0 0 1

1 1 0 1 1 1 0 11 1 1 0 0 1 1 1

1 0 1 0 1 0 1 0

0 0 0 0 0 0

1 0 1 0 1 0 0 1

0 0 1 1 1 0 0 1

1 1 0 1 1 1 0 1

1 1 1 0 0 1 1 1

1 0 1 0 1 0 1 0

0 0 0 0 0 0 0

Two-dimensional parity – detect multiple errors

Error detected

HorizontallyError notdetected

Page 20: Data Communication and Networking

Two Dimensional Parity

10101001 00111001 11011101 11100111 10101010

1 0 1 0 0 0 0 0

0 0 1 1 1 0 0 1

1 1 0 1 1 1 0 11 1 1 0 0 1 1 1

1 0 1 0 1 0 1 0

0 0 0 0 1 0 0

1 0 1 0 1 0 0 1

0 0 1 1 1 0 0 1

1 1 0 1 1 1 0 1

1 1 1 0 0 1 1 1

1 0 1 0 1 0 1 0

0 0 0 0 0 0 0

Two-dimensional parity – correct single error

Error dectected

HorizontallyError detected

Error corrected to 1

Page 21: Data Communication and Networking

Cyclic Redundancy Check• CRC appends a few bits to the end of the bit string

• The receiver performs a computation which should yield 0 for Error free message.

• Yield of Non 0 means there has been an error in one or more bits

• CRC can detect an impressive range of error but not all.

• 32 bits of CRC is sufficient for 12KB of messages for the Ethernet.

Page 22: Data Communication and Networking

Cyclic Redundancy Check

CRC generator and checker

Page 23: Data Communication and Networking

Polynomial Code• Provide a reliable detection scheme against error

bursts• Can also provide error correction but not normally

used• Also called CRC

Rules:1. Binary information is represented as a polynomial

E.g. 1 0 1 1 0 1 = x5 + x3 + x2 + 1

2. These polynomials obeys the law of algebra but addition is base2 & NO carry is generated.

i.e. -1+1=0, 1+0=1; 0+1=1; 0+0=0;

Subtraction is equivalent to addition

Page 24: Data Communication and Networking

A Polynomial

Page 25: Data Communication and Networking

A PolynomialA polynomial representing a divisor

Page 26: Data Communication and Networking

Generating PolynomialMethod:

Message = G (x)CRC generating polynomial = P(x) of order nRemainder R(x) = G(x) * Xn / P(x)

Frame Check Sequence (FRC) = G(x) * Xn + R(x)

Page 27: Data Communication and Networking

Generating Polynomial

Message = 1 0 0 1 0 0

CRC generating polynomial = P(x) of order n

Remainder R(x) = G(x) * Xn / P(x) = 100100*1000 / 1101 = 001

Frame Check Sequence (FRC) = G(x) * Xn + R(x)= 100100001

P(x) 1 1 0 1

x3 + x2 + 1

Page 28: Data Communication and Networking

Binary Division in CRC Generator

1 0 0 1 0 0 0 0 01 1 0 11

1 1 0 1001 0

1

1 1 0 1101 0

1

1 1 0 11 11 0

1 1 0 111

1

0

0

00 0 0 0

01 1 0

1

1 1 0 1100

When the leftmost bitof the remainder is zerowe must use 0000 insteadof the original divisor

Page 29: Data Communication and Networking

Binary Division in CRC Checker

Zero results means NO error

Page 30: Data Communication and Networking

Binary Division in CRC Checker

Example 5

The CRC-12

x12 + x11 + x3 + x + 1which has a degree of 12, will detect all burst errors affecting an odd number of bits, will detect all burst errors with a length less than or equal to 12, and will detect, 99.97 percent of the time, burst errors with a length of 12 or more.

1100000001011

Page 31: Data Communication and Networking

Checksum

Page 32: Data Communication and Networking

Data Unit & Checksum

The sender follows these steps:

1. The unit is divided into k sections, each of n bits.

2. All sections are added using one’s complement to get the sum.

3. The sum is complemented and becomes the checksum.

4. The checksum is sent with the data.

Page 33: Data Communication and Networking

Data Unit & Checksum

The receiver follows these steps:

1. The unit is divided into k sections, each of n bits.

2. All sections are added using one’s complement to get the sum.

3. The sum is complemented.

4. If the result is zero, the data are accepted: otherwise, rejected.

Page 34: Data Communication and Networking

Data Unit & ChecksumExample 6

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 00011101The pattern sent is 10101001 00111001 00011101

Page 35: Data Communication and Networking

Data Unit & ChecksumExample 7

Now suppose the receiver receives the pattern sent in Example 7 and there is no error. 10101001 00111001 00011101When 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 means that the pattern is OK.

Page 36: Data Communication and Networking

Data Unit & ChecksumExample 8

Now suppose there is a burst error of length 5 that affects 4 bits. 10101111 11111001 00011101When the receiver adds the three sections, it gets

1010111111111001 00011101

Partial Sum 1 11000101Carry 1Sum 11000110 Complement 00111001 the pattern is corrupted.

Page 37: Data Communication and Networking

Block Code

•In coding theory, block codes comprise the large and important family of error-correcting codes that encode data in blocks.

•Block Codes are conceptually useful because they allow coding theorists, mathematicians, and computer scientists to study the limitations of all block codes in a unified way.

•Example of block code : Hamming Code

Page 38: Data Communication and Networking

Hamming Code

r is also known as the check bit.

Page 39: Data Communication and Networking

General Algorithm of Hamming Code

• All bit positions that are powers of two are used as parity bits. (positions 1, 2, 4, 8, 16, 32, 64, etc.)

• All other bit positions are for the data to be encoded. (positions 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, etc.)

• Each parity bit calculates the parity for some of the bits in the code word. The position of the parity bit determines the sequence of bits that it alternately checks and skips.

– Position 1 (n=1): skip 0 bit (0=n−1), check 1 bit (n), skip 1 bit (n), check 1 bit (n), skip 1 bit (n), etc. (1,3,5,7,9,11,13,15,...)

– Position 2 (n=2): skip 1 bit (1=n−1), check 2 bits (n), skip 2 bits (n), check 2 bits (n), skip 2 bits (n), etc. (2,3,6,7,10,11,14,15,...)

– Position 4 (n=4): skip 3 bits (3=n−1), check 4 bits (n), skip 4 bits (n), check 4 bits (n), skip 4 bits (n), etc. (4,5,6,7,12,13,14,15,20,21,22,23,...)

– Position 8 (n=8): skip 7 bits (7=n−1), check 8 bits (n), skip 8 bits (n), check 8 bits (n), skip 8 bits (n), etc. (8-15,24-31,40-47,...)

– Position 16 (n=16): skip 15 bits (15=n−1), check 16 bits (n), skip 16 bits (n), check 16 bits (n), skip 16 bits (n), etc. (16-31,48-63,80-95,...)

– Position 32 (n=32): skip 31 bits (31=n−1), check 32 bits (n), skip 32 bits (n), check 32 bits (n), skip 32 bits (n), etc. (32-63,96-127,160-191,...)

– General rule for position n: skip n−1 bits, check n bits, skip n bits, check n bits...

– And so on.

Page 40: Data Communication and Networking

General Algorithm of Hamming Code

Bit position 1 2 3 4 5 6 7 8 9 10

11

12

13 14 15 1

6 17 18 19 20

...

Encoded data bits

p1

p2

d1

p3

d2

d3

d4

p4

d5

d6

d7

d8

d9

d10

d11

p5

d12

d13

d14

d15

Paritybit

coverage

p1 X X X X X X X X X X

p2 X X X X X X X X X X

p3 X X X X X X X X X

p4 X X X X X X X X

p5 X X X X X

Page 41: Data Communication and Networking

Redundancy Hamming Code bits Calculation

Page 42: Data Communication and Networking

Redundancy Hamming Code bits Calculation

Example of redundancy bit calculation

Page 43: Data Communication and Networking

QUESTIONS?