in Digital Logic edited by
10,247 views
26 votes
26 votes

Using a $4-bit$ $2's$ complement arithmetic, which of the following additions will result in an overflow?

  1. $1100 + 1100$
  2. $0011 + 0111$
  3. $1111 + 0111$
  1. i only
  2. ii only
  3. iii only
  4. i and iii only
in Digital Logic edited by
10.2k views

4 Comments

with 4 bits the range of 2's complement numbers is $-2^{n-1} to + 2^{n-1}-1)$ i.e. -8 to +7
1. sum = -8
2. sum = +10 (overflow)
3. Addition of two numbers of different sign never overflows.

hence, (b) is correct option!

25
25

Addition of a positive and a negative number can never lead to an overflow. Hence, (iii) is ruled out straightaway.

Overflow happens iff $MSB_p+MSB_q=\overline{MSB_r}$ ie, if the MSB of the result is different than the MSB of inputs.

$1100+1100=11000$ MSB of the result isn't different.

$0011+0111=1010$ MSB of the output is different. So, overflow.

 

Option B

7
7
Bro I have learnt a lot of things from your answers.
0
0

4 Answers

45 votes
45 votes
Best answer

Only (ii) is the answer. 

In $2's$ complement arithmetic, overflow happens only when 

  1. Sign bit of two input numbers is $0$, and the result has sign bit $1$
  2. Sign bit of two input numbers is $1$, and the result has sign bit $0$.

Overflow is important only for signed arithmetic while carry is important only for unsigned arithmetic.

A carry happens when there is a carry to (or borrow from) the most significant bit. Here, (i) and (iii) cause a carry but only (ii) causes overflow. 

http://teaching.idallen.com/dat2343/10f/notes/040_overflow.txt

edited by
by

4 Comments

Rather than mugging any kind of formula even it is possible to answer this question provided we know to find range in 2's complement. Here range is from -8 to 7.

option a gives : -8

          b gives :10

          c gives : 6
2
2

so  the correct option is (b)

0
0
Also note: Adding 2 different signed data → Overflow can never occur
1
1
6 votes
6 votes

$($ Carry of $n-1^{th}$ $\oplus$ Carry of $n^{th}) = 1$ Then overflow in 2's complement

$\text{Format of a number here}:\color{green} {C_4}\color{red}{C_3}C_2C_1C_0$ 

In above format $C_4$ is $n^{th}$ carry

$(i) \space 1100 +1100 = 1000 $  Here $C_{n-1} = 1 , C_n = 1$  so $C_{n-1}\oplus C_n = 1 \oplus 1 = 0$

$(ii) \space 0011 +0111 = 1010 $  Here $C_{n-1} = 1 , C_n = 0$  so $C_{n-1}\oplus C_n = 1 \oplus 0 = 1$

$(iii) \space 1111 +0111 = 0110 $  Here $C_{n-1} = 1 , C_n = 1$  so $C_{n-1}\oplus C_n = 1 \oplus 1 = 0$

So option $B$ is only right choice

0 votes
0 votes
we can also use overflow logic----->
OV(x,y,z) =x'y'z + xyz'
where x is msb bit of operand 1.y is msb bit of operand 2.And z is msb bit of result excluding carry.

1 comment

@saurabh

so what when the result is 1 what it means

and when 0 what is signify ? illustrate that
0
0
–2 votes
–2 votes
D) (i) and  (iii) only.

Please comment if anyone finds it wrong !

1 comment

(iii) will not result in an overflow. Please see the selected answer.
1
1
Answer:

Related questions