Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus...

21
Chapter 3 Digital Transmission Fundamentals Error Detection and Correction CSE 3213, Winter 2010 Instructor: Foroohar Foroozan

Transcript of Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus...

Page 1: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Chapter 3 Digital Transmission

FundamentalsError Detection and Correction

CSE 3213, Winter 2010Instructor: Foroohar Foroozan

Page 2: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

2

Modulo 2 arithmetic is performed digit by digit on binary numbers.Each digit is considered independently from its neighbours.Numbers are not carried or borrowed.

Modulo-2 Arithmetic

Page 3: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

3

Data Link layer

Page 4: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Chapter 3Digital Transmission

FundamentalsError Detection and Correction

Page 5: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Error Control

– data sent from one computer to another should be transferredreliably – unfortunately, the physical link cannot guarantee thatall bits, in each frame, will be transferred without errors

• error control techniques are aimed at improving the error-rateperformance offered to upper layer(s), i.e. end-application

Why Error Control?

Probability of Single-Bit Error

– aka bit error rate (BER) :

• wireless medium: pb=10-3

• copper-wire: pb=10-6

• fibre optics: pb=10-9

Approaches toError Control

(1) Error Detection + Automatic Retransmiss. Request (ARQ)• fewer overhead bits ☺• return channel required• longer error-correction process and waste of bandwidth

when errors are detected(2) Forward Error Correction (FEC)

• error detection + error correction

Page 6: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Error ControlTypes of Errors (1) Single Bit Errors

• only one bit in a given data unit (byte, packet, etc.)gets corrupted

(2) Burst Errors

• two or more bits in the data unit have been corrupted• errors do not have to occur in consecutive bits• burst errors are typically caused by external noise

(environmental noise)• burst errors are more difficult to detect / correct

Page 7: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Key Idea– redundancy!!! – add enough extra information (bits) for

detection / correction of errors at the destination

• redundant bits = ‘compressed’ version of original data bits• error correction requires more redundant bits than error detection• more redundancy bits ⇒ better error control ☺ ⇒ more overhead

Calculate check bits

Channel

Recalculate check bits

Compare

Information bits Received information bits

Sent checkbits

Information accepted if check bits match

Received check bits

k bits

n – k bits

1 0 0 1 0 1 01

1 0

1 0 0 0 1 01 1 0f(S)1 0 0 0 1 01

f(S’)1 0 0 0

11

comp

Page 8: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Hamming Distance between 2 Codes– number of differences between corresponding bits

• can be found by applying XOR on two codewordsand counting number of 1s in the result

Minimum Hamming Distance (dmin) in a Code

– minimum Hamming distance between all possible pairs in a set of codewords

• dmin bit errors will make one codeword look like another

• larger dmin – better robustness to errors

Example [ k=2, n=5 code ]Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bitlong codewords.

Hamming Distance

Page 9: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

9

Minimum Hamming Distancefor Error Detection

– to guarantee detection of up to s errorsin all cases, the minimum Hammingdistance must be

dmin = s + 1

Example [ code with dmin=2 is able to detect s=1 bit-errors ]

Hamming Distance

Page 10: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

10

Minimum Hamming Distancefor Error Correction

– to guarantee correction of up to t errorsin all cases, the minimum Hammingdistance must be

dmin = 2t + 1

Example [ Hamming distance ]A code scheme has a Hamming distance dmin=4. What is the error detection anderror correction capability of this scheme?

The code guarantees the detection of up to three errors (s=3), but it can correctonly 1-bit errors!

Hamming Distance

Page 11: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

x = codewordso = noncodewords

x

x x

x

x

x

x

o

oo

oo

oo

ooo

o

o

ox

x xx

xx

x

o o

oo

ooooo

o

o Poordistance

properties

What is a good code?Many channels have preference for error patterns that have fewer # of errorsThese error patterns map transmitted codeword to nearby n-tupleIf codewords close to each other then detection failures will occurGood codes should maximize separation between codewords

Gooddistance

properties

Page 12: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Error Detection: Single Parity Check

Append an overall parity check to k information bits

Info Bits: b1, b2, b3, …, bk

Check Bit: bk+1= b1+ b2+ b3+ …+ bk modulo 2

Codeword: (b1, b2, b3, …, bk,, bk+!)

• receiver checks if number of 1s is evenreceiver CAN DETECT all single-bit errors and bursterrors with odd number of corrupted bitssingle-bit errors CANNOT be CORRECTED – positionof corrupted bit remains unknown

all even-number burst errors are undetectable !!!

Error Detection Techniques

Single Parity Check(Even Parity)

Page 13: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Example of Single Parity Code

Information (7 bits): (0, 1, 0, 1, 1, 0, 0)Parity Bit: b8 = 0 + 1 +0 + 1 +1 + 0 = 1Codeword (8 bits): (0, 1, 0, 1, 1, 0, 0, 1)If single error in bit 3 : (0, 1, 1, 1, 1, 0, 0, 1)

# of 1’s =5, oddError detected

If errors in bits 3 and 5: (0, 1, 1, 1, 0, 0, 0, 1)# of 1’s =4, evenError not detected

Page 14: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

14

Example [ single parity check code C(5,4) ]

Single Parity Check Codesand Minimum Hamming Distance (dmin)

– for ALL parity check codes, dmin = 2

Error Detection: Single Parity Check

Page 15: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Effectiveness of Single Parity Check

original codeword:

received codeword:

]... n321 bb b[bb =

]... 'n

'3

'2

'1

' bb b[bb =

error vector: ]... n321 ee e[ee =

⎪⎩

⎪⎨⎧

=

≠=

'kk

'kk

k bb if 0,bb if 1,

e

(1) Random Error Vector Channel Model

1 0 0 1 0 1

1 101 1 0 11

01

0 1 0 0 1 000

– there are 2n possible error vectors – all error are equally likely

• e.g. e=[0 0 0 0 0 0 0 0] and e=[1 1 1 1 1 1 1 1] are equally likely

• 50% of error vectors have an even # of 1s,50% of error vectors have an odd # of 1s

• probability of error detection failure = 0.5

• not very realistic channel model !!!

Error Detection: Single Parity Check

Page 16: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

Error Detection: Single Parity Check

(2.1) probability of singlebit error (w(e)=1)

– where w(e) represents the number of 1s in e• bit-error occurs at an arbitrary (but particular)

position

)p(1)p(1)p(1...p)p(1)p(1)P( bbbbbb −⋅−⋅−⋅⋅⋅−⋅−== 1w(e)

probability of correctlytransmitted bit

e1=0 e2=0 e3=1 en-2=0 en-1=0 en=0

b1-n

b p)p(1)P( ⋅−== 1w(e)

1 0 0 1 0 0

1 0 1 1 0 0

1 0

01

(2) Random Bit Error Channel Model– bit errors occur independently of each other –

pb = probability of error in a single-bit transmission

Page 17: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

17

(2.2) probability of two bit errors: w(e)=2

⎟⎟⎠

⎞⎜⎜⎝

⎛−

⋅⋅−=⋅−==b

bb

1-nb

2b

2-nb p1

pp)p(1)(p)p(1)P( 2w(e)

)P(p1

p)P( )P(b

b 1w(e)1w(e)2w(e) === <⎟⎟⎠

⎞⎜⎜⎝

⎛−

⋅=

<1, since pb<0.5

1-bit errors are more likely 2-bit errors, and so forth!

(2.3) probability of w(e)=k bit errors: w(e)=k

( ) 1k1k

b

bb

1-nb

kb

k-nb a)P(

p1pp)p(1)(p)p(1)P( −

⋅=⎟⎟⎠

⎞⎜⎜⎝

⎛−

⋅⋅−=⋅−= == 1w(e)kw(e)

)P()P( )P( 1w(e)2w(e)kw(e) =<=<<= ...

Error Detection: Single Parity Check

Page 18: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

18

(2.4) probability that single parity check fails?!

... )P(*errors) bit6 of# )P(*errors) bit4 of# )P(*errors) bit2 of#

...)P()P()P()P()P(

+−++−++−=

=+++===

=

=

=

6w(e)4w(e)2w(e)

(((

error bit6 anyerror bit4 anyerror bit2 any1s of number even withpatterns errorfailure detection error

k)!(nk!n!

kn

errors) bitk of(#−

=⎟⎟⎠

⎞⎜⎜⎝

⎛=−

...+−⎟⎟⎠

⎞⎜⎜⎝

⎛+−⎟⎟

⎞⎜⎜⎝

⎛+−⎟⎟

⎞⎜⎜⎝

⎛= −−− 6n

b6b

4nb

4b

2nb

2b )p(1p

6n

)p(1p4n

)p(1p2n

)P( failure detection error

1 0 0 1 1 0 01

1 001 1 0 01

progressively smaller components …

number of combinations ‘n choose k’:

Error Detection: Single Parity Check

Page 19: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

19

Example [ probability of error detection failure ]

Assume there are n=32 bits in a codeword (packet). Probability of error in a single bittransmission pb = 10-3. Find the probability of error-detection failure.

...+−⎟⎟⎠

⎞⎜⎜⎝

⎛+−⎟⎟

⎞⎜⎜⎝

⎛+−⎟⎟

⎞⎜⎜⎝

⎛= 26

b6b

28b

4b

30b

2b )p(1p

632

)p(1p432

)p(1p232

)P( failure detection error

62330b

2b 10*496)(10

231*32)p(1p

232 −− =≈−⎟⎟

⎞⎜⎜⎝

124328b

4b 10*35960)(10

4*3*229*3031**32)p(1p

432 −− =≈−⎟⎟

⎞⎜⎜⎝

2000110*4.9610*496)P( 46failure detection error ≈== −−

Approximately, 1 in every 2000 transmitted 32-bit long codewords is corrupted withan error pattern that cannot be detected with single-bit parity check.

Error Detection: Single Parity Check

Page 20: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

20

Two Dimensional Parity Check

– a block of bits is organized in a table (rows + columns)a parity bit is calculated for each row and column

• 2-D parity check increases the likelihood of detectingburst errors

all 1-bit errors CAN BE DETECTED and CORRECTEDall 2-, 3- bit errors can be DETECTED4- and more bit errors can be detected in some cases

• drawback: too many check bits !!!

Error Detection: 2-D Parity Check

Page 21: Chapter 3 Digital Transmission · Code that adds 3 redundant bits to every 2 information bits, thus resulting in 5-bit. long codewords. Hamming Distance. 9. Minimum Hamming Distance.

21

Example [ effectiveness of 2-D parity check ]

0 0 0

000

Two-Dimensional Parity Check