World's most popular travel blog for travel bloggers.

[Answers] 2's complement addition with ZF/Carry/Overflow

, , No Comments
Problem Detail: 

Consider addition of two numbers when CPU uses $2's$ complement form: $$ 1\ 1\ 0\ 0\ 0\ 0\ 1\ 1\\0\ 1\ 0\ 0\ 1\ 1\ 0\ 0\\-------\\0\ 0\ 0\ 0\ 1\ 1\ 1\ 1\\------- $$

$$Carry\ = 1,\ Overflow = 0, \ Zero Flag = 0$$

My Reasoning:

  • Zero Flag isn't set because the result isn't zero
  • Overflow isn't set because Carry in = Carry out

However, the answer says that Zero Flag is set $(ZF = 1)$, Am I going wrong ?


Note:

  • Got ZF/Carry/Overflow info from Here
Asked By : SimpleGuy

Answered By : Philippe Aubertin

However, the answer says that Zero Flag is set (ZF=1), Am I going wrong ?

No, you are correct. If the result is not zero, and in this case it is not, the zero flag is not set.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/35743

3.2K people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback