In the previous tutorial, we discussed how any information can be represented by numbers and a set of numbers (code systems) can be used to store and manipulate information. Much of the real-world information is mathematical in nature like the count of things, measurements of quantities, etc. Such information may further have mathematical relationships. In order for a computer (digital circuit) to perform computing (mathematical operations) on such information, it must be first able to perform arithmetic operations. The arithmetic operations are the basic mathematical operations. Only by performing arithmetic operations, other algebraic operations can be performed on numerical data.

Digital circuits only understand and manipulate binary numbers. So, the arithmetic operations can be performed on data only in binary form. The digital circuits implement various arithmetic operations (binary arithmetic) with the help of logic gates. The electronic circuit of a binary adder (built by logic gates) with suitable shift registers can perform all arithmetic operations. Before understanding how digital circuits capable of performing mathematical operations can be built using logic gates, it is important to understand how various arithmetic operations are executed in binary form. So, let us learn the basics of Boolean algebra.

*Fig. 1: Representational Image of Binary Arithmetic Operations*

Any binary number consists of 0 and 1. A binary number is formed by placement of 0 and 1 at different positional weights in the number. The arithmetic operations like addition, subtraction, multiplication and division of binary numbers follow the rules as summarized in the table below –

*Fig. 2: Table listing Binary Arithmatic Operations*

**Binary Addition**

The addition of two binary numbers is done the same way as is done for the decimal numbers. The addition is carried out from the least significant bits and it proceeds to higher significant bits, adding the carry resulting from the previous addition each time. For example, the addition of the binary numbers (1010)2 and (1111)2 is done the following manner –

*Â Fig. 3: Table showing Binary Addition*

1) The least significant bits are added, i.e. 0 + 1 = 1 with a carry 0.The addition carried out above involves the following steps –

2) The carry in the previous step is added to the next higher significant bits, i.e. 1 + 1 + 0 = 0 with a carry 1.

3) The carry in the above step is added to the next higher significant bits, i.e. 0 + 1 + 1 = 0 with a carry 1.

4) The preceding carry is added to the most significant bits, i.e. 1 + 1 + 1 = 1 with a carry 1.

So, the sum is (11001)2. The addition is also shown in the decimal number system in order to compare the results. It can be seen that whether numbers are added in decimal form or binary form, the end result is always equivalent.

*Binary Subtraction *

Like the subtraction of decimal numbers is done, similarly is the subtraction of binary numbers done. The subtraction is carried out from the least significant bits and proceeds to the higher significant bits. For example consider subtracting (1101)2 by (1001)2 as follow –

*Fig. 4: Table showing Binary SubtractionÂ*

1) The LSB in the first column are 1 and 1. Hence, the difference 1 â€“ 1 = 0.

2) In the second column, the subtraction is performed as 0 â€“ 0 = 0.

3) In the third column, the difference is given by 1 â€“ 0 = 1.

4) In the fourth column (MSB), the difference is given by 1 â€“ 1 = 0.

So, the difference between the two binary numbers is (0100)2.

When 1 is subtracted from 0, the 1 is borrowed from the immediate higher significant bit. The binary subtraction with borrow case is shown below –

*Fig. 5: Table showing Binary Subtraction with Borrow*

1) The least significant bits in the first column are 1 and 1. Hence, the difference is 1 â€“ 1 = 0.

2) In the second column, it is not possible to subtract the 1 from 0. So, a 1 has to be borrowed from the next MSB (3^{rd} bit). Bit since the 3^{rd} bit is also 0, borrowing has to be done from the MSB (4^{th} bit). The borrowing of 1 from the 4^{th} bit results in 1 and 10 with weight 4 in the 3^{rd} column and 0 in 4^{th} column as shown above. Now, the subtraction is performed as 10 â€“ 1 = 1.

3) In the third column, the difference is given by 1 â€“ 1 = 0.

4) In the fourth column (MSB), the difference is given by 0 â€“ 0 = 0.

*1â€™s and 2â€™s Complements*** –Â **The subtraction of a number from another can be accomplished by adding the complement of the subtrahend to the minuend. The exact difference can be obtained with minor manipulations.

