1,043 views
1 votes
1 votes
Which of the following results in overflow assuming numbers stored in 6-bit two's complement representation

1) 101011 + 110101

2) 011111 + 000001

And also explain some concept about overflow?

3 Answers

4 votes
4 votes

Note that numbers are represented in 2's complement form. therefore   an-1, bn-1 and sn-1 are sign bits

   1)    an-1 ..............  a a a a0

   2)    bn-1 ..............  b b b b0

     cn  cn-1 ..............  c c  c c0

---------------------------------------------

   3)    sn-1 ..............  s s s s0

 

Yes, there are two formulas for checking is it overflow or not?

i) cn⊕cn-1 = 0 ===> No overflow otherwise there is overflow

ii)   a'n-1 .   b'n-1   sn-1 +   an-1   bn-1   s'n-1  = 0 ===> No overflow otherwise there is overflow


Remembering these formulas easy But understanding the mechanism behind these points are somewhat tough but not impossible...

 

But as i commented

convert them into decimal and perform addition

if resultant decimal no, is in range of 6-bits, then no overflow, else overflow

those points you can easily understand.

1)  A = 1 0 1 0 1 1 ====> -32 +8+2+1 = -21

     B = 1 1 0 1 0 1 ====> -32+16+4+1 = -11

therefore A+B = -21-11=-32, what is the 2's complement range with 6 bits? -32 to +31 therefore no overflow

 

2)  A = 0 1 1 1 1 1 ====> 16+8+4+2+1 = 31

     B = 0 0 0 0 0 1 ====> 1 = 1

therefore A+B = 31+1=32, what is the 2's complement range with 6 bits? -32 to +31 therefore overflow

 

0 votes
0 votes

i think you dont need to convert them to decimal all you need is binary sum these two numbers. 

and follow the formulae, 

1)if value of msb's of input is 00 and msb of sum is 1

or

2)if value of msb's of input is 11 and msb of sum is 0

than its a condition of overflow. and in second case we get

(101011)2 + (110101)2 = (100000)2 carry =1

(011111)2 + (000001)2 = (100000)2  carry =0

so second is  an overflow... (focus only on msb for overflow)

answer is 2.

 

 

Related questions

1 votes
1 votes
1 answer
1
Anuj1995 asked Aug 4, 2018
510 views
Assuming 6-bit 2's complement binary representation the largest number that can be subtracted from (-15) without causing overflow is?
0 votes
0 votes
0 answers
2
Anuj1995 asked Aug 4, 2018
216 views
Let FP be the number of distinct numbers that can be represented in 4-byte IEEE floating point and UI be the number of distinct numbers that can be represented as unsigne...
1 votes
1 votes
1 answer
3
Anuj1995 asked Aug 4, 2018
626 views
For a floating point representation with 64 bits in the mantissa and $12$ bits in the unbiased exponent, the number of significant digits in decimal and the maximum (posi...