- Digital Circuits Tutorial
- Home
- Number Systems
- Base Conversions
- Binary Numbers Representation
- Signed Binary Arithmetic
- Codes
- Error Detection & Correction Codes
- Boolean Algebra
- Canonical and Standard Forms
- K-Map Method
- Quine-McCluskey Tabular Method
- Logic Gates
- Two-Level Logic Realization
- Combinational Circuits
- Arithmetic Circuits
- Decoders
- Encoders
- Multiplexers
- De-Multiplexers
- Programmable Logic Devices
- Threshold Logic
- Sequential Circuits
- Latches
- Flip-Flops
- Conversion of Flip-Flops
- Shift Registers
- Application of Shift Registers
- Counters
- Finite State Machines
- Algorithmic State Machine Charts

- Digital Circuits Resources
- Digital Circuits - Quick Guide
- Digital Circuits - Useful Resources
- Digital Circuits - Discussion

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

In this chapter, let us discuss about the basic arithmetic operations, which can be performed on any two signed binary numbers using 2’s complement method. The **basic arithmetic operations** are addition and subtraction.

Consider the two signed binary numbers A & B, which are represented in 2’s complement form. We can perform the **addition** of these two numbers, which is similar to the addition of two unsigned binary numbers. But, if the resultant sum contains carry out from sign bit, then discard (ignore) it in order to get the correct value.

If resultant sum is positive, you can find the magnitude of it directly. But, if the resultant sum is negative, then take 2’s complement of it in order to get the magnitude.

Let us perform the **addition** of two decimal numbers **+7 and +4** using 2’s complement method.

The **2’s complement** representations of +7 and +4 with 5 bits each are shown below.

(+7)_{10} = (00111)_{2}

(+4)_{10} = (00100)_{2}

The addition of these two numbers is

(+7)_{10} +(+4)_{10} = (00111)_{2}+(00100)_{2}

⇒(+7)_{10} +(+4)_{10} = (01011)_{2}.

The resultant sum contains 5 bits. So, there is no carry out from sign bit. The sign bit ‘0’ indicates that the resultant sum is **positive**. So, the magnitude of sum is 11 in decimal number system. Therefore, addition of two positive numbers will give another positive number.

Let us perform the **addition** of two decimal numbers **-7** and **-4** using 2’s complement method.

The **2’s complement** representation of -7 and -4 with 5 bits each are shown below.

(−7)_{10} = (11001)_{2}

(−4)_{10} = (11100)_{2}

The addition of these two numbers is

(−7)_{10} + (−4)_{10} = (11001)_{2} + (11100)_{2}

⇒(−7)_{10} + (−4)_{10} = (110101)_{2}.

The resultant sum contains 6 bits. In this case, carry is obtained from sign bit. So, we can remove it

Resultant sum after removing carry is (−7)_{10} + (−4)_{10} = **(10101) _{2}**.

The sign bit ‘1’ indicates that the resultant sum is **negative**. So, by taking 2’s complement of it we will get the magnitude of resultant sum as 11 in decimal number system. Therefore, addition of two negative numbers will give another negative number.

Consider the two signed binary numbers A & B, which are represented in 2’s complement form. We know that 2’s complement of positive number gives a negative number. So, whenever we have to subtract a number B from number A, then take 2’s complement of B and add it to A. So, **mathematically** we can write it as

**A - B = A + (2's complement of B)**

Similarly, if we have to subtract the number A from number B, then take 2’s complement of A and add it to B. So, **mathematically** we can write it as

**B - A = B + (2's complement of A)**

So, the subtraction of two signed binary numbers is similar to the addition of two signed binary numbers. But, we have to take 2’s complement of the number, which is supposed to be subtracted. This is the **advantage** of 2’s complement technique. Follow, the same rules of addition of two signed binary numbers.

Let us perform the **subtraction** of two decimal numbers **+7 and +4** using 2’s complement method.

The subtraction of these two numbers is

(+7)_{10} − (+4)_{10} = (+7)_{10} + (−4)_{10}.

The **2’s complement** representation of +7 and -4 with 5 bits each are shown below.

(+7)_{10} = (00111)_{2}

(+4)_{10} = (11100)_{2}

⇒(+7)_{10} + (+4)_{10} = (00111)_{2} + (11100)_{2} = (00011)_{2}

Here, the carry obtained from sign bit. So, we can remove it. The resultant sum after removing carry is

(+7)_{10} + (+4)_{10} = **(00011) _{2}**

The sign bit ‘0’ indicates that the resultant sum is **positive**. So, the magnitude of it is 3 in decimal number system. Therefore, subtraction of two decimal numbers +7 and +4 is +3.

Let us perform the **subtraction of** two decimal numbers **+4** and **+7** using 2’s complement method.

The subtraction of these two numbers is

(+4)_{10} − (+7)_{10} = (+4)_{10} + (−7)_{10}.

The **2’s complement** representation of +4 and -7 with 5 bits each are shown below.

(+4)_{10} = (00100)_{2}

(-7)_{10} = (11001)_{2}

⇒(+4)_{10} + (-7)_{10} = (00100)_{2} + (11001)_{2} = (11101)_{2}

Here, carry is not obtained from sign bit. The sign bit ‘1’ indicates that the resultant sum is **negative**. So, by taking 2’s complement of it we will get the magnitude of resultant sum as 3 in decimal number system. Therefore, subtraction of two decimal numbers +4 and +7 is -3.

Advertisements