Subtractor Tables
   HOME

TheInfoList



OR:

In electronics, a subtractor – a
digital circuit In theoretical computer science, a circuit is a model of computation in which input values proceed through a sequence of gates, each of which computes a function. Circuits of this kind provide a generalization of Boolean circuits and a mathematical ...
that performs subtraction of numbers – can be designed using the same approach as that of an
adder Adder may refer to: * AA-12 Adder, a Russian air-to-air missile * Adder (electronics), an electronic circuit designed to do addition * Adder Technology, a manufacturing company * Armstrong Siddeley Adder, a late 1940s British turbojet engine * ''B ...
. 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_), subtrahend (Y_), and a borrow in from the previous (less significant) bit order position (B_). The outputs are the difference bit (D_) and borrow bit B_. 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_-Y_-B_ (which can take the values -2, -1, 0, or 1) as the sum -2B_+D_. : D_ = X_ \oplus Y_ \oplus B_ : B_ = X_ < (Y_ + B_) 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 = \bar + 1 (definition of two's complement notation) :\begin A-B & = A + (-B) \\ & = A + \bar + 1 \\ \end


Half subtractor

The half subtractor is a
combinational circuit In automata theory, combinational logic (also referred to as time-independent logic or combinatorial logic) is a type of digital logic which is implemented by Boolean circuits, where the output is a pure function of the present input only. This i ...
which is used to perform subtraction of two bits. It has two inputs, the minuend X and subtrahend Y and two outputs the difference D and borrow out B_\text. The borrow out signal is set when the subtractor needs to borrow from the next digit in a multi-digit subtraction. That is, B_ = 1 when X < Y. Since X and Y are bits, B_\text = 1 if and only if X = 0 and Y = 1. An important point worth mentioning is that the half subtractor diagram aside implements X - Y and not Y-X since B_\text on the diagram is given by :B_ = \overline \cdot Y. This is an important distinction to make since subtraction itself is not commutative, but the difference bit D is calculated using an XOR gate which is commutative. The truth table for the half subtractor is: Using the table above and a
Karnaugh map The Karnaugh map (KM or K-map) is a method of simplifying Boolean algebra expressions. Maurice Karnaugh introduced it in 1953 as a refinement of Edward W. Veitch's 1952 Veitch chart, which was a rediscovery of Allan Marquand's 1881 ''logic ...
, we find the following logic equations for D and B_\text: :D = X \oplus Y :B_\text = \overline X \cdot Y. 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

The full subtractor is a
combinational circuit In automata theory, combinational logic (also referred to as time-independent logic or combinatorial logic) is a type of digital logic which is implemented by Boolean circuits, where the output is a pure function of the present input only. This i ...
which is used to perform subtraction of three input bits: the minuend X, subtrahend Y, and borrow in B_\text. The full subtractor generates two output bits: the difference D and borrow out B_\text. B_\text is set when the previous digit is borrowed from X. Thus, B_\text is also subtracted from X as well as the subtrahend Y. Or in symbols: X - Y - B_\text. 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 and B_\text from X, a borrow out needs to be generated when X < Y + B_\text. 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_\text + 2B_\text. The truth table for the full subtractor is: Therefore the equation is: D=X\oplus Y\oplus B_ B_=\barB_+\barY+YB_


See also

*
Adder (electronics) An adder, or summer, is a digital circuit that performs addition of numbers. In many computers and other kinds of processors adders are used in the arithmetic logic units (ALUs). They are also used in other parts of the processor, where they are ...
*
Carry-lookahead adder A carry-lookahead adder (CLA) or fast adder is a type of electronics adder used in digital logic. A carry-lookahead adder improves speed by reducing the amount of time required to determine carry bits. It can be contrasted with the simpler, b ...
* Carry-save adder *
Adding machine An adding machine is a class of mechanical calculator, usually specialized for bookkeeping calculations. In the United States, the earliest adding machines were usually built to read in dollars and cents. Adding machines were ubiquitous of ...
* Adder-subtractor


References

* Foundations Of Digital Electronics by Elijah Mwangi


External links


N bit Binary addition or subtraction using single circuit.
Arithmetic logic circuits 4 Subtraction Binary arithmetic {{CPU technologies, state=collapsed