Вы находитесь на странице: 1из 7

COMPUTER NETWORK

LECTURE NOTES Volume-6

COMPUTER NETWORK

LECTURE NOTES Volume-6

Error Detection and Correction


Datacanbecorruptedduringtransmission. Someapplicationsrequirethaterrorsbedetectedandcorrected. Letusfirstdiscusssomeissuesrelated,directlyorindirectly,toerrordetectionandcorrection. INASINGLEBITERROR,ONLY1BITINTHEDATAUNITHASCHANGED.

INMODULONARITHMETIC,WEUSEONLYTHEINTEGERSINTHERANGE0TON1,INCLUSIVE.

Figure:XORingoftwosinglebitsortwowords BLOCK CODING: Inblockcoding,wedivideourmessageintoblocks,eachofkbits,calleddatawords.Weaddr redundantbitstoeachblocktomakethelengthn=k+r.Theresultingnbitblocksarecalled codewords.

ABURSTERRORMEANSTHAT2ORMOREBITSINTHEDATAUNITHAVECHANGED.

TODETECTORCORRECTERRORS,WENEEDTOSENDEXTRA(REDUNDANT)BITSWITHDATA.

Figure:Datawordsandcodewordsinblockcoding

EXAMPLE: The4B/5BblockcodingdiscussedinChapter4isagoodexampleofthistypeofcoding.Inthiscoding scheme,k=4andn=5.Aswesaw,wehave2k=16datawordsand2n=32codewords.Wesawthat 16outof32codewordsareusedformessagetransferandtherestareeitherusedforotherpurposes orunused.

Figure:Thestructureofencoderanddecoder

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 1

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 2

COMPUTER NETWORK

LECTURE NOTES Volume-6

COMPUTER NETWORK

LECTURE NOTES Volume-6

Figure:Processoferrordetectioninblockcoding

Figure:Structureofencoderanddecoderinerrorcorrection

Table6.1Acodeforerrordetection

Table6.2Acodeforerrorcorrection

EXAMPLE: Letusassumethatk=2andn=3.Table6.1showsthelistofdatawordsandcodewords.Later,we willseehowtoderiveacodewordfromadataword.Assumethesenderencodesthedataword01as 011andsendsittothereceiver.Considerthefollowingcases: 1.Thereceiverreceives011.Itisavalidcodeword.Thereceiverextractsthedataword01fromit. 2.Thecodewordiscorruptedduringtransmission,and111isreceived.Thisisnotavalidcodeword andisdiscarded. 3.Thecodewordiscorruptedduringtransmission,and000isreceived.Thisisavalidcodeword.The receiverincorrectlyextractsthedataword00.Twocorruptedbitshavemadetheerrorundetectable. ANERRORDETECTINGCODECANDETECTONLYTHETYPESOFERRORSFORWHICHITISDESIGNED; OTHERTYPESOFERRORSMAYREMAINUNDETECTED.

EXAMPLE: LetusaddmoreredundantbitstoPreviousExampletoseeifthereceivercancorrectanerror without knowingwhatwasactually sent.Weadd3 redundantbits to the2bit dataword tomake 5 bit codewords. Table 6.2 shows the datawords and codewords. Assume the dataword is 01. The sender creates the codeword 01011. The codeword is corrupted during transmission, and 01001 is received. First, the receiver finds that the received codeword is not in the table. This means an error hasoccurred.Thereceiver,assumingthatthereisonly1bitcorrupted,usesthefollowingstrategyto guessthecorrectdataword. 1. Comparing the received codeword with the first codeword in the table (01001 versus 00000), the receiverdecidesthat thefirstcodewordis nottheonethatwassent becausethere are two different bits. 2.Bythesamereasoning,theoriginalcodewordcannotbethethirdorfourthoneinthetable. 3.Theoriginalcodewordmustbethesecondoneinthetablebecausethisistheonlyonethatdiffers from the received codeword by 1 bit. The receiver replaces 01001 with 01011 and consults the table tofindthedataword01. THE HAMMING DISTANCE BETWEEN TWO WORDS IS THE NUMBER OF DIFFERENCES BETWEEN CORRESPONDINGBITS.

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 3

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 4

COMPUTER NETWORK LetusfindtheHammingdistancebetweentwopairsofwords. 1.TheHammingdistanced(000,011)is2because 2.TheHammingdistanced(10101,11110)is3because

LECTURE NOTES Volume-6

COMPUTER NETWORK

LECTURE NOTES Volume-6

PARITY CODE: Asimpleparitycheckcodeisasinglebiterrordetectingcodeinwhich n=k+1withdmin=2.

THE MINIMUM HAMMING DISTANCE IS THE SMALLEST HAMMING DISTANCE BETWEEN ALLPOSSIBLEPAIRSINASETOFWORDS. EXAMPLE: FindtheminimumHammingdistanceofthecodingschemeinTable6.1. Solution: WefirstfindallHammingdistances.

Thedmininthiscaseis2. EXAMPLE: FindtheminimumHammingdistanceofthecodingschemeinTable6.2. Solution WefirstfindalltheHammingdistances.

Table6.3SimpleparitycheckcodeC(5,4)

