Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device...

22
Hamming Code Rachel Ah Chuen

Transcript of Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device...

Page 1: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Hamming Code

Rachel Ah Chuen

Page 2: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Basic concepts• Networks must be able to transfer data from one device

to another with complete accuracy.

• Data can be corrupted during transmission.

• For reliable communication, errors must be detected and corrected.

Page 3: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Types of Errors

Page 4: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Single-bit error

Page 5: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Single bit errors are the least likely type of errors in serial data transmission because the noise must have a very short duration which is very rare.

However this kind of errors can happen in parallel transmission.

Single-bit error

Page 6: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Burst error

Page 7: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

The term burst error means that two or more bits in the data unit have changed from 1 to 0 or from 0 to 1.

Burst errors does not necessarily mean that the errors occur in consecutive bits.

The length of the burst is measured from the first corrupted bit to the last corrupted bit.

Burst error

Page 8: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Hamming Code In the late 1940’s Richard Hamming recognized

that the further evolution of computers required greater reliability, in particular the ability to not only detect errors, but correct them.

His search for error-correcting codes led to the Hamming Codes, and the extended Hamming Codes, 1-error correcting and 2-error detecting codes.

Page 9: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

DefinitionsFor linear codes, encoding is a linear

transformation c that maps a message m to a codeword c(m).

Block codes means all codewords c(m) have the same length, which we denote as n.

Let k be the length of information bits that we encode. Then there are n-k redundancy bits in each codeword, called parity check bits, which are left for error correction.

(n, k) specify the parameters (codeword length and parity check bit length) for a block code.

Page 10: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Hamming DistanceThe Hamming distance, d_H is the number of bits

that have to be changed to get from one bit pattern to another.

Example: c1=(10010101) & c2=(10011001) have a hamming distance of 2

What about c1 = (101101) and c2 = (100110)?

Page 11: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Minimum Hamming DistanceLet d to be the minimum Hamming distance

between any two distinct codewords of a code C as

A code with minimum distance d between codewords can detect d-1 errors and can correct (d-1)/2 errors.

Page 12: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Hamming weightw(S) defined as the sum of its non-zero entries

A linear code is completely defined by all the codewords for messages of weight 1.

Page 13: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Hamming CodeThe Hamming code is a single error correction

linear block code with (n, k) = (2m -1, 2m-1-m)

where m = n k is the number of check bits in the codeword.

The simplest non-trivial code is for m = 3, which is the (7,4) Hamming code.

Generator matrix

Where S is k x (n k)

Page 14: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Hamming codeSuppose our matrix G generates a

single error correcting code. Then there are no code words of weight 1 or 2, and the parity check portion S of G must satisfy the following 2 conditions:

Page 15: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

(7,4) Hamming Code

Page 16: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

(7,4) Hamming CodeFor every generator matrix g=[ I S], there is a

parity check matrix H defined by

Page 17: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Examplereceived string r = (1110111)

Page 18: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Parity ErrorsThe class of Hamming single error correcting

codes is noteworthy because they are particularly efficient in the use of parity bits.

The (7,4) Hamming code uses 3 parity bits to protect 4 data bits;

Page 19: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

(15,11) code

Page 20: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Parity Computation(7,4) code

Computations by receiver

Steps

Page 21: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.

Combination of syndrome bitsAppropriate corrective action for each

combination of the syndrome bits

Page 22: Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.