8 bit SEC-ECC example

Error Correction Coding
for Memories
Prof. MacDonald
Error Detection and Correction
l 
l 
New generation of technology is smaller and
more prone to single bit failures.
Originally used parity bit for detection
– 
– 
l 
8 bits requires 9th bit
the nine bits always contain even number of ones
Now using Hamming for correction
– 
– 
– 
64 bits requires an additional 8 ECC bits
requires (log2 N) + 1 extra bits or m
{2m, 2m – m} where {total bits, total data bits}
Error Detection and Correction
l 
l 
l 
l 
l 
l 
Hamming distance is number of digits required
to flip to change from one valid symbol to
another
0100 change to 0010 requires 2 bits to flip
therefore, hamming distance is 2
Minimum distance between any two symbols
Hamming distance of 1 – no protection
Hamming distance of 2 – detection
Hamming distance of 3 – correction SEC-ECC
8 bit SEC-ECC example
l 
8 data bits requires 4 parity checking bits
– 
– 
l 
64 data bits requires 8 as used in PCs/Macs
– 
– 
l 
l 
l 
log2 (8) + 1 = 4 (for detecting and correcting 1 fail)
log2 (8) + 1 + global parity = 5 (for detecting 2 fails)
log2 (64) + 1 = 7 (for detecting and correcting 1 fail)
log2 (64) + 1 + global = 8 (for detecting 2 fails)
Build encoded word by indexing bits from left
All bits at power of 2 locations are parity
Data bits take remaining spaces in order
2D Parity
So if bit 7 flips, it affects parity p1, p2, p4 which adds up to seven
If bit 12 flips, it affects the parity (flips) bits p4 and p8 = 12
In either case, the flipped bit is identified and can be flipped back.
8 bit SEC-ECC example
E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 = encoded word
R1 R2 D1 R3 D2 D3 D4 R4 D5 D6 D7 D8
Each redundant bit is the parity bit for all bits in the word
that contain the corresponding power of 2 in the index
R1 = E3 ^ E5 ^ E7 ^ E9 ^ E11
R1 = D1 ^ D2 ^ D4 ^ D5 ^ D7
R2 = E3 ^ E6 ^ E7 ^ E10 ^ E11
R2 = D1 ^ D3 ^ D4 ^ D6 ^ D7
R3 = E5 ^ E6 ^ E7 ^ E12
R3 = D2 ^ D3 ^ D4 ^ D8
R4 = E9 ^ E10 ^ E11 ^ E12
R4 = D5 ^ D6 ^ D7 ^ D8
1
2
3
4
5
6
7
8
9
10
11
12
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
8 bit SEC-ECC example
E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 = encoded word
R1 R2 D1 R3 D2 D3 D4 R4 D5 D6 D7 D8
Each redundant bit is the parity bit for all bits in the word
that contain the corresponding power of 2 in the index
R1 = E3 ^ E5 ^ E7 ^ E9 ^ E11
R1 = D1 ^ D2 ^ D4 ^ D5 ^ D7
R2 = E3 ^ E6 ^ E7 ^ E10 ^ E11
R2 = D1 ^ D3 ^ D4 ^ D6 ^ D7
R3 = E5 ^ E6 ^ E7 ^ E12
R3 = D2 ^ D3 ^ D4 ^ D8
R4 = E9 ^ E10 ^ E11 ^ E12
R4 = D5 ^ D6 ^ D7 ^ D8
1
2
3
4
5
6
7
8
9
10
11
12
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
8 bit SEC-ECC example
E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 = encoded word
R1 R2 D1 R3 D2 D3 D4 R4 D5 D6 D7 D8
Each redundant bit is the parity bit for all bits in the word
that contain the corresponding power of 2 in the index
R1 = E3 ^ E5 ^ E7 ^ E9 ^ E11
R1 = D1 ^ D2 ^ D4 ^ D5 ^ D7
R2 = E3 ^ E6 ^ E7 ^ E10 ^ E11
R2 = D1 ^ D3 ^ D4 ^ D6 ^ D7
R3 = E5 ^ E6 ^ E7 ^ E12
R3 = D2 ^ D3 ^ D4 ^ D8
R4 = E9 ^ E10 ^ E11 ^ E12
R4 = D5 ^ D6 ^ D7 ^ D8
1
2
3
4
5
6
7
8
9
10
11
12
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
8 bit SEC-ECC example
E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 = encoded word
R1 R2 D1 R3 D2 D3 D4 R4 D5 D6 D7 D8
Each redundant bit is the parity bit for all bits in the word
that contain the corresponding power of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3 = E5 ^ E6 ^ E7 ^ E12
R3 = D2 ^ D3 ^ D4 ^ D8
R4 = E9 ^ E10 ^ E11 ^ E12
R4 = D5 ^ D6 ^ D7 ^ D8
= 1 ^ 1 ^ 0 ^ 0 = 1 -> 0
=1^1^1^0=1
8 bit SEC-ECC example
Since old check bits do not match new check bits
we know there is a failure. 0011 != 0101
XOR the old and new to create an index to the failure
1000 - new check bits
1110 - original check bits
0110 = 6 culprit is E6 - these are the syndrome bits
Flip culprit bit back and data is correct
8 bit SEC-ECC example
Parity bit flips.
E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12
R1 R2 1 R3 1 0 0
R4 1 1
1
0
R1 = E3 ^ E5 ^ E7 ^ E9 ^ E11
R1 = D1 ^ D2 ^ D4 ^ D5 ^ D7 = 1 ^ 1 ^ 0 ^ 1 ^ 1 = 0
R2 = E3 ^ E6 ^ E7 ^ E10 ^ E11
R2 = D1 ^ D3 ^ D4 ^ D6 ^ D7 = 1 ^ 0 ^ 0 ^ 1 ^ 1 = 1
R3 = E5 ^ E6 ^ E7 ^ E12
R3 = D2 ^ D3 ^ D4 ^ D8
R4 = E9 ^ E10 ^ E11 ^ E12
R4 = D5 ^ D6 ^ D7 ^ D8
=1^0 ^0^0=1
=1^1^1^0=1->0
8 bit SEC-ECC example
Since old check bits do not match new check bits
we know there is a failure. 0011 != 0101
XOR the old and new to create an index to the failure
0110 - new check bits
1110 - original check bits
1000 = 8 culprit is E8 - these are the syndrome bits
Error detected, but since error is in redundancy no need to
flip any data bits.
8 bit SEC-ECC example
Flip two bits.
E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12
R1 R2 1 R3 1 1 0
R4 1 1
1
1
R1 = E3 ^ E5 ^ E7 ^ E9 ^ E11
R1 = D1 ^ D2 ^ D4 ^ D5 ^ D7 = 1 ^ 1 ^ 0 ^ 1 ^ 1 = 0
R2 = E3 ^ E6 ^ E7 ^ E10 ^ E11
R2 = D1 ^ D3 ^ D4 ^ D6 ^ D7 = 1 ^ 1 ^ 0 ^ 1 ^ 1 = 1 - > 0
R3 = E5 ^ E6 ^ E7 ^ E12
R3 = D2 ^ D3 ^ D4 ^ D8
R4 = E9 ^ E10 ^ E11 ^ E12
R4 = D5 ^ D6 ^ D7 ^ D8
=1^1 ^1^1=0
=1^0^1^1=1
8 bit SEC-ECC example
Since old check bits do not match new check bits
we know there is a failure. 0011 != 0101
XOR the old and new to create an index to the failure
1110 - new check bits
1010 - original check bits
1100 = 12 culprit is E12 - these are the syndrome bits
Error detected but is incorrect.
How to determine if that you have a failure but that it was not
successfully fixed (like this case), a global parity is required
for the encoded word. In the correct case, the global parity
would be odd, however the two bits flipping causes the parity
to correct itself. An error in the culbrit bits without a global
error means you have two faults – detected but not corrected.
8 bit SEC-ECC example
Flip two bits.
E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13 (global)
R1 R2 1 R3 1 1 0
R4 1 1
1
1
0
R1 = E3 ^ E5 ^ E7 ^ E9 ^ E11
R1 = D1 ^ D2 ^ D4 ^ D5 ^ D7 = 1 ^ 1 ^ 0 ^ 1 ^ 1 = 0
R2 = E3 ^ E6 ^ E7 ^ E10 ^ E11
R2 = D1 ^ D3 ^ D4 ^ D6 ^ D7 = 1 ^ 1 ^ 0 ^ 1 ^ 1 = 1 - > 0
R3 = E5 ^ E6 ^ E7 ^ E12
R3 = D2 ^ D3 ^ D4 ^ D8
R4 = E9 ^ E10 ^ E11 ^ E12
R4 = D5 ^ D6 ^ D7 ^ D8
=1^1 ^1^1=0
=1^0^1^1=1
G = E1 ^ E2 ^ E3 ^ E4 ^ E5 ^ E6 ^ E7 ^ E8 ^ E9 ^ E10 ^ E11 ^ E12 = 0