We consider the addition of two 2’s complement numbers bn-1bn-2...b0 and…

2017

We consider the addition of two 2’s complement numbers bn-1bn-2...b0 and an-1an-2...a0. A binary adder for adding unsigned binary numbers is used to add the two numbers. The sum is denoted by cn-1cn-2...c0 and the carry-out by cout. Which one of the following options correctly identifies the overflow condition?

GATECS2006Q39
  1. A.

    A

  2. B.

    B

  3. C.

    C

  4. D.

    D

Attempted by 112 students.

Show answer & explanation

Correct answer: B

In 2's-complement addition, overflow occurs only when the two operands have the same sign but the result has the opposite sign: two positive numbers produce a negative result, or two negative numbers produce a positive result. Equivalently, overflow is detected by comparing the carry into the most significant bit with the carry out of the most significant bit. If these two carries are different, overflow has occurred. Thus the overflow flag is carry_into_MSB XOR carry_out_MSB, which corresponds to option B.

Explore the full course: Isro