Subtracting

In electronics, a subtractor can be designed using the same approach as that of an adder. The binary subtraction process is summarized below. As with an adder, in the general case of calculations on multi-bit numbers, three bits are involved in performing the subtraction for each bit of the difference: the minuend (




X

i




{\displaystyle X_{i}}
), subtrahend (




Y

i




{\displaystyle Y_{i}}
), and a borrow in from the previous (less significant) bit order position (




B

i




{\displaystyle B_{i}}
). The outputs are the difference bit (




D

i




{\displaystyle D_{i}}
) and borrow bit




B

i
+
1




{\displaystyle B_{i+1}}
. The subtractor is best understood by considering that the subtrahend and both borrow bits have negative weights, whereas the X and D bits are positive. The operation performed by the subtractor is to rewrite




X

i




Y

i




B

i




{\displaystyle X_{i}-Y_{i}-B_{i}}
(which can take the values -2, -1, 0, or 1) as the sum




2

B

i
+
1


+

D

i




{\displaystyle -2B_{i+1}+D_{i}}
.





D

i


=

X






Y

i




B

i




{\displaystyle D_{i}=X_{}\oplus Y_{i}\oplus B_{i}}






B

i
+
1


=

X

i


<
(

Y

i


+

B

i


)


{\displaystyle B_{i+1}=X_{i}<(Y_{i}+B_{i})}
Subtractors are usually implemented within a binary adder for only a small cost when using the standard two's complement notation, by providing an addition/subtraction selector to the carry-in and to invert the second operand.





B
=



B
¯



+
1


{\displaystyle -B={\bar {B}}+1}
(definition of two's complement notation)







A

B



=
A
+
(

B
)






=
A
+



B
¯



+
1






{\displaystyle {\begin{alignedat}{2}A-B&=A+(-B)\\&=A+{\bar {B}}+1\\\end{alignedat}}}

View More On Wikipedia.org
  • 63

    Greg Bernhardt

    A PF Singularity From USA
    • Messages
      19,447
    • Media
      227
    • Reaction score
      10,037
    • Points
      1,237
  • 1

    YoungPhysicist

    A PF Cell 19 From Taipei,Taiwan,ROC
    • Messages
      350
    • Media
      33
    • Reaction score
      203
    • Points
      142
  • 1

    Rubies

    A PF Quark
    • Messages
      13
    • Reaction score
      0
    • Points
      1
  • 1

    Balsam

    A PF Quark
    • Messages
      226
    • Reaction score
      8
    • Points
      6
  • 1

    adjacent

    Emperor 25 From Maldives
    • Messages
      1,552
    • Reaction score
      63
    • Points
      121
  • Back
    Top