Principle of modulo 2 operation

Source: Internet
Author: User

Modulo 2 is a binary algorithm, the core of CRC calibration technology, so before we analyze the CRC algorithm, we must grasp the rules of modulo 2 operation. In the same way as arithmetic, modulo 2 also includes modulo 2 plus, modulo 2 minus, modulo 2 multiplication, and modulo 2 in addition to four binary operations. Moreover, the modulo 2 operation also uses the same operator as arithmetic, which means "+" for modulo 2 plus, "-" for modulo 2 minus, "X" or "•" Represents modulo 2 multiply, "÷" or "/" means 2 apart. Unlike arithmetic, the modulo 2 operation does not consider carry and borrow , i.e. modulo 2 addition is a binary addition without carry, modulo 2 subtraction is a binary subtraction operation without borrow. Thus, when the two bits phases are operated, the values of the two bits determine the result of the operation and are not affected by the previous operation, nor will it be affected next time.


① modulo 2 The addition operation is defined as:
0+0=0 0+1=1 1+0=1 1+1=0
For example, 0101+0011=0110, column-based calculation:
0 1 0 1
+0 0 1 1
––--
0 1 1 0
The ② modulo 2 subtraction operation is defined as:
0-0=0 0-1=1 1-0=1 1-1=0
For example, 0110-0011=0101, column-based calculation:
0 1 1 0
-  0 0 1 1
––--
0 1 0 1
The ③ modulo 2 multiplication operation is defined as:
0x0=0 0x1=0 1x0=0 1x1=1
The multi-bit binary mode 2 multiplication is similar to the common meaning of the multi-bit binary multiplication, the difference is that the latter accumulates the intermediate result (or part of the product) with the addition of carry, and the modulo 2 multiplication to the intermediate result of the processing method is the modulo 2 addition. For example, 1011x101=100111, column-based calculation:
1 0 1 1
     X1 0 1
    -–---
            1 0 1 1
0 0 0 0
+1 0 1 1
––----
1 0 0 1 1 1
The ④ modulo 2 division operation is defined as:
0÷1=0 1÷1=1
The multi-bit binary modulo 2 division is also similar to the multi-bit binary division in the normal sense, but the two adopt different rules on how to determine the quotient of the problem. The latter according to the binary subtraction with the borrow, according to the remainder of the deduction number is sufficient to determine whether the quotient of 1 or 0, if enough to reduce the quotient of 1, otherwise quotient 0. The multi-position modulo 2 division uses modulo 2 subtraction, without the borrow binary subtraction, so it makes no sense to consider whether the remainder is sufficient to subtract the number. In fact, in the CRC operation, always guaranteed that the first of the divisor is 1, then the quotient of modulo 2 division is determined by the result of modulo 2 division of the first and the first bits of the remainder. Since the first digit is always 1, according to the modulo 2 division algorithm, then the first digit of the remainder is 1 on the quotient 1, 0 on the quotient 0. For example 1100100÷1011=1110 ... 110, Column vertical calculation:
1 1 1 0
––----
1 0 1 1)1 1 0 0 1 0 0
      - 1 0 1 1
      ––--
1 1 1 1
-1 0 1 1
––--
1 0 0 0
-1 0 1 1
-–---
0 1 1 0
-0 0 0 0
-–---
1 1 0

Principle of modulo 2 operation (RPM)

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.