Download presentation

Presentation is loading. Please wait.

Published byBlaze Heward Modified over 2 years ago

1
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt1/12 COM342 Networks and Data Communications Ian McCrumRoom 5B18 Tel: 90 366364 voice mail on 6 th ring Email: IJ.McCrum@Ulster.ac.uk Web site: http://www.eej.ulst.ac.uk Lecture 4C: Further examples of Hamming codes (Data Correction)

2
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt2/12 The Hamming Code k parity bits are added to n data bits giving a new word (k+n) bits long The word is numbered from bit 1 to (k+n) for more convenience when working things out The parity bits are inserted throughout the word – at positions given by powers of two. I.e bits 1,2,4,8, 16 etc Each parity bit is calculated from a subset of the data bits, these overlap Comparing the parity bits received with those calculated at the receiver will give all zeroes if there is no discrepancy (which is why we number from one) If the comparison is non-zero, e.g 101 then bit 5 is in error – this is very handy, easy to correct in hardware

3
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt3/12 Hamming applied to n bit data words In general the total number of bits that can be accommodated by the method is 2 k -1 So (n+k) = 2 k -1 If k is 3 we can accommodate 7 bits (4 data) If k is 4 we can accommodate up to 15 bits (11 data) If k is 5 we can accommodate up to 31 bits (26 data) There are better codes, hamming only fixes single bit errors (c.f convolutional codes although we won’t cover them here). If a 100 character block needs protected, it is better to use hamming on the 100 bits vertically through the block, so all bit 0s are protected, then all bit 1s etc., this extends each 100 bits to 107 bits since 7 hamming bits can protect 127 data bits. This is good for bursts of noise of a few bits…

4
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt4/12 Hamming applied to 8 bit data [0010 0011] msb…lsb (b7..b0) We reserve the bit positions that are powers of two to hold the special parity bits, usually called check bits b1: b2 : b3 : b4 : b5 : b6 : b7 : b8 : b9 : b10: b11:b12 P1: P2 : 1 : P4 : 1 : 0 : 0 : P8 : 0 : 1 : 0 : 0 We apply parity to subsets of the original 8 data bits, each parity bit tests 4 or 5 data bits, there is a pattern as to which! 3,5,7,9,11 3,6,7,10,11 5,6,7,12 9,10,11,12

5
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt5/12 The new 12 bit word can now be sent… P1: P2 : 1 : P4 : 1 : 0 : 0 : P8 : 0 : 1 : 0 : 0 3,5,7,9,11 3,6,7,10,11 5,6,7,12 9,10,11,12 P1 must be 0 to make {0, 1,1,0,0,0,} even P2 must be 0 to make {0, 1,0,0,1,0,} even P4 must be 1 to make {1, 1,0,0,0 } even P8 must be 1 to make {1, 0,1,0,0 } even 0: 0 : 1 : 1 : 1 : 0 : 0 : 1: 0 : 1 : 0 : 0 = 001110010100

