0
$\begingroup$

So, I understand how binary arithmetic works, and I understand how an adder-subtractor works for signed numbers. There is only one thing I am not sure about:

All the cases work ok in the circuit I have, except if the result of a subtraction is negative, I need to take the two's complement of the output byte to get the actual result. What can I do about it? Do I need an extra array of adders to compute the two's complement only in that specific way, or is there any smarter solution I can apply?

Thanks in advance.

$\endgroup$
2
  • $\begingroup$ It's hard to say without seeing your circuit diagram. $\endgroup$
    – Pseudonym
    Aug 13, 2020 at 23:55
  • $\begingroup$ (Back in the day, a "carry" input was used for the lowest significant bit, too: you get to choose the value.) $\endgroup$
    – greybeard
    Aug 14, 2020 at 3:19

1 Answer 1

1
$\begingroup$

(Can't leave a comment, unfortunately.)

I'm having the same issue. Here's the diagram (sorry, it's messy):

enter image description here

I've also found this on the web:

The algorithm to subtract two binary numbers using 2’s complement is explained as following below −

  • Take 2’s complement of the subtrahend
  • Add with minuend
  • If the result of above addition has carry bit 1, then it is dropped and this result will be positive number.
  • If there is no carry bit 1, then take 2’s complement of the result which will be negative
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.