In: Computer Science
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code requirements. Illustrate the error detection and correction scheme using Hamming code method, for both the sender and receiver to detect an error at the following positions:
a.6thbit position.
b.11thbit position.Assume an odd-parity scheme for this problem.
According to the question the data-bits m = 11010110 => n= 8, the number of parity bits used in the hamming code can be calculated as follows:-
n+p+1 <= 2p
=> 8+p+1 <= 2p
=> 9+p <= 2p
=> for p=4, the above condition will satisfy therefore, we will take p=4, that is 4 parity bits will be used, hence the size of hamming code will be 4+8 = 12.
The hamming code will be as follows:-
Power of 2 | 23 | 22 | 21 | 20 | ||||||||
position | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
message | 1 | 1 | 0 | 1 | p8 | 0 | 1 | 1 | p4 | 0 | p2 | p1 |
Since it is given that odd-parity scheme is used, therefore the value parity bits will be calculated as follows:-
Calculation of p1:-
Positions used = 1, 3, 5, 7, 9, 11
values used = p1, 0, 1, 0, 1, 1
=> p1 = 0
Calculation of p2:-
Positions used = 2, 3, 6, 7, 10, 11
values used = p2, 0, 1, 0, 0, 1
=> p2 = 1
Calculation of p4:-
Positions used = 4, 5, 6, 7, 12
values used = p4, 1, 1, 0, 1
=> p4 = 0
Calculation of p8:-
Positions used = 8, 9, 10, 11, 12
values used = p8, 1, 0, 1, 1
=> p8 = 0
Therefore the hamming code that the sender will send be 110100110010
(a.) The there is an error at 6th bit position therefore 1 at 6th position will change to 0, and message that receiver will receive will be 110100010010.
Error detection :- we use the odd parity scheme to detect error
Calculation of c1:-
Positions used = 1, 3, 5, 7, 9, 11
values used = 0, 0, 1, 0, 1, 1
=> c1 = 0
Calculation of c2:-
Positions used = 2, 3, 6, 7, 10, 11
values used = 1, 0, 0, 0, 0, 1
=> c2 = 1
Calculation of c4:-
Positions used = 4, 5, 6, 7, 12
values used = 0, 1, 0, 0, 1
=> c4 = 1
Calculation of c8:-
Positions used = 8, 9, 10, 11, 12
values used = 0, 1, 0, 1, 1
=> c8 = 0
Since c2 & c4 has value 1 therefore there is an error in received message.
Error correction :- the bit which has the error is c8c4c2c1
=> position of error bit = 0110 =(6)10
For error correction change the value of 6th position bit, therefore the message will become 110100110010.
(b.) The there is an error at 11th bit position therefore 1 at 11th position will change to 0, and message that receiver will receive will be 100100110010.
Error detection :- we use the odd parity scheme to detect error
Calculation of c1:-
Positions used = 1, 3, 5, 7, 9, 11
values used = 0, 0, 1, 0, 1, 0
=> c1 = 1
Calculation of c2:-
Positions used = 2, 3, 6, 7, 10, 11
values used = 1, 0, 1, 0, 0, 0
=> c2 = 1
Calculation of c4:-
Positions used = 4, 5, 6, 7, 12
values used = 0, 1, 1, 0, 1
=> c4 = 0
Calculation of c8:-
Positions used = 8, 9, 10, 11, 12
values used = 0, 1, 0, 0, 1
=> c8 = 1
Since c8, c2 & c1 has value 1 therefore there is an error in received message.
Error correction :- the bit which has the error is c8c4c2c1
=> position of error bit = 1011 =(11)10
For error correction change the value of 6th position bit, therefore the message will become 110100110010.