The Gateway to Computer Science Excellence
+6 votes
3.8k views

Two eight bit bytes $1100  0011$ and $0100  1100$ are added. What are the values of the overflow, carry and zero flags respectively, if the arithmetic unit of the CPU uses $2$'s complement form?

  1. $0, 1, 1'$
  2. $1, 1, 0$
  3. $1, 0, 1$
  4. $0, 1, 0$
in Digital Logic by Boss (30.8k points) | 3.8k views
0
Zero flag is set to 1(True), if result is 0.

Zero flag is set to 0(False), if result is non-zero.

5 Answers

+13 votes
Best answer

I think it is D 

11000011

01001100

= (1)  00001111 with Carry =1 (specified in bracket )

The zero flag will be set if result is 0 . but here the result is not 0 so zero flag is set to 0 

For overflow  we have condition of C = Carryout Exor Carry In 

where Carry out  is carry from MSB (bit 8 )   // taking byte as from bit1 to bit 8 

Carry in carry from bit 7 

So carry out = 1

carry in 1 

so exor of both of them is 0 --- which will be carry flag 

So option d 

carry flag - 1sum -- 0  overflow is 0 

by Loyal (9.9k points)
selected by
+1

What is the use of this line? 

if the arithmetic unit of the CPU uses 2's complement form.

0

@bhuv   from this we can conclude that first number is negative and second no is positive . now addition of these can not overflow (try to understand the reason )

so we can directly say that overflow flag is 0

0

@Gurdeep Saini It is given that condition for overflow is Cout exor Cin = 1. But if Cin=1 and Cout=0 then how can we say overflow is there? Please explain this I am having serious doubt in this concept

+3 votes

Cout = 1 Carry)

Cin = 1

         A

1

1

0

0

0

0

1

1

         B

0

1

0

0

1

1

0

0

      Result

0 (Sign Flag)

0

1

0

1

1

1

1

Carry Flag = 1

Overflow Flag = Cin XOR Cout = 1 XOR 1 = 0

Sign Flag = 0

by (249 points)
+2 votes

 1   1

      11000011

      01001100

 1   00001111     

 

zero flag=0 (final answer is non zero)

overflow flag=0(since both in carry out carry =1 and it is addition of -ve and +ve number so overflow should be equals to 0) 

carry flag=1(extra bit out of msb)

by Boss (16.5k points)
0 votes

   11000011

   01001100


1  00001111

so finally we have result as 00001111


now herre discard the carry in red digit becoz we are using two's complement method therefore  we have 

zero flag=0 

overflow flag=1

carry flag=0

by Boss (20.1k points)
0
there is no such option. and overflow should be reset(0) as both input and output carry is 1.
0 votes

As per the key provided by ISRO -2013

Answer is A

by Active (3.9k points)
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,737 questions
57,384 answers
198,542 comments
105,343 users