• edited by
30,115 views
76 76 votes

We consider the addition of two $2's$ complement numbers $ b_{n-1}b_{n-2}\dots b_{0}$ and $a_{n-1}a_{n-2}\dots a_{0}$. A binary adder for adding unsigned binary numbers is used to add  the two numbers. The sum is denoted by $ c_{n-1}c_{n-2}\dots c_{0}$ and the carry-out by $ c_{out}$. Which one of the following options correctly identifies the overflow condition?

  1. $ c_{out}\left( \overline{a_{n-1}\oplus b_{n-1}} \right)$
  2. $ a_{n-1}b_{n-1}\overline{c_{n-1}}+\overline{a_{n-1}}\overline{b_{n-1}}c_{n-1}$
  3. $ c_{out}\oplus c_{n-1}$
  4. $ a_{n-1}\oplus b_{n-1}\oplus c_{n-1}$

6 Answers

Best answer
80 80 votes

Number representation in 2's complement representation:

  • Positive numbers as they are
  • Negative numbers in $2's$ complement form.

So, the overflow conditions are

  1. When we add two positive numbers (sign bit $0$) and we get a sign bit $1$
  2. When we add two negative numbers (sign bit $1$) and we get sign bit $0$
  3. Overflow is relevant only for signed numbers and carry is used for unsigned numbers
  4. When the carryout bit and the carryin to the most significant bit differs

PS: When we add one positive and one negative number we won't get a carry. Also points $1$ and $2$ are leading to point $4$.

Now the question is a bit tricky. It is actually asking the condition of overflow of signed numbers when we use an adder which is meant to work for unsigned numbers.

So, if we see the options, B is the correct one here as the first part takes care of case 2 (negative numbers) and the second part takes care of case 1 (positive numbers) - point 4.  We can see counterexamples for other options:

A - Let $n=4$ and we do $0111 + 0111 = 1110$. This overflows as in $2's$ complement representation we can store only up to $7$. But the overflow condition in A returns false as $c_{out} = 0$.

$C$ - This works for the above example. But fails for   $1001 + 0001 = 1010$ where there is no actual overflow $(-7+1 = -6)$, but the given condition gives an overflow as $c_{out} =0$ and $c_{n-1} = 1$.

D - This works for both the above examples, but fails for $1111 + 1111 = 1110$ $(-1 + -1 = -2)$ where there is no actual overflow but the given condition says so.

Reference: http://www.mhhe.com/engcs/electrical/hamacher/5e/graphics/ch02_025-102.pdf

Thanks, @Dilpreet for the link and correction.

• edited by
35 35 votes
A'B'C+ABC'

Answer should be B. But I think there is a typo in B.

My answer:- A N-1B N-1CN-1’ +  A N-1’B N-1’CN-1

7 7 votes

suppose i m taking two +ve no and two -ve no and we perform its addition in two's complement no 

+70   0 1 0 0 0 1 1 0
+80   0 1 0 1 0 0 0 0
add   1 0 0 1 0 1 1 0
  cout msb c(n-1)            

here no carry is transfered to cout but c(n-1) is transfered to msb 

-70   1 0 1 1 1 0 1 0
-80   1 0 1 1 0 0 0 0
add 1 0 1 1 0 1 0 1 0
  cout msb c(n-1)            

here carry is transfered to cout and no c(n-1) is trasfered to msb

therefore,cout' c(n-1)+cout c(n-1)' =cout XOR C(n-1)

and another notable point is that there is no condition for overflow for +ve nd -ve no and also for -ve and +ve no

• edited by
0 0 votes

overflow in case of unsigned number

*overflow is case of unsigned number occurred if carry is produced. e.g(101+110=1011)

overflow in case of signed number

*overflow is occurred only if  M.S.B of two number is same and there result is different.

in case of two positive number M.S.B be one and M.S.B of there result is 0 if overflow occurred

which is written as  an-1 .bn-1.c'n-1

in case of two negative number M.S.B be 0 and M.S.B of there result is 1 if overflow occurred

which is written as a'n-1.b'n-1.cn-1 

in combined case of postive and negative number overflow occurred

Overflow Expression: a'n-1.b'n-1.cn-1 + an-1 .bn-1.c'n-1

 

0 0 votes

It took me long to analyse but After reading Carl Hamacher, I understood that overflow is occured when we talk of signed numbers only. For unsigned numbers we have carry bit to take care of the stuff.

Example

     1011 (-5)

 +  1000 (-8)

1   0011

This example is for signed, but if you see if we neglect carry out Cout then also we see the sign of An-1 and Bn-1 and Cn-1

So clearly for the clarity whenever be it signed or unsigned, if sign of An-1 == sign of Bn-1 then overflow occurs if sign of Cn-1 is complement of An-1

 

C is correct

 

1 flag:
✌ Edit necessary (js__)
Answer:
Position:
Show:

Related questions

132 132 votes
11 answers 11 answers
33.8k
33.8k views
Rucha Shelke asked Sep 26, 2014
33,779 views
Consider numbers represented in 4-bit Gray code. Let $ h_{3}h_{2}h_{1}h_{0}$ be the Gray code representation of a number $n$ and let $ g_{3}g_{2}g_{1}g_{0}$ be the Gray...
101 101 votes
8 answers 8 answers
26.3k
26.3k views
Rucha Shelke asked Sep 22, 2014
26,292 views
Given two three bit numbers $a_{2}a_{1}a_{0}$ and $b_{2}b_{1}b_{0}$ and $c$ the carry in, the function that represents the carry generate function when these two numbers ...
42 42 votes
2 answers 2 answers
15.4k
15.4k views
Rucha Shelke asked Sep 22, 2014
15,419 views
Consider the circuit above. Which one of the following options correctly represents $f\left(x,y,z\right)$$x\bar{z}+xy+\bar{y}z$$x\bar{z}+xy+\overline{yz}$$xz+xy+\overline...
86 86 votes
7 7 answers
31.5k
31.5k views
Rucha Shelke asked Sep 16, 2014
31,497 views
You are given a free running clock with a duty cycle of $50\%$ and a digital waveform $f$ which changes only at the negative edge of the clock. Which one of the following...