Codes - Notations: Introduction To Computer Networks
Codes - Notations: Introduction To Computer Networks
Codes - Notations: Introduction To Computer Networks
Codes - Notations
n
(7,4)
K =4
redundancy
Parity
(p l + p + l +1, p l)
K = p l
n= p l + p + l +1
10101 101011
01010 010100
Odd parity add 1 to achieve an odd number of 1s
10101 101010
01010 010101
Can catch:
All 1-,2-,3- bit errors
Most 4-bit errors
(K+1, K)
Detects all 1-bit errors
10110001
11000010
01101000
00110101
01001100
01100010
0
1
1
0
1
1
Hamming Codes
Hamming Codes
Hamming codes are a family of linear errorcorrecting codes that generalize the Hamming(7,4)code invented by Richard Hamming in 1950.
Hamming codes can detect up to two and
correct up to one bit errors.
Hamming Distance The number of positions in
which 2 words differ.
100101, 101001 distance of 2
Code word of (n,K,d)
Error Detection: d-1
Error Correction: (d-1)/2
010
011
100
101
110
111
1
001
G x =y
H y = s
s is a null vector iff y is a code word, i.e. no parity error.
If s is not null, it indicates which bit had an error
1
1
1
G 0
0
1 0 1
0 1 1
0 0 0
1 1 1
1 0 0
0 1 0
0 0 1
1 0 1 0 1 0 1
H 0 1 1 0 0 1 1
0 0 0 1 1 1 1
0 1 1
1
1
0 0 0 1
0
1 1 1 0 y
1
1 0 0 0
1
1
0 1 0
0 0 1
1
0
0
0 1 0 1 0 1 0 1 1 1
H y 0 0 1 1 0 0 1 1 0 0
1 0 0 0 1 1 1 1 1 1
1
0
0
1
1
1
G x 0
0
Data
Codeword
Data
Codeword
0000
0000000
1000
1110000
0001
1101001
1001
0011001
0010
0101010
1010
1011010
0011
1000011
1011
0110011
0100
1001100
1100
0111100
0101
0100101
1101
1010101
0110
1100110
1110
0010110
0111
0001111
1111
1111111
CRC - Example
G Generator x3+1
D x5+x3+x2+x1 101110
. r
R = remainder [ D 2 ]
G
message
16
CRC
CRC
x2
x1
x0
1000101000
x2
x1
x0
000101000
17
18
CRC
CRC
x2
x1
x0
00101000
19
x2
x1
x0
0101000
CRC
CRC
x2
x1
x0
101000
x2
x1
x0
01000
21
22
CRC
CRC
x2
x1
x0
1000
23
x2
x1
x0
000
CRC
CRC
x2
x1
x0
00
25
CRC
Here's a picture for the start of the division of
(x6 + x2 + 1) divided by (x3 + x2 + 1)
x2
x1
x0
x2
x1
x0