kooheyakhi
Newbie level 4
Consider 3_bit wide number system. Then range is between -4 to +3. We
are going to perform subtraction +3-(-4). We know that result is +7
that does not fit range. So something is wrong. We expect that
hardware will alarm there is mistake because of overflow. Hardware
uses XOR operation between carry to/from MSB. If XOR=1 there is
overflow. In my example hardware cannot detect overflow. Where is the
mistake?? +3 and -4 are true operands since they are in the range.
Hardware only gets 2's complement of subtrahend when operation is
subtraction and add it to the minuend. Finally XOR determines if there
is overflow or not! In Moris Manos's Computer Architecture book there
is a ripple adder that performs proper operation based on control
mode. When we need to do subtraction, Subtrahend passes through XOR
gates and a '1' bit enters LSB of ripple adder to realize 2's
complement. I think problem arises when hardware negates -4. because
its 2's complement yields again -4, not +4. In fact +4 is not in the
range. But hardware how can find that subtrahend is -4.
are going to perform subtraction +3-(-4). We know that result is +7
that does not fit range. So something is wrong. We expect that
hardware will alarm there is mistake because of overflow. Hardware
uses XOR operation between carry to/from MSB. If XOR=1 there is
overflow. In my example hardware cannot detect overflow. Where is the
mistake?? +3 and -4 are true operands since they are in the range.
Hardware only gets 2's complement of subtrahend when operation is
subtraction and add it to the minuend. Finally XOR determines if there
is overflow or not! In Moris Manos's Computer Architecture book there
is a ripple adder that performs proper operation based on control
mode. When we need to do subtraction, Subtrahend passes through XOR
gates and a '1' bit enters LSB of ripple adder to realize 2's
complement. I think problem arises when hardware negates -4. because
its 2's complement yields again -4, not +4. In fact +4 is not in the
range. But hardware how can find that subtrahend is -4.