SECDED Coding
SECDED Coding
au/set/Courses/Content/CSIT/oua/cpt160/2014sp4/chapter/05/
CodingSchemes.html
C o d i n g S c h e me s
Hamming Codes
In the general case, the way we add those bits is up the scheme used. The
most popular one is the Hamming code. In the Hamming code the number of
Parity/Check bits p must be:
2p ≥ m + p + 1
An example:
Find the number of check bits required to detect and correct a single bit
error in the BCD code for 910 = 10012
A Hamming code includes several parity bits, to be able to detect and correct
1-bit errors. In principle the parity bits may go in many different places, but
the most common use is interspersed with the data bits, because:
To get the position of the check bits we count the bits from right to left (i.e.
LSB to MSB) starting from 1, and the check bits are at positions 1, 2, 4, 8,
16, 32, etc, all powers of 2. All the other bits are data bits, part of the
message.
Bit Position 10 9 8 7 6 5 4 3 2 1
Data/Parity D6 D5 P4 D4 D3 D2 P3 D1 P2 P1
The table above is an example of Hamming code for 6 data bits (P = parity
bit, D = data bit).
The scheme works by using each check bit as a parity bit for a specific group
of bits, as follows:
An example: determine the single bit error-correcting Hamming code for the
data 10112. Use EVEN parity. From the formula we can see that p = 3 is
sufficient, so we can write:
7 6 5 4 3 2 1
1 0 1 1
P1 checks bits 1, 3, 5, 7 = ? 1 1 1, P1=1
P2 checks bits 2, 3, 6, 7 = ? 1 0 1, P2=0
P3 checks bits 4, 5, 6, 7 = ? 1 0 1, P3=0
The idea is that the parity bits cover each bit (data and parity) with a unique
pattern, that is each bit (including the parity bits) is covered by a unique
combination of parity bits. For example, bit 5 is covered by bits P1 and P3
only and exclusively, and bit 4 is covered by P3 exclusively.
Then, if we check and find a parity error on bits P1 and P3, but no other
parity errors, we know that the problem is with bit 5. So, if bit 5 is a 1, we
change it to 0, and if it is a 0 we change to 1 to correct the symbol.
However, since these communications are most likely parallel, 2-bit errors
occur when there is one error on two lines at the same time. That is, the
probability is the product of the two probabilities 10-18. With the same
computer you get a 2-bit error once every 1011 seconds = once every 3,171
years.
S E C D E D Co di n g
We may then assume that there has been a 1-bit error and the Hamming
code can correct it. If 2 bits are in error, some Hamming checks will fail but
the overall parity will be right, indicating that more that 1 bit was in error
but this time we are not able to correct it.
If some Hamming checks fail, and there is also an overall parity error, we
assume that there was a 1-bit error and we correct it as before.
If some Hamming checks fail but there is no overall parity error, we assume
that there have been 2 or more errors, and we don't correct them.
Of course, is there have actually been more than 2 errors, the SECDED
scheme will give a wrong result. As we have discussed, this is very unlikely.