Full Subtractor Operation
A Full Subtractor is a digital circuit that performs the subtraction of three binary bits: two significant bits and a borrow-in bit (from a previous subtraction). It is an extension of the Half Subtractor, which can only subtract two bits and does not handle a borrow-in input. The Full Subtractor takes into account the borrow from previous stages of subtraction and produces two outputs: the Difference (D) and the Borrow-out (B_out).
Inputs and Outputs of a Full Subtractor
-
Inputs:
- A: The minuend (the bit from which we subtract).
- B: The subtrahend (the bit that we subtract).
- Borrow-in (B_in): The borrow bit from a previous subtraction (if any).
-
Outputs:
- Difference (D): The result of the subtraction of A, B, and Borrow-in.
- Borrow-out (B_out): The borrow bit that indicates whether a borrow is needed when subtracting (i.e., if A - B - Borrow-in results in a negative number).
Truth Table of a Full Subtractor
The Full Subtractor performs binary subtraction based on the following truth table:
| A |
B |
Borrow-in (B_in) |
Difference (D) |
Borrow-out (B_out) |
| 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 |
0 |
Explanation of the Truth Table:
-
When A = 0, B = 0, and Borrow-in = 0:
The Difference (D) is 0, and there is no borrow, so Borrow-out = 0.
-
When A = 0, B = 0, and Borrow-in = 1:
The Difference (D) is 1, and there is a borrow, so Borrow-out = 1.
-
When A = 0, B = 1, and Borrow-in = 0:
The Difference (D) is 1, and there is a borrow, so Borrow-out = 1.
-
When A = 0, B = 1, and Borrow-in = 1:
The Difference (D) is 0, and there is a borrow, so Borrow-out = 1.
-
When A = 1, B = 0, and Borrow-in = 0:
The Difference (D) is 1, and there is no borrow, so Borrow-out = 0.
-
When A = 1, B = 0, and Borrow-in = 1:
The Difference (D) is 0, and there is no borrow, so Borrow-out = 0.
-
When A = 1, B = 1, and Borrow-in = 0:
The Difference (D) is 0, and there is no borrow, so Borrow-out = 0.
-
When A = 1, B = 1, and Borrow-in = 1:
The Difference (D) is 1, and there is no borrow, so Borrow-out = 0.
Boolean Equations for Difference and Borrow-out
The outputs of the Full Subtractor can be expressed using Boolean algebra as follows:
-
Difference (D):
- The Difference output is equivalent to the XOR of the three input bits A, B, and Borrow-in.
D=A⊕B⊕Bin
This equation shows that the difference is 1 when an odd number of the inputs (A, B, and B_in) are 1.
-
Borrow-out (B_out):
- The Borrow-out output is 1 if a borrow is required from previous stages. The borrow condition occurs when B and Borrow-in are 1, or when A is less than B (and possibly needs a borrow).
Bout=(A⋅B)+(A⋅Bin)+(B⋅Bin)
This equation indicates that a borrow occurs if:
- A = 0 and B = 1, or
- A = 0 and Borrow-in = 1, or
- B = 1 and Borrow-in = 1.
Logic Gate Implementation of Full Subtractor
The Full Subtractor can be implemented using a combination of XOR, AND, and OR gates:
-
Difference (D):
- First, XOR the inputs A and B:
Temp1=A⊕B
- Then, XOR Temp1 with Borrow-in to get the final Difference (D):
D=Temp1⊕Bin
-
Borrow-out (B_out):
- Use AND gates and OR gates to calculate the borrow:
- AND NOT A and B:
A⋅B
- AND NOT A and Borrow-in:
A⋅Bin
- AND B and Borrow-in:
B⋅Bin
- Finally, OR the results to produce Borrow-out:
Bout=(A⋅B)+(A⋅Bin)+(B⋅Bin)
Circuit Diagram:
- The XOR gates calculate the Difference.
- The AND gates and OR gates calculate the Borrow-out.
Full Subtractor Example
Let’s walk through an example to better understand how the Full Subtractor works.
Example 1:
- Inputs: A = 1, B = 0, Borrow-in = 1
- Difference (D):
D=A⊕B⊕Bin=1⊕0⊕1=0
- Borrow-out (B_out):
Bout=(A⋅B)+(A⋅Bin)+(B⋅Bin)=(0⋅0)+(0⋅1)+(0⋅1)=0
- Result: Difference = 0, Borrow-out = 0
Example 2:
- Inputs: A = 0, B = 1, Borrow-in = 1
- Difference (D):
D=A⊕B⊕Bin=0⊕1⊕1=0
- Borrow-out (B_out):
Bout=(A⋅B)+(A⋅Bin)+(B⋅Bin)=(1⋅1)+(1⋅1)+(1⋅1)=1
- Result: Difference = 0, Borrow-out = 1
Applications of Full Subtractor
-
Multi-bit Subtraction:
- Full subtractors are used in multi-bit binary subtractors. By chaining Full Subtractors together, subtraction of multi-bit numbers can be achieved, much like in addition circuits.
-
Arithmetic Logic Units (ALUs):
- Full Subtractors are part of ALUs in processors, where they perform subtraction operations in addition to other arithmetic and logic operations.
-
Digital Signal Processing:
- Full Subtractors are used in applications like signal comparison, error detection, and digital filters, where binary subtraction is necessary.
-
Counters and Digital Systems:
- Full Subtractors are useful in digital counters, data comparison systems, and systems requiring binary subtraction with carry/borrow handling.
Conclusion
The Full Subtractor is a crucial component in digital electronics that allows the subtraction of three binary digits: two significant bits and a borrow-in. It produces two outputs: the Difference and the Borrow-out. The Full Subtractor is used in multi-bit binary subtraction circuits, Arithmetic Logic Units (ALUs), and many other digital systems, where handling borrow conditions from previous operations is essential for accurate subtraction.