retagged by
1,780 views
6 votes
6 votes

If the last operation performed on a computer with an $8$-bit word was an addition in which the two operands were $00000010$ and $00000011$, what would be the value of the following flags?

  • Carry
  • Zero
  • Overflow
  • Sign
  • Even Parity
  • Half-Carry

b. Repeat for the addition of -$1$ (twos complement) and +$1$

can anyone please explain in b part overflow bit will be $1$ or $0$.

retagged by

1 Answer

Best answer
3 votes
3 votes

B) part of the question : 

-1 is represented as : 11111111  in 8-bit 2's complement notation..

+1 is represented as : 00000001 

Hence  -1 + 1 yields   :    11111111

                                +   00000001

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

                                 1    00000000

Here in the result '1' is shown separately to represent that it is Cout in the given operation and hence we say carry flag is set.But overflow flag is set when we have range exceeding condition satisfied in signed number system and 2's complement is a signed number system..

Also following points to be kept in mind :

a) In 2's complement notation , the range of numbers :  (-2n-1 to 2n-1 - 1)

b) Overflow situation is only possible if we have two operands of same sign.But here we have opposite signs , hence no question of overflow.

Hence overflow bit will be 0..It can be also viewed this way : 

Cout  = Cin to MSB is 0 here so overflow flag is found as XOR of these two which comes out to be 0 only..Hence overflow flag is not set.

selected by

Related questions

1 votes
1 votes
1 answer
3
arch asked Oct 12, 2017
575 views
What would be the bias value fora. A base-2 exponent in a 6-bit field?b. A base-8 exponent in a 7-bit field?
1 votes
1 votes
0 answers
4
arch asked Oct 12, 2017
179 views