SLIDE 11 Addition and Subtraction 11
Overflow Detection
Some additions and subtractions may produce results that cannot be
represented using the number of bits allocated for the result (i.e., precision).
For example, for an n-bit 2’s complement represented number, if the
result is greater than (2n-1-1) it can’t be represented using n-bits. There is an overflow.
How can overflow be detected?
If (carry into the MSB) ≠ (carry out of the MSB) then overflow has occurred.
Examples:
1011 (-4)
+ 1010 (-5) 10101 + 1 0110 (6) OVFL
for 1’s comp. numbers for 2’s comp. numbers 0100 (4)
+ 0101 (-5) 1001 (-7) OVFL
0100