Hi,
Please tell us what is wrong. Tell us the result and tell us carry.
We expect that hardware will alarm there is mistake because of overflow.
Show us your hardware, schematic, code, or whatever you have.
Hardware only gets 2's complement of subtrahend when operation is
subtraction and add it to the minuend.
Did you do the calculation step by step on your own? With a pencil and paper?
What is the result of "2's complement of subtrahend"?
What is the result of the "add"?
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.
I agree. Thus will be the problem.
But who is the designer if the hardware? He should tell you how to handle it...and where the limitations of the adders are.
If you are the designer you have a couple of options:
* do true subtraction (not 2's complement and the add)
* don't allow the subtrahend to be '-4'
* use 4 bits arithmetics (3 bits plus sign)
* correct your hardware to care for "2's complement overflow"
* or find another solution..
Klaus