fbpx
Wikipedia

Subtractor

In electronics, a subtractor – a digital circuit that performs subtraction of numbers – 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 (), subtrahend (), and a borrow in from the previous (less significant) bit order position (). The outputs are the difference bit () and borrow bit . 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 (which can take the values -2, -1, 0, or 1) as the sum .

,

where ⊕ represents exclusive or.

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.

(definition of two's complement notation)

Half subtractor edit

 
Figure 1 :Logic diagram for a half subtractor

The half subtractors can be designed through the combinational Boolean logic circuits [2] as shown in Figure 1 and 2.The half subtractor is a combinational circuit which is used to perform subtraction of two bits. It has two inputs, the minuend   and subtrahend   and two outputs the difference   and borrow out  . The borrow out signal is set when the subtractor needs to borrow from the next digit in a multi-digit subtraction. That is,   when  . Since   and   are bits,   if and only if   and  . An important point worth mentioning is that the half subtractor diagram aside implements   and not   since   on the diagram is given by

 .

This is an important distinction to make since subtraction itself is not commutative, but the difference bit   is calculated using an XOR gate which is commutative.

 
Figure 2: Half-subtractor using NAND gate only.

The truth table for the half subtractor is:

Inputs Outputs
X Y D Bout
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0

Using the table above and a Karnaugh map, we find the following logic equations for   and  :

 
 .

Consequently, a simplified half-subtract circuit, advantageously avoiding crossed traces in particular as well as a negate gate is:

 X ── XOR ─┬─────── |X-Y|, is 0 if X equals Y, 1 otherwise ┌──┘ └──┐ Y ─┴─────── AND ── borrow, is 1 if Y > X, 0 otherwise 

where lines to the right are outputs and others (from the top, bottom or left) are inputs.

Full subtractor edit

The full subtractor is a combinational circuit which is used to perform subtraction of three input bits: the minuend  , subtrahend  , and borrow in  . The full subtractor generates two output bits: the difference   and borrow out  .   is set when the previous digit is borrowed from  . Thus,   is also subtracted from   as well as the subtrahend  . Or in symbols:  . Like the half subtractor, the full subtractor generates a borrow out when it needs to borrow from the next digit. Since we are subtracting   and   from  , a borrow out needs to be generated when  . When a borrow out is generated, 2 is added in the current digit. (This is similar to the subtraction algorithm in decimal. Instead of adding 2, we add 10 when we borrow.) Therefore,  .

 

The truth table for the full subtractor is:

Inputs Outputs
X Y Bin D Bout
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1

Therefore the equation is:

 

 

See also edit

References edit

  1. Foundations Of Digital Electronics by Elijah Mwangi
  2. Beltran, A.A., Nones, K., Salanguit, R.L., Santos, J.B., Santos, J.M., & Dizon, K.J. (2021). Low Power NAND Gate–based Half and Full Adder / Subtractor Using CMOS Technique.

External links edit

  • N bit Binary addition or subtraction using single circuit.

subtractor, this, article, needs, additional, citations, verification, please, help, improve, this, article, adding, citations, reliable, sources, unsourced, material, challenged, removed, find, sources, news, newspapers, books, scholar, jstor, december, 2009,. This article needs additional citations for verification Please help improve this article by adding citations to reliable sources Unsourced material may be challenged and removed Find sources Subtractor news newspapers books scholar JSTOR December 2009 Learn how and when to remove this template message In electronics a subtractor a digital circuit that performs subtraction of numbers 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 lt Y i B i displaystyle B i 1 X i lt Y i B i where represents exclusive or 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 amp A B amp A bar B 1 end alignedat Contents 1 Half subtractor 2 Full subtractor 3 See also 4 References 5 External linksHalf subtractor edit nbsp Figure 1 Logic diagram for a half subtractorThe half subtractors can be designed through the combinational Boolean logic circuits 2 as shown in Figure 1 and 2 The half subtractor is a combinational circuit which is used to perform subtraction of two bits It has two inputs the minuend X displaystyle X nbsp and subtrahend Y displaystyle Y nbsp and two outputs the difference D displaystyle D nbsp and borrow out B out displaystyle B text out nbsp The borrow out signal is set when the subtractor needs to borrow from the next digit in a multi digit subtraction That is B out 1 displaystyle B text out 1 nbsp when X lt Y displaystyle X lt Y nbsp Since X displaystyle X nbsp and Y displaystyle Y nbsp are bits B out 1 displaystyle B text out 1 nbsp if and only if X 0 displaystyle X 0 nbsp and Y 1 displaystyle Y 1 nbsp An important point worth mentioning is that the half subtractor diagram aside implements X Y displaystyle X Y nbsp and not Y X displaystyle Y X nbsp since B out displaystyle B text out nbsp on the diagram is given by B out X Y displaystyle B text out overline X cdot Y nbsp This is an important distinction to make since subtraction itself is not commutative but the difference bit D displaystyle D nbsp is calculated using an XOR gate which is commutative nbsp Figure 2 Half subtractor using NAND gate only The truth table for the half subtractor is Inputs OutputsX Y D Bout0 0 0 00 1 1 11 0 1 01 1 0 0Using the table above and a Karnaugh map we find the following logic equations for D displaystyle D nbsp and B out displaystyle B text out nbsp D X Y displaystyle D X oplus Y nbsp B out X Y displaystyle B text out overline X cdot Y nbsp Consequently a simplified half subtract circuit advantageously avoiding crossed traces in particular as well as a negate gate is X XOR X Y is 0 if X equals Y 1 otherwise Y AND borrow is 1 if Y gt X 0 otherwise where lines to the right are outputs and others from the top bottom or left are inputs Full subtractor editThe full subtractor is a combinational circuit which is used to perform subtraction of three input bits the minuend X displaystyle X nbsp subtrahend Y displaystyle Y nbsp and borrow in B in displaystyle B text in nbsp The full subtractor generates two output bits the difference D displaystyle D nbsp and borrow out B out displaystyle B text out nbsp B in displaystyle B text in nbsp is set when the previous digit is borrowed from X displaystyle X nbsp Thus B in displaystyle B text in nbsp is also subtracted from X displaystyle X nbsp as well as the subtrahend Y displaystyle Y nbsp Or in symbols X Y B in displaystyle X Y B text in nbsp Like the half subtractor the full subtractor generates a borrow out when it needs to borrow from the next digit Since we are subtracting Y displaystyle Y nbsp and B in displaystyle B text in nbsp from X displaystyle X nbsp a borrow out needs to be generated when X lt Y B in displaystyle X lt Y B text in nbsp When a borrow out is generated 2 is added in the current digit This is similar to the subtraction algorithm in decimal Instead of adding 2 we add 10 when we borrow Therefore D X Y B in 2 B out displaystyle D X Y B text in 2B text out nbsp nbsp The truth table for the full subtractor is Inputs OutputsX Y Bin D Bout0 0 0 0 00 0 1 1 10 1 0 1 10 1 1 0 11 0 0 1 01 0 1 0 01 1 0 0 01 1 1 1 1Therefore the equation is D X Y B i n displaystyle D X oplus Y oplus B in nbsp B o u t X B i n X Y Y B i n displaystyle B out bar X B in bar X Y YB in nbsp See also editAdder electronics Carry lookahead adder Carry save adder Adding machine Adder subtractorReferences editFoundations Of Digital Electronics by Elijah Mwangi Beltran A A Nones K Salanguit R L Santos J B Santos J M amp Dizon K J 2021 Low Power NAND Gate based Half and Full Adder Subtractor Using CMOS Technique External links editN bit Binary addition or subtraction using single circuit Retrieved from https en wikipedia org w index php title Subtractor amp oldid 1179679317 Half subtractor, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.