Thedmininthiscaseis3. TOGUARANTEETHEDETECTIONOFUPTOSERRORSINALLCASES,THEMINIMUMHAMMING DISTANCEINABLOCKCODEMUSTBEDMIN=S+1. EXAMPLE: TheminimumHammingdistanceforourfirstcodescheme(Table6.1)is2.Thiscodeguarantees detectionofonlyasingleerror.Forexample,ifthethirdcodeword(101)issentandoneerroroccurs, thereceivedcodeworddoesnotmatchanyvalidcodeword.Iftwoerrorsoccur,however,the receivedcodewordmaymatchavalidcodewordandtheerrorsarenotdetected. EXAMPLE: Oursecondblockcodescheme(Table6.2)hasdmin=3.Thiscodecandetectuptotwo errors.Again,weseethatwhenanyofthevalidcodewordsissent,twoerrorscreateacodeword whichisnotinthetableofvalidcodewords.Thereceivercannotbefooled. However,somecombinationsofthreeerrorschangeavalidcodewordtoanothervalidcodeword. Thereceiveracceptsthereceivedcodewordandtheerrorsareundetected. SUJOY BHOWMICK (Asst. Prof, IT) PAGE NO : 5

Figure:Encoderanddecoderforsimpleparitycheckcode

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 6

COMPUTER NETWORK

LECTURE NOTES Volume-6

COMPUTER NETWORK

LECTURE NOTES Volume-6

EXAMPLE: Letuslookatsometransmissionscenarios.Assumethesendersendsthedataword1011.The codewordcreatedfromthisdatawordis10111,whichissenttothereceiver.Weexaminefivecases: 1.Noerroroccurs;thereceivedcodewordis10111.Thesyndromeis0.Thedataword1011is created. 2.Onesinglebiterrorchangesa1.Thereceivedcodewordis10011.Thesyndromeis1.Nodataword iscreated. 3.Onesinglebiterrorchangesr0.Thereceivedcodewordis10110.Thesyndromeis1.Nodataword iscreated. 4.Anerrorchangesr0andaseconderrorchangesa3. Thereceivedcodewordis00110.Thesyndromeis0. Thedataword0011iscreatedatthereceiver.Notethatherethedatawordiswronglycreateddue tothesyndromevalue. 5.Threebitsa3,a2,anda1arechangedbyerrors. Thereceivedcodewordis01011.Thesyndromeis1. Thedatawordisnotcreated.Thisshowsthatthesimpleparitycheck,guaranteedtodetectone singleerror,canalsofindanyoddnumberoferrors. ASIMPLEPARITYCHECKCODECANDETECTANODDNUMBEROFERRORS.

FIGURE:Twodimensionalparitycheckcode

Table6.4HammingcodeC(7,4)

Figure:ThestructureoftheencoderanddecoderforaHammingcode

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 7

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 8

COMPUTER NETWORK

LECTURE NOTES Volume-6

COMPUTER NETWORK

LECTURE NOTES Volume-6

EXAMPLE: Letustracethepathofthreedatawordsfromthesendertothedestination: 1.Thedataword0100becomesthecodeword0100011. Thecodeword0100011isreceived.Thesyndromeis000,thefinaldatawordis0100. 2.Thedataword0111becomesthecodeword0111001. Thesyndromeis011.Afterflippingb2(changingthe1to0),thefinaldatawordis0111. 3.Thedataword1101becomesthecodeword1101000. Thesyndromeis101.Afterflippingb0,weget0000,thewrongdataword.Thisshowsthatourcode cannotcorrecttwoerrors. EXAMPLE: Weneedadatawordofatleast7bits.Calculatevaluesofkandnthatsatisfythisrequirement. Solution Weneedtomakek=nmgreaterthanorequalto7,or2m1m7. 1.Ifwesetm=3,theresultisn=231andk=73,or4,whichisnotacceptable. 2.Ifwesetm=4,thenn=241=15andk=154=11,whichsatisfiesthecondition. Sothecodeis

CYCLIC CODES:
Cycliccodesarespeciallinearblockcodeswithoneextraproperty.Inacycliccode,ifacodewordis cyclicallyshifted(rotated),theresultisanothercodeword.

Table6.6ACRCcodewithC(7,4)

Figure:BursterrorcorrectionusingHammingcode SUJOY BHOWMICK (Asst. Prof, IT)

Figure:CRCencoderanddecoder

PAGE NO : 9

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 10

COMPUTER NETWORK

LECTURE NOTES Volume-6

COMPUTER NETWORK

LECTURE NOTES Volume-6

Figure:HardwireddesignofthedivisorinCRC

Figure:DivisioninCRCencoder

Figure:DivisionintheCRCdecoderfortwocases

Figure:SimulationofdivisioninCRCencoder

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 11

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 12

COMPUTER NETWORK

LECTURE NOTES Volume-6

COMPUTER NETWORK

LECTURE NOTES Volume-6

Figure:TheCRCencoderdesignusingshiftregisters

Figure:CRCdivisionusingpolynomials

Figure:GeneraldesignofencoderanddecoderofaCRCcode

THEDIVISORINACYCLICCODEISNORMALLYCALLEDTHEGENERATORPOLYNOMIALORSIMPLYTHE GENERATOR. Inacycliccode, Ifs(x)0,oneormorebitsiscorrupted. Ifs(x)=0,either a.Nobitiscorrupted.or b.Somebitsarecorrupted,butthedecoderfailedtodetectthem.

Figure:Apolynomialtorepresentabinaryword

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 13

SUJOY BHOWMICK (Asst. Prof, IT)

PAGE NO : 14

Оценить