Check: The sea-check, parity check

Source: Internet
Author: User

1, parity check code

Parity verifies that the number of 1 in the encoding is odd (odd) or even (even) by adding a check bit to the encoding so that the code distance becomes 2. For odd checks, it detects the encoding of an odd-bit error in the code, but cannot find an even-bit error condition. Errors occur in both the odd digits of the legal code. That is, 1 becomes 0 or 0 becomes 1, and the parity of its code changes, thus finding errors. But this kind of verification can only find that an error has occurred, but I don't know which one was wrong.

Parity check code of 8421 yards

Decimal number 8421 BCD Code 8421 yards with odd check digit 8421 yards with even parity bit
0 0000 0000 1 0000 0
1 0001 0001 0 0001 1
2 0010 0010 0 0010 1
3 0011 0011 0 0011 0
4 0100 0100 1 0100 1
5 0101 0101 0 0101 0
6 0110 0110 1 0110 0
7 0111 0111 0 0111 1
8 1000 1000 0 1000 1
9 1001 1001 1 1001 0

There are three common parity checks: horizontal parity, vertical parity check, and horizontal vertical parity.

Shunpingchi parity: Adds a check bit to the encoding of each type of data, so that the information bit is in the same line as the check digit

Vertical parity: This check divides the data into groups, a set of rows, neatly arranged, plus a row of check bits, to sample odd or even parity for each column.

Check for 32-bit data: 10100101 00110110 11001100 10101011:

        vertical parity check                 vertical parity         
Data

10100101

00110110

11001100

10101011

10100101

00110110

11001100

10101011

Check digit 00001011 11110100

That's what it means:--------------------------------------------------------------------------------------------------------------

A horizontal check is similar to a vertical level check.

2. Sea-PlainText

Sea-code is also the use of parity check and error correction verification method, the composition of the code is: the data bits inserted between the K check digit, by expanding the distance to the time to check and error correction. For example: for 8-bit data, 4 check bits are required for verification. For example, make data bits: D7, D6, D5, D4, D3, D2, D1, D0, and check bit: P4, P3, P2, P1. Then encode the location:

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

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

The location of the check code is in the position of the 2^i. Each check bit verifies only the binary encoding of the location number in the data and the binary encoding of its position number:

As shown:

So the check-off relationship is:

P1 parity: P1, D0, D1, D3, D4, D6

namely: P1=d0⊕d1⊕d3⊕d4⊕d6

P2 parity: P2, D0, D2, D3, D5, D6

namely: P2=d0⊕d2⊕d3⊕d5⊕d6

P3 parity check: P3, D1, D2, D3, D7

namely: P3=d1⊕d2⊕d3⊕d7

P4 parity check: P4, D4, D5, D6, D7

namely: P4=d4⊕d5⊕d6⊕d7

The error detection of the Hamming codes is also very simple, and the following calculations can be performed on the data using the sea-plaintext:

G1=p1⊕d0⊕d1⊕d3⊕d4⊕d6

G2=p2⊕d0⊕d2⊕d3⊕d5⊕d6

G3=p3⊕d1⊕d2⊕d3⊕d7

G4=p4⊕d4⊕d5⊕d6⊕d7

For the resulting value, a parity of 0 means that the accepted data is correct (the odd checksum is all 1) when the G4G3G2G1 is not all 0, indicating that an error occurred, and that the decimal value of G4G3G2G1 indicates the wrong location: such as: g4g3g2g1= 1010, the H10 (D5) is out of the question, the reverse can be corrected.

Set data 01101001, using four check bits to find their even check the sea-codes:

0 1 1 0 1 0 0 1

D7 D6 D5 D4 D3 D2 D1 D1

P1=d0⊕d1⊕d3⊕d4⊕d6=1⊕0⊕1⊕0⊕1=1

P2=d0⊕d2⊕d3⊕d5⊕d6=1⊕0⊕1⊕1⊕1=0

P3=d1⊕d2⊕d3⊕d7=0⊕0⊕1⊕0=1

P4=d4⊕d5⊕d6⊕d7=0⊕1⊕1⊕0=0

Therefore the calibrated sea-codes are:

Check: The sea-check, parity check

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.