You are on page 1of 20

Improved Hamming Code for

Error Detection and Correction

作者:U. K. Kumar, Member, IEEE, and B. S.


Umashankar
出處:2007 2nd International Symposium on
Wireless Pervasive Computing
授課教授:馮玄明
陳鍾誠
報 告 人:黃志昂
1
Outline

z Introduction
z Proposed Improved Hamming Code
z Conclusion

Improved Hamming Code for Error Detection and Correction

2
Hamming code

z well known for its single-bit error detection &


correction capability.
z based on the of adding ‘r’ redundancy bits to ‘n’ data
bits such that 2r ≧ n + r + 1.
z 2r -1 bits:Hamming Code
z r: redundancy bits
z (2r -1) -r:data bits
z redundancy bits :be interspersed at bit positions
2n (n = 0, 1, 2, 3) with the original data bits.
z Data bits:All other bit positions are for the data to be
encoded. (positions 3, 5, 6, 7, 9..etc.)

Introduction
3
Hamming code

z Rule & How to Remember


{ Position 1: check 1 bit, skip 1 bit, check 1 bit, skip 1 bit,
etc. (1,3,5,7,9,11,13,15,...)
{ Position 2: check 2 bits, skip 2 bits, check 2 bits, skip 2
bits, etc. (2,3,6,7,10,11,14,15,...)
{ Position 4: check 4 bits, skip 4 bits, check 4 bits, skip 4
bits, etc. (4,5,6,7,12,13,14,15,20,21,22,23,...)
{ Position 8: check 8 bits, skip 8 bits, check 8 bits, skip 8
bits, etc. (8,9,10,11,12,13,14,15,24,25,26,27,...)
z total number of ones in the positions is odd -> set check
bit 1.
z total number of ones in the positions is even -> set
check bit 0.

Introduction
4
Hamming code

z An example for 7-bit Hamming code is given


below( for comparison with the proposed
improvement.)
z the 7-bit data to be transmitted is 0110010.
z the 11-bit data actually transmitted is
011P001P0PP
z the P’s refer to the Hamming bits that are to be
calculated and interspersed at bit positions 1,
2, 4, & 8.

Introduction
5
Hamming code
z An example for 7-bit Hamming code 0110010.
z the 11-bit data actually transmitted is
011P001P0PP
z bit position 1 :is even parity at bit positions 1, 3, 5, 7, 9,
& 11. Thus the Hamming bit at position 1 will be 0.
z bit position 2 :is even parity at bit positions 2, 3, 6, 7,
10, & 11. Thus the Hamming bit at position 2 will be 1.
z bit position 4 :is even parity at bit positions 4, 5, 6, & 7.
Thus the Hamming bit at position 4 will be 1.
z bit position 8 :is even parity at bit positions 8, 9, 10, &
11. Thus the Hamming bit at position 8 will be 0.

Introduction
6
Hamming code

z Thus the 11-bit data actually transmitted is


01100011010.
z For the calculation of Hamming bits at
positions 1, 2, 4, & 8, even-parity checks
were performed on 6, 6, 4, & 4 bits
respectively.
z Thus a total of 20 bits are involved in the
process of Hamming bits calculations.

Introduction
7
Hamming code
z The error-detection and correction process in Hamming code is
as illustrated in Table I.

※11-bit data actually transmitted is 01100011010


zTABLE I
zerror-detection and correction using hamming code

S0-bit position 1 : 1、3、5、7、9、11


S1-bit Position 2 : 2、3、6、7、10、11
S2-bit position 4 : 4、5、6、7
S3-bit position 8 : 8、9、10、11

Introduction
8
Hamming code
z After error detection & correction, if any, the data bits
have to be reassembled by removing the
redundancy bits.
z Hamming code is normally used for transmission of 7-bit
data item.
z Scaling it for larger data lengths results in a lot of
overhead due to interspersing the redundancy bits
and their removal later.

Introduction
9
IMPROVED HAMMING CODE

z The number of redundancy bits, ‘r’ to be appended to n-


bit data is obtained such that the relation (2r-1–1) ≥ n is
satisfied.
z The number of redundancy bits in this method is same
as that for Hamming code for some values of n.
z But in some cases, it will be just one more redundancy
bit than needed in the Hamming code.

PROPOSED IMPROVED HAMMING CODE


10
IMPROVED HAMMING CODE

z consider the same example. The 7-bit data


to be transmitted is 0110010.
z For 7-bit data, the number of redundancy
bits required will be 4.
z the 11-bit data actually transmitted is
PPPP0110010.
z the P’s refer to the redundancy bits that are
to be calculated and appended at bit
positions 8, 9, 10, & 11.

PROPOSED IMPROVED HAMMING CODE


11
IMPROVED HAMMING CODE

z the 11-bit data actually transmitted is PPPP0110010.


z bit position 8:is even parity at bit positions 1, 3, 5,
7 and bit position 8. Thus the bit at position 8 will
be 1.
z bit position 9 :is even parity at bit positions 2, 3, 6,
7 and bit position 9. Thus the bit at position 9 will
be 0.
z bit position 10 :is even parity at bit positions 4, 5, 6,
7 and bit position 10. Thus the bit at position 10
will be 0.
z bit position 11: is even parity considering only the
redundancy bits(8,9,10,11). Thus the bit at
position 11 will be 1.
PROPOSED IMPROVED HAMMING CODE
12
IMPROVED HAMMING CODE

z Thus the 11-bit data actually transmitted is


10010110010.
z For the calculation of bits at positions 8, 9,
10, & 11, even parity checks were performed
on 5, 5, 5, & 4 bits respectively.
z Thus a total of 19 bits are involved in the
process of calculation of redundancy bits.

PROPOSED IMPROVED HAMMING CODE


13
IMPROVED HAMMING CODE

z The error-detection and correction process in the improved


method is as illustrated in Table II.
zTABLE II ※the 11-bit data actually transmitted is 10010110010.
zerror-detection and correction using improved hamming code

S0-bit position 8 : 1、3、5、7、8


S1-bit Position 9 : 2、3、6、7、9
S2-bit position 10: 4、5、6、7、10
S3-bit position 11: 8、9、10、11 PROPOSED IMPROVED HAMMING CODE
14
IMPROVED HAMMING CODE

z Suppose the received information is 10010100010, with an


error at bit position 5.
z the status of parity check S0 is shown as F:even parity
error at bit positions 1, 3, 5, 7 & 8.
z the status of parity check S1 is shown as T: no even
parity error at bit positions 2, 3, 6, 7 & 9.
z the status of parity check S2 is shown as F: even parity
error at bit positions 4, 5, 6, 7& 10
z the status of parity check S3 is shown as T : even
parity occurs at bit positions 8, 9, 10 & 11.
z Interpreting F as 1 and T as 0 in the status of parity check,
we find that the error is at bit position 0101 i.e. 5. Bit
5,which was received as 0, is corrected as 1.

PROPOSED IMPROVED HAMMING CODE


15
IMPROVED HAMMING CODE

z Suppose the received information is 10000110010, with


an error at redundancy bit position 8.
z Then the status of parity check will turn out to be
FTTF.
z If status of parity check is FXXX, it implies that
there is an error only in a redundancy bit.
z The actual redundancy bit in error can easily be
identified by the position of the of F. However, this is
not a data bit there is no need for any correction.
z Suppose the received information is 10010110010, with
no error. Then the status of parity check will turn out
to be TTTT, implying error at bit position 0000 i.e. 0.
This is treated as no error.
PROPOSED IMPROVED HAMMING CODE
16
IMPROVED HAMMING CODE

z After error detection & correction, if any, the redundancy


bits can be removed easily and there is no need to
reassemble the data bits.
z This improved method can be scaled easily for larger
data lengths. The redundancy bits just get appended to
the data.

PROPOSED IMPROVED HAMMING CODE


17
IMPROVED HAMMING CODE

z As an example, let us consider a 56-bit data stream, which


can contain eight 7-bit ASCII characters or seven bytes.
z This needs 7 redundancy bits, which are selected as in the
previous example.
z In spite of an extra redundancy bit when compared to
the Hamming code, the number of bits involved in the
process of calculation of redundancy bits is much less
than in the Hamming code.
z It can be shown that it involves a total of 172 bits in the
process of calculation of these 7 redundancy bits.
z In comparison, in the Hamming code it involves a total
of 182 bits in the process of calculation of 6 redundancy
bits.
PROPOSED IMPROVED HAMMING CODE
18
Proposed Improvement vs. Hamming Code

z In the proposed improvement :the


redundancy bits are appended at the end of
data bits.
z This eliminates the overhead of interspersing
the redundancy bits at the sender end and their
removal at the receiver end after checking for
single-bit error and consequent correction, if any.
z Further the effort needed in identifying the values
of the redundancy bits is lower in the proposed
novel method.

Conclusion
19
Proposed Improvement vs. Hamming Code

z Hamming code is normally used for transmission of 7-bit


data item.
z Scaling it for larger data lengths results in a lot of
overhead due to interspersing the redundancy bits and
their removal later.
z In contrast, the proposed method is highly scalable
without such overhead.
z there is only 7 bit overhead for a 56-bit data stream, which is
much less compared to 4 bit overhead for a 7-bit data.
z Because of this feature this new method is suitable for
transmission of large size data bit-streams as long as
there is likelihood of at the most single-bit error during
transmission.

Conclusion
20

You might also like