6
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt 6/12 Picking the subsets to apply parity to The parity bits are labelled P1, P2, P4 and P8 Data bits are in positions 3,5,6,7,9,10,11,12 For each data bit, write its position as powers of 2 so position 10 is 8 + 2 We use P2 and P8 to “cover” 10 3=>P1 and P2, 5=>P1 and P4, 6=>P4 & P2 7=>P1 & P2 & P4, 9=>1001 => P8,P4,P2,P1 Hence you can draw the arrows and work out the parity bits. A better way is to arrange a 2D table, see the website for a good link showing this (http://candle.ctit.utwente.nl/wp5/tel-sys/exercises ) or the answers to the tutorial questions later in this presentation.http://candle.ctit.utwente.nl/wp5/tel-sys/exercises

7
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt7/12 Using Hamming on 001110010100 bit positions… 123456789012 001110010100 arrives into the receiver The receiver calculates four parity bits, it uses the original grouping but includes the parity bits themselves. So C1 = {b1, b3, b5, b7, b9, b11 } =011000 So C2 = {b2, b3, b6, b7, b10, b11 } =010010 So C4 = {b4, b5, b6, b7, b12 } =11000 So C8 = {b8, b9, b10, b11, b12 } =10100 These should all be zero 0000 (even parity) The next slide puts an error in bit 5

8
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt8/12 Using Hamming on 001100010100 bit positions… 123456789012 So C1 = {b1, b3, b5, b7, b9, b11 } =010000 So C2 = {b2, b3, b6, b7, b10, b11 } =010010 So C4 = {b4, b5, b6, b7, b12 } =10000 So C8 = {b8, b9, b10, b11, b12 } =10100 Now C1 and C4 are set, The checkbits arranged as a binary number C8 C4 C2 C1 are 0101 This is five in binary, so invert bit 5 to correct the code 001100010100 = > 001110010100

9
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt9/12 Tutorial questions on Hamming [1] A 12 bit Hamming code containing 8 bits of data and 4 parity bits is received, what was the original? [1](a)0000 1110 1010 [1](b)1011 1000 0110 [1](c)1011 1111 0100 [2] Given the 8 bit data word 0101 1011 give the 12 bit that can correct a single bit error [3] Given a 11 bit data word, generate the 15 bit hamming code word

10
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt10/12 Answers to tutorial questions from Lecture 4C 000011101010 C1=0_0_1_1_1_1_ C2=_00__11__01_ C4=___0111____0 C8=_______01010 So C8421 = 0110 I.e bit 6 is bad, invert it giving 000010101010 NB C1={1,3,5,7,9,11}, C2={2,3,6,7,10,11}, C4={4,5,6,7,12}, C8={8,9,10,11,12} And these groups should have an even number of ones, if not then set that C bit 101110000110 C1= 1_1_1_0_0_1_ C2= _01__00__11_ C4= ___1100____0 C8= _______00110 So C8421 = 0010 I.e bit 2 is bad, invert it giving 111110000110 101111110100 C1=1_1_1_1_0_0_ C2=_01__11__10_ C4=___1111____0 C8=_______10100 So C8421 = 0000 I.e No bits are bad so code is 101111110100

11
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt11/12 Answers to lecture 4C page 2 [2] Given the 8 bit data word 0101 1011 give the 12 bit that can correct a single bit error Code is :P1 :P2 :b3 :P4 :b5 :b6 :b7 :P8 :b9 :b10:b11:b12: i.e : ? : ? : 1 : ? : 1 : 0 : 1 : ? : 1 : 0 : 1 : 0 : Take b3 :[1]:[1]: : (3 = 1+2) Take b5 :[1]: : :[1]: (5 = 1+4) Take b6 : :[0]: :[0]: (6 = 2+4) Take b7 :[1]:[1]: :[1]: (7 = 1+2+4) Take b9 :[1]: : : : : : :[1]: (9 = 1+8) Take b10: :[0]: : : : : :[0]: (10= 2+8) Take b11:[1]:[1]: : : : : :[1]: (11= 1+2+8) Take b12: : : :[0]: : : :[0]: (12= 4+8) Parity Pn[1] [1] [0] [0] (make column even) 12 bits = 1 1 1 0 1 0 1 0 1 0 1 0 i.e [1110010101010]

12
http://www.eej.ulst.ac.uk/~ian/modules/COM342/COM342_L4C.ppt12/12 Answers to Lecture 4C Tutorials Page 3 Code is :P1 :P2 :b3 :P4 :b5 :b6 :b7 :P8 :b9 :b10:b11:b12:b13:b14:b15:P16:b17: i.e : ? : ? : 1 : ? : 1 : 0 : 1 : ? : 1 : 0 : 1 : 0 : 1 : 1 : 0 : ? : 0 : Take b3 :[1]:[1]: : (3 = 1+2) Take b5 :[1]: : :[1]: (5 = 1+4) Take b6 : :[0]: :[0]: (6 = 2+4) Take b7 :[1]:[1]: :[1]: (7 = 1+2+4) Take b9 :[1]: : : : : : :[1]: (9 = 1+8) Take b10: :[0]: : : : : :[0]: (10= 2+8) Take b11:[1]:[1]: : : : : :[1]: (11= 1+2+8) Take b12: : : :[0]: : : :[0]: (12= 4+8) Take b13:[1]: : :[1]: : : :[1]: (13= 1+4+8) Take b14: :[1]: :[1]: : : :[1]: (14= 2+4+8) Take b15:[0]:[0]: :[0]: : : :[0]: (15= 1+2+4+8) Take b17:[0]: : : : : : : : : : : : : : :[0]: (17= 1+16) Take b18: :[0]: : : : : : : : : : : : : :[0]: (18= 2+16) Parity Pn[0] [0] [0] [0] [0] (make column even) 12 bits = 0 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0 0 i.e 00101010101011000 [3] Given a 11 bit data word, generate the 15 bit hamming code word, I pick an arbitrary 001 1010 11011

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google