Group _ Hamming Check Code

Source: Internet
Author: User

principle:Several check codes are added to the data, and each bits of the data is assigned to several parity groups.

Set: The number of check bits is R, can represent 2^r information, one means "no error", 2^r-1 to indicate the error occurred in which one.

k= 2^r–1-r information can be used to correct a data bit.

2^r≥k+r+1

To detect and correct a single error, while discovering two errors, the R,k should meet the following relationships: 2^r-1≥k+r (see table 3.8)

How the check bit and data bits are arranged

Check bit arrangement in 2^ (i–1) (I =0,1,2,...) The location

Example: There is an encoding of D4D3D2D1, which generates a sea-code

7 6 5 4 3 2 1

D4 D3 D2 P3 D1 P2 P1

2^2 2^1 2^0

One byte of information is required to generate a sea-plaintext

D8 D7 D6 D5 P4 D4 D3 D2 P3 D1 P2 P1

8 4 2 1

The relationship between the check bit pi and the value bit di of the sea-plaintext(the bit number of each sea code is equal to the sum of the bits of several test bits that participate in verifying it.) )– Example: There is a code for 1011

p3= D4⊕D3⊕D2

0 = 1⊕0⊕1

P2= D4⊕D3⊕D1

0 = 1⊕0⊕1

P1 = D4⊕d2⊕d1

1 = 1⊕1⊕1

The last 1010101 of the sea-plaintext

7=4+2+1 6=4+2 5=4+1 3=2+1

Set the Hamming check code a total of M-bit (m=k+r), shaped like:

The law of Code of the Sea codes is usually:

1. The sum of the parity and data bits is m, each check bit pi is in the position of the 2^ (i-1), and the remaining data bits are arranged from low to high.

2. Each bit of the sea Code hi is verified by multiple check bit, the relationship is: the bit number of each bit of the checksum is equal to the checksum of the check bit number.

A byte of the sea-plaintext is discussed according to the above rules.

D8d7d6d5 d4d3d2d1

8-bit binary number, k=8, according to 2^r-1≥k+r, R should be 5,m=13

• The sea-plaintext can be expressed as: H13h12 ... H2H1

1. The sum of the check bit and data bits is m, each check bit pi is divided into the position of the 2^ (i-1), p5~p1 corresponds to H13,h8,h4, H2 H1

The rest is data bits, shaped like:

H13 H12 H11 H10 H9 H8 H7 H6 H5 H4 H3 H2 H1

P5 D8 D7 D6 D5 P4 D4 D3 D2 P3 D1 P2 P1

4 1 2 1 8 1 2 1 4 1 2 1

8 2,8 8 8 2,4 4 4 2

The bit number of each bit is equal to the sum of each check bit number.

P1 participated in D1 D2 D4 D5 D7 checksum.

P2 participated in D1 D3 D4 D6 D7 checksum.

P3 participated in the calibration of D 2 D3 D4 D8

From this, we can find out the results of the data bits forming PI value parity.

P1=d1⊕d 2⊕d4⊕d5⊕d7

P2 =d1⊕d3⊕d4⊕d6⊕d7

P3 =d 2⊕d3⊕d4⊕d8

P4 =d 5⊕d6⊕d7⊕d8

If you want to distinguish between a two-bit error or an error, you should also add a P5 He hui test bit. Make:

P5=d1⊕d2⊕d3⊕d4⊕d5⊕d6⊕d7⊕d8⊕p4⊕p3

⊕p2⊕p1

From this, a parity group can be obtained.

s1= p1⊕d1⊕d 2⊕d4⊕d5⊕d7

S2= P2⊕d1⊕d3⊕d4⊕d6⊕d7

s3= p3⊕d 2⊕d3⊕d4⊕d8

s4= p4⊕d 5⊕d6⊕d7⊕d8

s5= p5⊕p4⊕p3⊕p2⊕p1⊕ D1⊕d2⊕d3⊕d4⊕d5⊕d6⊕d7⊕d8

S1 ~ S5 can reflect the error of 13-bit sea-codes.

s1= p1⊕d1⊕d 2⊕d4⊕d5⊕d7

S2= P2⊕d1⊕d3⊕d4⊕d6⊕d7

s3= p3⊕d 2⊕d3⊕d4⊕d8

s4= p4⊕d 5⊕d6⊕d7⊕d8

S4 ~ S1 is full 0, that's right . S4 ~ S1 is not full 0, stating that there is an error . S5=1 Description 1 bit error , and s5=0 2 bit fault, no longer valid, and can not find out which 2 bit error .

the encoded value of S4 ~ S1 is exactly equal to the bit number of the wrong Sea-code. such as: 1100 and 1011, respectively, indicate H12 (D8) and H11 (D7) error.

If only one of the S4 ~ S1 is not 0, there is an error in the check bit. P1 (i.e. H1) error when s1≠0; P2 (i.e. H2) error when s2≠0; P3 (i.e. H4) error when s3≠0; P4 (that is, H8) error when s4≠0.

If S4 ~ S1 has 2 or more than 0, then there is a 1-bit data error (two-bit [refers to r=4] or two-bit data is not checked out at the same time). The encoded value of S4 ~ S1 is exactly equal to the bit number of the error. such as: 1100 and 1011, respectively, indicate H12 (D8) and H11 (D7) error.

Assuming that S1, S4 is not 0, S2, S3 is 0, then P1 and P4 two check bit error, check the formula, in S1 and S4 at the same time in S2 and S3 not appear in the data only D5 one, so D5 error. Or check the table, P1 corresponding to H1, P4 corresponding to H8, the error of the sea-code =1+8=9, that is H9 error, H9 corresponding D5.

Group _ Hamming Check Code

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.