0

I know how to represent a number K for example when K = A - B in a curcuit, it's pretty straight forward. complement all signals from B and trun the carry signal into 1. Just like the picture below.

enter image description here

My question is if I want to rerpesent K = -A -B + 1 in a curcuit. If I complement all signals of A and B I still have to add 1 + 1 + 1, the first 1 is for completion of A's complement 2, the second one is for completion of B's complement 2, and the last 1 is simply from the equation K = -A -B +1. How do I make that happen with using the same FA?

William
  • 1
  • 1
  • Use a full adder instead of a half adder. – Miss Mulan Mar 17 '21 at 03:03
  • @MissMulan The OP is using FA at each stage, already. – jonk Mar 17 '21 at 03:07
  • What you have to understand is, 2's compliment, 1's compliment are just representations/interpretations of a binary number. You don't have to change ANYTHING in FA for that. You just have to interpret the inputs and results in the way/format you want. – Mitu Raj Mar 17 '21 at 05:05
  • Just complement A too before adding it. Or, regrouping, add A and B and do a sign inversion – Lorenzo Marcantonio Mar 17 '21 at 07:26
  • @LorenzoMarcantonio No, just complementing A is not enough. The complement is not the same as negating a value. – Elliot Alderson Mar 17 '21 at 11:44
  • Sorry not clear by my part, I used the wrong word. We are used to complementing for negation and inverting for the logical NOT – Lorenzo Marcantonio Mar 17 '21 at 14:40
  • @jonk you are correct – Miss Mulan Mar 17 '21 at 17:03
  • @LorenzoMarcantonio When reading "complement and increment" I usually infer several things: binary notation and almost certainly two's complement notation for signed values, as well, and that negation is meant. But if I read "complement" only, then I usually infer binary notation and "logical NOT" (or "invert") but I do not necessarily expect two's complement notation or signed values; and negation only comes to mind if the writer specifically discusses one's complement notation. That said, William's "problem" remains. – jonk Mar 17 '21 at 18:23

0 Answers0