Explain please What are the overflow and carry flags in the
Explain please.
What are the overflow and carry flags in the following operations in a four-bit system? Solution
As, In binary addition:
1+0=1
0+0=0
0+1=1
1+1=0 carry 1
For 4 bit addition, if answer is greater than 4 bit then it is the case of overflow.
In binary subtraction,
1-0=1
0-0=0
1-1=0
0-1=0 borrow 1
For 4 bit, if result is less than 4 then this is the case of overflow.
| Carry | Overflow | |
| 1100 + 1010 | 1 | 1 |
| 1101 - 1100 | 0 | 0 |
| 1100 + 1010 | 1 | 1 |
| 0100 - 0110 | borrow 1 | underflow 1 |
| 0100 + 0010 | 0 | 0 |
| 0100 + 0110 | 1 | 0 |
| 1100 - 0110 | borrow 1 | 0 |
