Transmissin Errrs Errr Detectin and Crrectin 1
Transmissin Errrs Transmissin errrs are caused by: thermal nise {Shannn} impulse nise (e..g, arcing relays) signal distrtin during transmissin (attenuatin) crsstalk vice amplitude signal cmpressin (cmpanding) quantizatin nise (PCM) jitter (variatins in signal timings) receiver and transmitter ut f synch. 2
Errr Detectin and Crrectin errr detectin :: adding enugh etra bits t deduce that there is an errr but nt enugh bits t crrect the errr. If nly errr detectin is emplyed in a netwrk transmissin retransmissin is necessary t recver the frame (data link layer) r the packet (netwrk layer). At the data link layer, this is referred t as ARQ (Autmatic Repeat request). 3
Errr Detectin and Crrectin errr crrectin :: requires enugh additinal (redundant) bits t deduce what the crrect bits must have been. Eamples Hamming Cdes FEC = Frward Errr Crrectin fund in MPEG-4 fr streaming multimedia. 4
Hamming Cdes cdewrd :: a legal datawrd cnsisting f m data bits and r redundant bits. Errr detectin invlves determining if the received message matches ne f the legal cdewrds. Hamming distance :: the number f bit psitins in which tw bit patterns differ. Starting with a cmplete list f legal cdewrds, we need t find the tw cdewrds whse Hamming distance is the smallest. This determines the Hamming distance f the cde. 5
Errr Crrecting Cdes Nte Check bits ccupy pwer f 2 slts Figure 3-7. Use f a Hamming cde t crrect burst errrs. 6
(a) A cde with pr distance prperties (b) A cde with gd distance prperties = cdewrds = nn-cdewrds Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.51 7
Hamming Cdes T detect d single bit errrs, yu need a d+1 cde distance. T crrect d single bit errrs, yu need a 2d+1 cde distance. In general, the price fr redundant bits is t epensive t d errr crrectin fr netwrk messages. Netwrk prtcls use errr detectin and ARQ. 8
Errr Detectin Remember errrs in netwrk transmissins are bursty. The percentage f damage due t errrs is lwer. It is harder t detect and crrect netwrk errrs. Linear cdes Single parity check cde :: take k infrmatin bits and appends a single check bit t frm a cdewrd. Tw-dimensinal parity checks IP Checksum Plynmial Cdes Eample: CRC (Cyclic Redundancy Checking) 9
General Errr Detectin System User infrmatin All inputs t channel satisfy pattern/cnditin Encder Channel Channel utput Pattern Checking Deliver user infrmatin r set errr alarm Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.49 10
Errr Detectin System Using Check Bits Infrmatin bits Received infrmatin bits Recalculate check bits Calculate check bits Check bits Channel Received check bits Cmpare Infrmatin accepted if check bits match Len-Garcia & Widjaja: Cmmunicatin Netwrks Cpyright 2000 The McGraw Hill Cmpanies Figure 3.50 11
Tw-dimensinal Parity Check Cde 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 0 Last clumn cnsists f check bits fr each rw 1 1 0 1 1 0 1 0 0 1 1 1 Bttm rw cnsists f check bit fr each clumn Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.52 12
1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1 1 0 One errr 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 1 1 0 Tw errrs 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 1 0 Three errrs 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 0 Fur errrs 1 0 0 1 1 1 1 0 0 1 1 1 Arrws indicate failed check bits Figure 3.53 13 Cpyright 2000 The McGraw Hill Cmpanies
Internet Checksum unsigned shrt cksum(unsigned shrt *addr, int cunt) { /*Cmpute Internet Checksum fr cunt bytes * beginning at lcatin addr. */ register lng sum = 0; while ( cunt > 1 ) { /* This is the inner lp*/ sum += *addr++; cunt -=2; } /* Add left-ver byte, if any */ if ( cunt > 0 ) sum += *addr; /* Fld 32-bit sum t 16 bits */ while (sum >>16) sum = (sum & 0ffff) + (sum >> 16) ; } return ~sum; Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.54 14
Plynmial Cdes Used etensively. [LG&W pp. 161-167] 167] Implemented using shift-register circuits fr speed advantages. Als called CRC (cyclic redundancy checking) because these cdes generate check bits. Plynmial cdes :: bit strings are treated as representatins f plynmials with ONLY binary cefficients (0 s and 1 s). 15
Plynmial Cdes The k bits f a message are regarded as the cefficient list fr an infrmatin plynmial f degree k-1. I :: i() = i k-1 + i k-2 + + i + i k-1 k-2 1 0 Eample: 1 0 1 1 0 0 0 i() = 6 + 4 + 3 16
Plynmial Ntatin Encding prcess takes i() prduces a cdewrd plynmial b() that cntains infrmatin bits and additinal check bits that satisfy a pattern. Let the cdewrd have n bits with k infrmatin bits and n-k check bits. We need a generatr plynmial f degree n-k f the frm G = g() = n-k + g n-k-1 + + g + 1 n-k-1 1 Nte the first and last cefficient are always 1. 17
CRC Cdewrd k infrmatin bits n-k check bits n bit cdewrd 18
Plynmial Arithmetic Additin: Multiplicatin: ( 7 + 6 +1) + ( 6 + 5 ) = 7 + (1 +1) 6 + 5 +1 = 7 + 5 +1 ( +1)( 2 + +1) = 3 + 2 + + 2 + +1 = 3 +1 3 + 2 + = q() qutient Divisin: 3 + + 1 ) 6 + 5 divisr 3 35 ) 122 105 17 6 + 4 + 3 5 + 4 + 3 5 + 3 + 2 4 + 2 4 + 2 + dividend = r() remainder Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.55 19
CRC Algrithm CRC Steps: 1) Multiply i() by n-k (puts zers in (n-k) lw rder psitins) 2) Divide n-k i() by g() qutient remainder n-k i() = g() q() + r() 3) Add remainder r() t n-k i() (puts check bits in the n-k lw rder psitins): b() = n-k i() + r() transmitted cdewrd Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.56 20
Infrmatin: (1,1,0,0) i() = 3 + 2 Generatr plynmial: g()= 3 + + 1 Encding: 3 i() = 6 + 5 3 + 2 + 3 + + 1 ) 6 + 5 6 + 4 + 3 5 + 4 + 3 5 + 3 + 2 4 + 2 4 + 2 + Transmitted cdewrd: b() = 6 + 5 + b = (1,1,0,0,0,1,0) 1110 1011 ) 1100000 1011 1110 1011 1010 1011 010 Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.57 21
Cyclic Redundancy Checking Figure 3-8. 3 Calculatin f the plynmial cde checksum. 22
Generatr Plynmial Prperties fr Detecting Errrs GOAL :: minimize the ccurrence f an errr ging undetected. Undetected means E() / G() has n remainder. Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.61 23
Generatr Plynmial Prperties fr Detecting Errrs 1. Single bit errrs: e() = i 0 i n-1 If g() has mre than ne term, it cannt divide e() 2. Duble bit errrs: e() = i + j 0 i < j n-1 = i (1 + j-i ) If g() is primitive plynmial, it will nt divide (1 + j-i ) fr j-i 2 n-k 1 3. Odd number f bit errrs: e(1) = 1 If number f errrs is dd. If g() has (+1) as a factr, then g(1) = 0 and all cdewrds have an even number f 1s. Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.60 24
Generatr Plynmial Prperties fr Detecting Errrs 4. Errr bursts f length L: 0000110 0001101100 0 e() = i d() where deg(d()) = L-1 g() has degree n-k; g() cannt divide d() if deg(g())> deg(d()) L errr pattern d() ith psitin IfL = (n-k) r less: all errrs will be detected IfL = (n-k+1): deg(d()) = deg(g()) i.e. d() = g() is the nly undetectable errr pattern, fractin f bursts which are undetectable = 1/2 L-2 IfL > (n-k+1) : fractin f bursts which are undetectable = 1/2 n-k Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 3.61 25
Standard Generating Plynmials CRC-16 = X 16 + X 15 + X 2 + 1 CRC-CCITT= X 16 + X 12 + X 5 + 1 CRC-32 = X 32 + X 26 + X 23 + X 22 IEEE 802 LAN standard + X 16 + X 12 + X 11 + X 10 + X 8 + X 7 + X 5 + X 4 + X 2 + X + 1 26
Basic ARQ with CRC Packet sequence Transmitter Infrmatin frames Receiver Errr-free packet sequence Statin A Cntrl frames Statin B CRC Infrmatin packet Infrmatin Frame Header CRC Header Cntrl frame Cpyright 2000 The McGraw Hill Cmpanies Len-Garcia & Widjaja: Cmmunicatin Netwrks Figure 5.8 27