Presentation is loading. Please wait.

Presentation is loading. Please wait.

Error Detection and Correction – Hamming Code

Similar presentations


Presentation on theme: "Error Detection and Correction – Hamming Code"— Presentation transcript:

1 Error Detection and Correction – Hamming Code
Textbook: Chapter 6 (p.97 to p.106) Data Communications (E&T2760): Hamming Code

2 Introduction This and the next two chapters introduce:
how to detect errors due to transmission impairments how to correct the errors Data Communications (E&T2760): Hamming Code

3 Agenda Error Detection methods: Error Correction methods: Parity
Hamming Code CRC Error Correction methods: Forward Error Control, e.g. Hamming Code Feedback Error Control, i.e. ARQ Data Communications (E&T2760): Hamming Code

4 Vocabulary Forward Error Control Feedback Error Control
receiver tries to correct the errors by itself lots of redundant bits must be transmitted with the original data. Otherwise, the receiver has no way to correct the errors. helpless when there are too many errors application areas: magnetic storage, wireless data communications Feedback Error Control receiver asks the sender to retransmit the data simple, most popular application areas: LAN, WAN Data Communications (E&T2760): Hamming Code

5 Hamming Code A kind of linear block codes.
Prior to transmission, every m bits of information bits are appended with n bits of check bits. The values of the check bits are calculated from the information bits, using modulo-2 addition (= addition without carries = XOR). Data Communications (E&T2760): Hamming Code

6 Example: Hamming (7,4) Code
Every 4 information bits (k1, k2, k3, k4) are appended with 3 check bits (c1, c2, c3) and then transmitted as k1k2k3k4c1c2c3 Check equations: c1 = k1  k2  k4 c2 = k1  k3  k4 c3 = k2  k3  k4 Data Communications (E&T2760): Hamming Code

7 Hamming (7,4) Code (… continued)
For example, if k1k2k3k4 = 1010, then c1 = k1  k2  k4 = 1  0  0 = 1 c2 = k1  k3  k4 = 1  1  0 = 0 c3 = k2  k3  k4 = 0  1  0 = 1 Thus, the transmitted code word becomes k1k2k3k4c1c2c3 = Data Communications (E&T2760): Hamming Code

8 Hamming (7,4) Code (… continued)
The complete set of code words are listed below: k1 k2 k3 k4 c1 c2 c3 k1 k2 k3 k4 c1 c2 c3 Data Communications (E&T2760): Hamming Code

9 Hamming Distance = the number of bits that are different between two code words The minimum Hamming distance (d) of the Hamming (7, 4) Code is 3. If the number of error bits < 3 (i.e. < d), the error(s) will definitely be detected. because the erroneous code word won’t become another valid code word If only one bit (i.e.  [d-1]/2) is wrong, the error(s) can be correctly rectified. because the original code word is the nearest valid code word to the erroneous code word. So, the erroneous code word will be replaced correctly with the original code word. Data Communications (E&T2760): Hamming Code

10 Hamming Distance (… continued)
Example: k1k2k3k4c1c2c3 =  (an error occurred in k3) does not belong to the Hamming (7, 4) code word set so the receiver knows error(s) occurred during transmission The receiver replaces with (the original code word) because among all those valid code words, looks most similar to (i.e. differ in the least number of bits) Data Communications (E&T2760): Hamming Code

11 Generator Matrix G Another method of generating the code word from information bits. e.g. Hamming (7, 4) Code, information bits k1k2k3k4 = 1010, the code word can be generated by multiplication: [ ] x = [ ] generator matrix G information bits k1 k2 k3 k4 C1 C2 C3 Data Communications (E&T2760): Hamming Code

12 The quickest way to generate code words from G (… continued)
Add appropriate rows of the Generator Matrix G together. Principles: each row of G is already a valid code word a property of Linear Block Codes states that if we add (modulo-2 addition) any two or more code words together, the result is also a valid code word Data Communications (E&T2760): Hamming Code

13 The quickest way to generate code words from G
Example: k1k2k3k4 = 0011, we can find the corresponding code word by adding the 3rd and 4th rows of G together = k1 k2 k3 k4 C1 C2 C3 Data Communications (E&T2760): Hamming Code

14 Check Matrix H Multiply H with the received code word
If the result (syndrome) is a zero vector, then we can assume no error has occurred during transmission. or there are too many errors ( d bits) which cannot be detected Otherwise, the non-zero syndrome is used to determine which bit(s) was wrong – by comparing it with the columns of the check matrix provided that the number of error bits is  [d-1]/2 Data Communications (E&T2760): Hamming Code

15 Check Matrix H (… continued)
Hamming (7, 4) code c1 = k1  k2  k4 c2 = k1  k3  k4 c3 = k2  k3  k4 Received code word k1k2k3k4c1c2c3 = 1 x 0 = 0 H zero vector means no error k1 k2 k3 k4 C1 C2 C3 Data Communications (E&T2760): Hamming Code

16 Check Matrix H (… continued)
Received code word k1k2k3k4c1c2c3 = 1 x 0 = 1 k1 k2 k3 k4 C1 C2 C3 non-zero means error(s) occurred H  an error has occurred in k3 Data Communications (E&T2760): Hamming Code

17 Encoding Circuit of Hamming (7, 4) Code
Data input k4 k3 k2 k1 Output c3 c2 c1 Data Communications (E&T2760): Hamming Code

18 Decoding Circuit of Hamming (7, 4) Code
Output k4 k3 k2 k1 input Combinational circuit c3 c2 c1 Data Communications (E&T2760): Hamming Code

19 Weakness of Hamming Code
The encoding and decoding circuits become too complicated when the block length is long (i.e. no. of information bits >> 4). Data Communications (E&T2760): Hamming Code

20 Where to Get More Information
Textbook Chapter 6, p.97 to p.106 Exercises Chapter 6, p.115 to p.116, Q6.3, 6.4, 6.5 Data Communications (E&T2760): Hamming Code


Download ppt "Error Detection and Correction – Hamming Code"

Similar presentations


Ads by Google