Download presentation

Presentation is loading. Please wait.

Published byBlaze Heward Modified about 1 year ago

1
COM342 Networks and Data Communications Ian McCrumRoom 5B18 Tel: voice mail on 6 th ring Web site: Lecture 4C: Further examples of Hamming codes (Data Correction)

2
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
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
Hamming applied to 8 bit data [ ] 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
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 =

6
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 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
Using Hamming on bit positions… 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 } = So C2 = {b2, b3, b6, b7, b10, b11 } = 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
Using Hamming on bit positions… So C1 = {b1, b3, b5, b7, b9, b11 } = So C2 = {b2, b3, b6, b7, b10, b11 } = 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 = >

9
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) [1](b) [1](c) [2] Given the 8 bit data word 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
Answers to tutorial questions from Lecture 4C 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 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 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 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

11
Answers to lecture 4C page 2 [2] Given the 8 bit data word 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 = i.e [ ]

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= ) 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 = i.e [3] Given a 11 bit data word, generate the 15 bit hamming code word, I pick an arbitrary

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google