Computer Network Notes CS 602 LN 6
Computer Network Notes CS 602 LN 6
Computer Network Notes CS 602 LN 6
COMPUTER NETWORK
INMODULONARITHMETIC,WEUSEONLYTHEINTEGERSINTHERANGE0TON1,INCLUSIVE.
ABURSTERRORMEANSTHAT2ORMOREBITSINTHEDATAUNITHAVECHANGED.
TODETECTORCORRECTERRORS,WENEEDTOSENDEXTRA(REDUNDANT)BITSWITHDATA.
Figure:Datawordsandcodewordsinblockcoding
Figure:Thestructureofencoderanddecoder
PAGE NO : 1
PAGE NO : 2
COMPUTER NETWORK
COMPUTER NETWORK
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.
PAGE NO : 3
PAGE NO : 4
COMPUTER NETWORK
THE MINIMUM HAMMING DISTANCE IS THE SMALLEST HAMMING DISTANCE BETWEEN ALLPOSSIBLEPAIRSINASETOFWORDS. EXAMPLE: FindtheminimumHammingdistanceofthecodingschemeinTable6.1. Solution: WefirstfindallHammingdistances.
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
PAGE NO : 6
COMPUTER NETWORK
COMPUTER NETWORK
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
PAGE NO : 7
PAGE NO : 8
COMPUTER NETWORK
COMPUTER NETWORK
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:CRCencoderanddecoder
PAGE NO : 9
PAGE NO : 10
COMPUTER NETWORK
COMPUTER NETWORK
Figure:HardwireddesignofthedivisorinCRC
Figure:DivisioninCRCencoder
Figure:DivisionintheCRCdecoderfortwocases
Figure:SimulationofdivisioninCRCencoder
PAGE NO : 11
PAGE NO : 12
COMPUTER NETWORK
COMPUTER NETWORK
Figure:TheCRCencoderdesignusingshiftregisters
Figure:CRCdivisionusingpolynomials
Figure:GeneraldesignofencoderanddecoderofaCRCcode
Figure:Apolynomialtorepresentabinaryword
PAGE NO : 13
PAGE NO : 14