Lecture 4

12
1 Lecture Lecture 4 4 - Error Detection Error Detection - Forward Error Correction Forward Error Correction (Hamming Code) (Hamming Code) -

description

Lecture 4. Error Detection Forward Error Correction (Hamming Code). 1- Error Detection. 1.1 Parity check 1.2 Two dimensional parity check 1.3 Checksum 1.4 Cyclic redundancy check. 1.1 Parity check. - Appends a parity bit to the end of the data. 10110010 0 Even - PowerPoint PPT Presentation

Transcript of Lecture 4

Page 1: Lecture  4

1

Lecture Lecture 44

- Error DetectionError Detection

- Forward Error Correction (Hamming Forward Error Correction (Hamming Code)Code)

-

Page 2: Lecture  4

2

1- Error Detection1- Error Detection

1.1 Parity check1.1 Parity check

1.2 Two dimensional parity check1.2 Two dimensional parity check

1.3 Checksum1.3 Checksum

1.4 Cyclic redundancy check1.4 Cyclic redundancy check

Page 3: Lecture  4

3

1.1 Parity check1.1 Parity check

- Appends a parity bit to the end of the data.- Appends a parity bit to the end of the data.

10110010 10110010 00 Even Even

10110010 10110010 11 Odd Odd

- It can detect all single bit errors.- It can detect all single bit errors.

-It can also detect burst errors, if the number ofIt can also detect burst errors, if the number of

bits in error is odd. bits in error is odd.

Page 4: Lecture  4

4

1.2 Two Dimensional Parity 1.2 Two Dimensional Parity CheckCheck

-Parity check bits are calculated for each row, which isParity check bits are calculated for each row, which is- equivalent to a simple parity check bit.equivalent to a simple parity check bit.

-Parity check bits are also calculated for all columns.Parity check bits are also calculated for all columns.

-Both are sent along with the data. Both are sent along with the data.

Page 5: Lecture  4

5

1.2 Two Dimensional Parity 1.2 Two Dimensional Parity CheckCheck

Page 6: Lecture  4

6

1.3 Checksum1.3 Checksum

- At the sender’s end, the data is divided into - At the sender’s end, the data is divided into segments.segments.-The segments are added using ones complement The segments are added using ones complement arithmetic to get the sum.arithmetic to get the sum.-The sum is complemented to get the checksum The sum is complemented to get the checksum which is sent along with the data segments.which is sent along with the data segments.

-At the receiver, the received segments are added At the receiver, the received segments are added using ones complement arithmetic to get the sum.using ones complement arithmetic to get the sum.-If the complement of the sum is zero, the received If the complement of the sum is zero, the received data is accepted.data is accepted.

Page 7: Lecture  4

7

1.3 Checksum1.3 Checksum

1011001110101011__________01011110

1_______________

0101111101011010

_______________1011100111010101

______________10001110 1

_____________sum: 10001111

Checksum: 01110000

1011001110101011__________01011110

1_______________

0101111101011010

_______________1011100111010101

______________10001110 1

_____________1000111101110000

________________Sum: 11111111

Checksum: 00000000

Ex: Find the checksum at the sender and receiver for the Ex: Find the checksum at the sender and receiver for the following sequence: 10110011 10101011 01011010 11010101 following sequence: 10110011 10101011 01011010 11010101

Page 8: Lecture  4

8

1.4 Cyclic Redundancy Check1.4 Cyclic Redundancy Check

-The sender generates a bit sequence known as a frame The sender generates a bit sequence known as a frame check sequence (FCS), so that the resulting frame check sequence (FCS), so that the resulting frame consisting of the original data followed by this FCS.consisting of the original data followed by this FCS.

- FCS is the remainder which obtained from dividing the - FCS is the remainder which obtained from dividing the original data M(X) byoriginal data M(X) by generator polynomial G(x). generator polynomial G(x).

- The receiver divides the incoming frame by G(X), if - The receiver divides the incoming frame by G(X), if there is no remainder the received data has no errors. there is no remainder the received data has no errors.

Page 9: Lecture  4

9

1.4 Cyclic Redundancy Check1.4 Cyclic Redundancy Check1)(,)(. 33 XXXGXXXMEX

1010000*)( 4633 XXXXX

1011)(

*1*1*0*11)( 01233

XG

XXXXXXXG

1 0 1 0 0 0 01 0 1 1

________ 0 0 1 0 0 0 0 0

_________ 0 1 0 0 0 0 0 0

__________ 1 0 0 0 1 0 1 1

__________ FCS 0 1 1

1011

1001

1 0 1 0 0 1 11 0 1 1

________ 0 0 1 0 0 0 0 0

_________ 0 1 0 1 0 0 0 0

__________ 1 0 1 1 1 0 1 1

__________ 0 0 0

1011

1001

Page 10: Lecture  4

10

1.4 Cyclic Redundancy Check1.4 Cyclic Redundancy Check

1)(,)(

Re.33 XXXGXXXMIf

processCRCimplementtogisterShiftFeedbackLinearUseEX

1001000*)( 36303 XXXXX

C3 C1 C0+ +

1010000

000

001

010

101

001

010

100

011

1 0 1 0 0 0 0Initial

FCS

Page 11: Lecture  4

11

2- Forward Error Correction2- Forward Error Correction

-Forward Error correction (FEC) which based on the receiver only is used mainly when retransmissions cannot be requested, e.g., simplex links.

-Backward error correction which based on retransmission of the frame when an error is detected is commonly used.

Hamming Code:

• It can correct any single bit error• Bits in power of 2 positions (1,2,4,8,) are check bits, the rest are m data bits• Check bit forces the parity of some collection of bit “1” to be even • To see which check bits the data bit in position k contributes to, rewrite k as a sum of powers of 2.

11=1+2+8, 29=1+4+8+16

Page 12: Lecture  4

12

Hamming CodeHamming CodeEX: If a 12-bit hamming code 100110111000 arrives at receiver, is there EX: If a 12-bit hamming code 100110111000 arrives at receiver, is there

any bit error? If so, which bit is wrong?any bit error? If so, which bit is wrong?

1 2 3=2+1 4 5=4+1 6=4+2 7=4+2+1 8 9=8+1 10=8+2 11=8+2+1

12=8+4

1 0 0 1 1 0 1 1 1 0 0 0ChecCheck bitk bit

Checked Data bitsChecked Data bits Bits SequenceBits Sequence

11 3 5 7 9 113 5 7 9 11 1 0 1 1 1 0 (Yes)1 0 1 1 1 0 (Yes)

22 3 6 7 10 113 6 7 10 11 0 0 0 1 0 0 (0 0 0 1 0 0 (NoNo))

44 5 6 7 125 6 7 12 1 1 0 1 0 (1 1 0 1 0 (NoNo))

88 9 10 11 129 10 11 12 1 1 0 0 0 (Yes)1 1 0 0 0 (Yes)

Hence bit 6 = 2+4 is wrong, so correct hamming code should be 100111111000