Error Correction Principle of hamming code encoding

Source: Internet
Author: User

Error Correction Principle of hamming code encoding

From: http://user.qzone.qq.com/48052347/blog/1297330476

Reference: Explanation of the principle of hamming code verification

1. Introduction:

When a computer stores or moves data, it may produce a data bit error. In this case, the Hamming code can be used to detect and correct the error. Simply put, the Hamming code is an error verification code set, r. w. hamming invented, so it was named hamming.

2. Definition of Hamming Codes and hamming code inequality:

Set: M = data bits, K = check bits, n = Total BITs = m + k, with Hamming inequality:

-

1. Meanings of the Hamming Code inequality:

A)
The total data length is N. If every bit of data has errors, it needs to be stored in N places.

B)
Each check bit can represent: yes or wrong; check bit is K bits, total can represent 2 ^ K status

C)The total encoding length is N, so it contains a certain dislocation and a total of N + 1 states.

D)
SO 2 ^ K then n + 1

E)For the data table, see

2. Hamming Code disadvantages:

Two or more digits cannot be corrected. The hamming code can only implement one digit.

3. Take the typical 4-bit data encoding as an example to demonstrate the working process of the Hamming Code

A)
Data storage format:

According to the previous Hamming Code inequality, when the data bit is 4 bits, the Hamming code check bit must be at least 3 bits.

You can seeThe numbers in D8, D4, D2, and D1 are integers of 2.

B)
Description:

L set: encoding bit code K, verification code bit code P, data bit code n

L a verification code pp will be in the K-bit of the entire code

L k = 2 ^ P-1) = 2 (p-1) to the power

Take a set of 9-digit codes with 5 data bits as an example:

C)
The correspondence between the check bit and the data bit:

Note: ^ is a logical operator or.

P1 = D8 ^ D4 ^ d1

P2 = D8 ^ D2 ^ d1

P3 = D4 ^ D2 ^ d1

Small explanation: There are four data bits in total. Each line of equations lacks one bit, while the missing data bit is dx, and the check bit on the left of the equation is py, X = 2 ^ y (Power Y of 2)

D)
How to calculate the check bit:

P1 '= p1 ^ D8 ^ D4 ^ d1

P2 '= P2 ^ D8 ^ D2 ^ d1

P3 '= P3 ^ D4 ^ D2 ^ d1

Binary numbers arranged from high to low: p3' p1' indicates an error.Encoding bit,There are 5 combinations from 000-011-101-110-111, where 000 indicates yes, 011 indicates a third-digit error, and 101,110,111 indicates a fifth, sixth, and seventh-digit error, respectively. It indicates a certain dislocation of the original data bit d8d4d2d1 & a total of five states are correct.

E)
There is a number: 1101, which is included in the operation:

L D8 = 1, D4 = 1, D2 = 0, d1 = 1,

L p1 = 1, P2 = 0, P3 = 0.

L The result of the Hamming code processing is 1010101

L assume that a D8 error occurs. P3 'p2 'p1' = 0 11 = 3 in decimal format, indicating that the third digit after encoding has an error. In contrast to the storage format table, it is indeed a D8 error.

L hypothesis: D4 error. P3 'p2 'p1' = 101 = 5 in decimal format, which indicates the fifth digit after encoding has an error. It is a D4 error against the storage format table.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.