# Modulo 2 Operation principle modulo 2 addition, modulo 2 subtraction, modulo 2 multiplication, modulo 2 division

Source: Internet
Author: User

Modulo 2 is a binary algorithm, the core ofCRC 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.

The modulo 2 addition operation is defined as:
0+0=0         0+1=1         1+0=1   < Span class= "Apple-converted-space" >     1+1=0
For example 0101+0011= 0110, Column vertical 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 vertical calculation:
0 1 1 0
-0 0 1 1
──────
0 1 0 1

The modulo 2 multiplication operation is defined as:
0x0=00x1=0  1x0=0         1x1=< Span lang= "en-US" >1
Multi-bit binary modulo 2 multiplication is analogous to a multi-bit binary multiplication in the general sense, where the difference is in the addition of a carry when the latter accumulates intermediate results (or partial product), and modulo 2 the method of processing intermediate results using the modulo 2 addition. For example 1011x101=100111, column vertical calculation:
&NBSP;&NBSP;&NBSP; 1 0 1 1
x  1 0 1
──────
1 0 1 1
0 0 0 0

< Span lang= "en-US" > 1 0 1 1
────────
1 0 0 1 1 1

modulo 2 division operation defined as:
0÷1=0         1÷1=1
Multi-bit binary modules 2 division is also similar to multi-bit binary division in the general sense, but the two adopt different rules on how to determine the quotient of the problem. The latter according to the binary subtraction with borrow, according to the remainder of the deduction number is sufficient to determine whether the quotient 1 or the 0, if enough to reduce the 1, otherwise the business 0. Multi-bit mode 2 division uses modulo 2 subtraction, without 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 guarantee that the first divisor is 1, then the quotient of the modulo 2 division is the first and the first digit of the remainder of the modulo 2 division operation result OK < Span lang= "en-us".

When the number of digits and in addition to the same number of digits, only the difference or operation, the first bit of the remainder is 1, the quotient is 1, the first digit of the remainder is 0, the quotient is 0. When the number of digits is less than the divisor, quotient 0, the remainder to the right to fill a bit, the number of bits is still less than the divisor, then continue to 0, when the number of digits and in addition to the same number of digits, quotient 1, the difference or operation, the new remainder, so as to dividend last.

Because apart from the first digit always1, according to the mold2Division algorithm, then the first digit of the remainder is1 on Business1, is0 on Business0. For example1100100÷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

Modulo 2 Operation principle modulo 2 addition, modulo 2 subtraction, modulo 2 multiplication, modulo 2 division

Related Keywords:

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.