Overflow: 2C | ||||||||||||||
V = ck-1 XOR ck-2 | Why does this work? | |||||||||||||
Case 1: 0 carried in, 1 carried out | ||||||||||||||
This occurs only when both xk-1 and yk-1 are 1, but then sk-1 is 0, | ||||||||||||||
so the result is non-negative even though both x and y are negative. | ||||||||||||||
Case 2: 1 carried in, 0 carried out | ||||||||||||||
This occurs only when both xk-1 and yk-1 are 0, but then sk-1 is 1, | ||||||||||||||
so the result is negative even though both x and y are non-negative. | ||||||||||||||
|
||||||||||||||
Adder with overflow detection | ||||||||||||||