Subtractor Tables
   HOME

TheInfoList



OR:

In
electronics Electronics is a scientific and engineering discipline that studies and applies the principles of physics to design, create, and operate devices that manipulate electrons and other Electric charge, electrically charged particles. It is a subfield ...
, a subtractor is 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 mathematica ...
that performs subtraction of numbers, and it can be designed using the same approach as that of an adder. The
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two values (0 and 1) for each digit * Binary function, a function that takes two arguments * Binary operation, a mathematical op ...
subtraction process is summarized below. As with an adder, in the general case of calculations on multi-bit numbers, three
bit The bit is the most basic unit of information in computing and digital communication. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented as ...
s are involved in performing the subtraction for each bit of the
difference Difference commonly refers to: * Difference (philosophy), the set of properties by which items are distinguished * Difference (mathematics), the result of a subtraction Difference, The Difference, Differences or Differently may also refer to: Mu ...
: the
minuend Subtraction (which is signified by the minus sign, –) is one of the four arithmetic operations along with addition, multiplication and division. Subtraction is an operation that represents removal of objects from a collection. For example, ...
(X_),
subtrahend Subtraction (which is signified by the minus sign, –) is one of the four arithmetic operations along with addition, multiplication and division. Subtraction is an operation that represents removal of objects from a collection. For example, ...
(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_), where ⊕ represents
exclusive or Exclusive or, exclusive disjunction, exclusive alternation, logical non-equivalence, or logical inequality is a logical operator whose negation is the logical biconditional. With two inputs, XOR is true if and only if the inputs differ (on ...
. Subtractors are usually implemented within a binary adder for only a small cost when using the standard
two's complement Two's complement is the most common method of representing signed (positive, negative, and zero) integers on computers, and more generally, fixed point binary values. Two's complement uses the binary digit with the ''greatest'' value as the ''s ...
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 subtractors can be designed through the combinational Boolean logic circuits /sup> as shown in Figure 1 and 2. The half subtractor is a
combinational circuit In automata theory, combinational logic (also referred to as time-independent logic) is a type of digital logic that is implemented by Boolean circuits, where the output is a pure function of the present input only. This is in contrast to seque ...
which is used to perform subtraction of two bits. It has two inputs, the
minuend Subtraction (which is signified by the minus sign, –) is one of the four arithmetic operations along with addition, multiplication and division. Subtraction is an operation that represents removal of objects from a collection. For example, ...
X and
subtrahend Subtraction (which is signified by the minus sign, –) is one of the four arithmetic operations along with addition, multiplication and division. Subtraction is an operation that represents removal of objects from a collection. For example, ...
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 In mathematics, a binary operation is commutative if changing the order of the operands does not change the result. It is a fundamental property of many binary operations, and many mathematical proofs depend on it. Perhaps most familiar as a pr ...
, but the difference bit D is calculated using an
XOR gate XOR gate (sometimes EOR, or EXOR and pronounced as Exclusive OR) is a digital logic gate that gives a true (1 or HIGH) output when the number of true inputs is odd. An XOR gate implements an exclusive disjunction, exclusive or (\nleftrightarrow) ...
which is commutative. The
truth table A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, Boolean functions, and propositional calculus—which sets out the functional values of logical expressions on each of their functional arg ...
for the half subtractor is: Using the table above and a
Karnaugh map A Karnaugh map (KM or K-map) is a diagram that can be used to simplify a Boolean algebra expression. Maurice Karnaugh introduced the technique in 1953 as a refinement of Edward W. Veitch's 1952 Veitch chart, which itself was a rediscovery of ...
, 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) is a type of digital logic that is implemented by Boolean circuits, where the output is a pure function of the present input only. This is in contrast to seque ...
which is used to perform subtraction of three input
bit The bit is the most basic unit of information in computing and digital communication. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented as ...
s: 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 microprocessor, processors, adders are used in the arithmetic logic units (ALUs). They are also used in other parts of the processor, ...
*
Carry-lookahead adder A carry-lookahead adder (CLA) or fast adder is a type of Adder (electronics), 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 w ...
*
Carry-save adder A carry-save adder is a type of digital adder, used to efficiently compute the sum of three or more binary numbers. It differs from other digital adders in that it outputs two (or more) numbers, and the answer of the original summation can be ach ...
*
Adding machine An adding machine is a class of mechanical calculator, usually specialized for bookkeeping calculations. Consequently, the earliest adding machines were often designed to read in particular currencies. Adding machines were ubiquitous office ...
* Adder-subtractor


References

# Foundations Of Digital Electronics by Elijah Mwangi # 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



Digital circuits Arithmetic logic circuits 4 Subtraction Binary arithmetic {{CPU technologies, state=collapsed