Jump to content

Subtractor: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Fonebone (talk | contribs)
Deleted extraneous quotation marks.
Tags: Visual edit Mobile edit Mobile web edit
Line 53: Line 53:
|}
|}


From the above table one can draw the [[Karnaugh map]] for "difference" and "borrow""".
From the above table one can draw the [[Karnaugh map]] for "difference" and "borrow".


So, Logic equations are:
So, Logic equations are:

Revision as of 19:01, 26 September 2015

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 (), 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 .

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 negation)

Half subtractor

Logic diagram for a half subtractor

The half-subtractor is a combinational circuit which is used to perform subtraction of two bits. It has two inputs, X (minuend) and Y (subtrahend) and two outputs D (difference) and B (borrow).
An important point worth mentioning is that the half substractor diagram aside implements (b-a) and not (a-b) as borrow is calculated from equation


This important difference should be noticed.

Truth table

The truth table for the half subtractor is given below.[1]

X Y D B
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0

From the above table one can draw the Karnaugh map for "difference" and "borrow".

So, Logic equations are:

Full subtractor

Logic diagram of a Full Subtractor

The full-subtractor is a combinational circuit which is used to perform subtraction of three bits. It has three inputs, X (minuend) and Y(subtrahend) and Bi (borrow in) and two outputs D (difference) and Bo (borrow out).
D=X-Y-Bi (don't bother about sign)
Bo = 1 If X<(Y+Bi)

Truth table

The truth table for the full subtractor is given below.[1]

X Y Bi D Bo
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

So, Logic equations are:


 

References

  1. ^ a b "Subtraction using Logic gates".

See also