This is an image of a binary subtractor for unsigned numbers. Some times the output of binary subtraction is not correct and needs to be complemented to give the correct answer, how can I find out when those times are?
closed as off-topic by Marcus Müller, evildemonic, Voltage Spike, Finbarr, Dave Tweed♦ May 21 at 18:06
- This question does not appear to be about electronics design within the scope defined in the help center.
In general, you observe the carry into the most-significant bit and the carry out of the most-significant bit. If you try a few values you will observe a pattern in those two values when the result of the subtraction is incorrect.
If you don't have access to the carries then you will need to brute-force compare the magnitudes of the numbers. When computing \$A-B\$ the result will be incorrect if \$B > A\$