**1â€™s Complement Subtraction**

The Subtraction of binary numbers using the 1â€™s complement method allows subtraction only by addition. The 1â€™s complement of a binary number can be obtained by changing all 1s to 0s and all 0s to 1s. The subtraction of a smaller number from a larger number by the 1â€™s complement method is done as follow –

1) Determine the 1â€™s complement of the smaller number.

2) Add this to the larger number.

3) Remove the carry and add it to the result. This carry is called end-around-carry.

For example, the subtraction of (1010)2 from (1111)2 using one’s compliment can be done as follow –

*Fig. 6: Table showing 1â€™s Complement Subtraction*

1) Determine the 1â€™s complement of the larger number.The subtraction of a larger number from a smaller one by the 1â€™s complement method involves the following steps –

2) Add this to the smaller number.

3) The answer is the 1â€™s complement of the true result and it is opposite in sign. There is no carry. The difference is a negative number. For example, the subtraction of (1111)2 from (1010)2 using one’s compliment can be done as follow –

*Fig. 7: Table showing 1â€™s Complement Subtraction*

**2â€™s Complement Subtraction**Â

The 2â€™s complement of a binary number can be obtained by adding 1 to its 1â€™s complement. Subtraction of a smaller number from a larger one by the 2â€™s complement method involves following steps –

1) Determine the 2â€™s complement of the smaller number.

2) Add this to the larger number.

3) Omit the Carry.

The subtraction of a larger number from a smaller one by the 2â€™s complement method involves the following steps –

1) For subtracting the smaller number from larger number first take 1â€™s complement of smaller number.

2) Add 1 to the smaller number which has taken 1â€™s complement in above step to get 2’s complement.

3) Add the 2â€™s complement number determined in above step to the larger number given.

4) Discard the carry, the difference is the result obtained with negative sign.

For example, the subtraction of (1010)2 from (1111)2 using the 2â€™s complement is done the following way –

*Fig. 8: Table showing 2â€™s Complement SubtractionÂ *

**Binary Multiplication**

The binary multiplication is as simple as decimal multiplication. The procedure is same as that of decimal multiplication. For example, the multiplication of (1011)2 and (1101)2 can be done as follow –

*Fig. 9: Image showing Binary Multiplication*

The multiplication carried out above involves the following steps –

1) The least significant bit of the multiplier is taken. If the multiplier bit is 1, the multiplicand is copied as such and, if the multiplier bit is 0, a 0 is placed in all the bit positions.

2) The next higher significant bit of the multiplier is taken and the partial product is written with a shift to the left, as in step 1.

3) Step 2 is repeated for all other higher significant bits and each time a left shift is given.

4) When all the bits in the multiplier have been taken into account, the partial product terms are added, which give the actual product of the multiplier and the multiplicant.

**Binary Division **

The binary division is done similar to the decimal division. For example, the division of (1011)2 by (11)2 can be done as follow –

Â Q=__11Â __

11 |1011| R = 10

Â Â Â Â Â Â Â Â Â __11__

Â Â Â Â Â Â Â Â Â 101

Â Â Â Â Â Â Â Â Â Â Â Â __11__

Â Â Â Â Â Â Â Â Â Â Â Â 10

The division carried out above involves the following steps –

1) The MSB of the dividend is subtracted from the divisor. If there is need to borrow, MSB is used to borrow 1. The difference is written down and LSB next to it is carried down. The divisor as 1 or 0 is written from left to right in the quotient.

2) The step 1 is repeated until a remainder less than the divisor is left.

3) The quotient is noted from left to right which is the result of the division.

This is how the arithmetic operations of addition, subtraction, multiplication and division can be done on the binary numbers. In the next tutorial, learn about logical operations on binary numbers. The logical gates which form the digital circuits, perform the logical operations. The arithmetic operations are also realized on digital circuits with the help of logical operations only with the help of logic gates and their interconnections on the data paths.

### You may also like:

Filed Under: Digital Electronics, Tutorials

## Questions related to this article?

đź‘‰Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.

Tell Us What You Think!!

You must be logged in to post a comment.