The Gateway to Computer Science Excellence
+29 votes

When two 8-bit numbers $A_{7}...A_{0}$ and $B_{7}...B_{0}$ in 2's complement representation (with $A_{0}$ and $B_{0}$ as the least significant bits) are added using a ripple-carry adder, the sum bits obtained are $S_{7}...S_{0}$ and the carry bits are $C_{7}...C_{0}$. An overflow is said to have occurred if

  1. the carry bit $C_{7}$ is 1
  2. all the carry bits $\left ( C_{7},...,C_{0} \right )$ are 1
  3. $\left ( A_{7}.B_{7}.\bar{S_{7}}+\bar{A_{7}}.\bar{B_{7}}.S_{7} \right )$ is 1
  4. $\left ( A_{0}.B_{0}.\bar{S_{0}}+\bar{A_{0}}.\bar{B_{0}}.S_{0} \right )$ is 1
in Digital Logic by Veteran (434k points)
edited by | 4.9k views

6 Answers

+31 votes
Best answer

Answer is (C)

Overflow is said to occur in the following cases
$$\begin{array}{|c|c|c|} \hline \textbf{C7} & \textbf {C6} &\textbf {Overflow} \\\hline0&0&  \text{NO}\\\hline0&1& \text{YES} \\\hline 1&0&\text{YES} \\\hline 1&1&\text{NO}  \\\hline \end{array}$$
The $3^{rd}$ condition occurs in the following case A7B7S7', now the question arises how? 
$$\begin{array}{|c|c|c|} \hline \textbf{C7} & \textbf {C6}\\\hline  \text{A7}&1\\\text{B7}&1 \\ \text{S7}&0  \\\hline \end{array}$$

NOW, $A7=1$ AND $B7=1 S7=0$ is only possible when $C6=0$ otherwise $S7$ would become $1$.

$C7$ has to be $1$ $($$1+1+0$ generates carry$)$

ON similar basis we can prove that $C7=0$ and $C6=1$ is produced by $A7'B7'S7$. Hence, either of the two conditions cause overflow. Hence(C).

Why not A? when $C7=1$ and $C6 =1$ this doesn't indicate overflow ($4^{th}$ row in the table)

Why not B? if all carry bits are $1$ then, $C7=1$ and $C6=$1 (This also generates $4^{th}$ row)

Why not D? These combinations are $C0$ and $C1$, the lower carrys do not indicate overflow

edited by

I think B) is a absurd option

C0 cannot be 1 in any case

why? What if A0 and B0 are '1' then adding them would give carry bit c0 as '1' right?
good exp ...
@srestha @ srestha

C0 is carry generated by adding a0 and b0

c7 is carry generated by a7 + b7 + c6
Co has no carray, we take C0=0
@srestha @ srestha
I think in this question , C0 is carry generated out of full adder 0 , not carry in to full adder 0.
Also there is no C8 mentioned , so C0 to c7 must be cout carries each corresponding to adder 0 to 7
So c0 can be 1 if a0 and b0 are both 1.
best explanation.
+45 votes
by Loyal (6.8k points)
I think your arrows are pointing to wrong things... interchange them? otherwise good answer! iguess
Positive operands means A7(0)  B7(0) and S7(1)

Negative operands means A7(1)  B7(1) and S7(0)

Otherwise the ans is perfect..!
+15 votes

Observe one thing, Overflow can occur when we add two negative numbers or two positive numbers. When we add one negative and one positive number, there can't be an overflow.

Now when we add two positive numbers, result should always be positive and when we add two negative numbers, result should be negative, In representation of signed binary numbers, MSB represents sign of number.

1. Now if MSB of both input numbers is 1 (means numbers are negative) but MSB of sum is 0 (means sum is positive) then it means there is an overflow.

2. Similarly, when MSB of both inputs is 0 (means numbers are positive), but MSB of sum is 1 (means sum is negative), then it also indicates overflow.

Statement 1 above indicates, A'7B'7S7 is 1. Statement 2 above indicates A7B7S'7 is 1.

Hence Option C is answer

by Active (3.2k points)
+4 votes

the solution is  C)

if Both A7 and B7 is 1 then C7 will be 1 and S7 is 0 means C6 is 0 hence C7.C6'

if Both A7 and B7 is 0 then C7 will be 0 and S7 is 1 means C6 is 1 hence C7'.C6

hence combining both we get C7.C6'+C7'.C6

which is C7 XOR C6 which is condition of detecting  Overflow

by Active (2k points)
+3 votes

Answer: (C) 

Explanation: Overflow indicates that the result was too large or too small to fit in the original data type.
Overflow flag indicates an overflow condition for a signed operation. Signed numbers are represented in two’s complement representation. 
The overflow occurs only when two positive number are added and the result is negative or two negative number are added and the result is positive. Otherwise, the sum has not overflowed.

Therefore, a XOR operation can quickly determine if an overflow condition exists. i.e., 
(A7 . B7 )⊕(S7) = (A7 . B7 . S7‘ + A7‘ . B7‘ . S7 = 1

by (179 points)
+1 vote

Option (c) is correct

by (263 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,833 questions
57,729 answers
107,862 users