In: Electrical Engineering
Binary Subtraction can take many forms but the rules for subtraction are the same whichever process you use. As binary notation only has two digits, subtracting a “0” from a “0” or a “1” leaves the result unchanged as 0-0 = 0 and 1-0 = 1. Subtracting a “1” from a “1” results in a “0”, but subtracting a “1” from a “0” requires a borrow. In other words 0 – 1requires a borrow.
0 | 1 | 1 | (borrow)1→ 0 |
– 0 | – 0 | – 1 | – 1 |
0 | 1 | 0 | 1 |
For the simple 1-bit subtraction problem above, if the borrow bit is ignored the result of their binary subtraction resembles that of an Exclusive-OR Gate. To prevent any confusion in this tutorial between a binary subtractor input labelled, B and the resulting borrow bit output from the binary subtractor also being labelled, B, we will label the two input bits as X for the minuend and Y for the subtrahend. Then the resulting truth table is the difference between the two input bits of a single binary subtractor is given as:
Symbol | Truth Table | ||
2-input Ex-OR Gate |
Y | X | Q |
0 | 0 | 0 | |
0 | 1 | 1 | |
1 | 0 | 1 | |
1 | 1 | 0 |
An n-bit Binary Subtractor
As with the binary adder, we can also have n number of 1-bit full binary subtractor connected or “cascaded” together to subtract two parallel n-bit numbers from each other. For example two 4-bit binary numbers. We said before that the only difference between a full adder and a full subtractor was the inversion of one of the inputs.
So by using an n-bit adder and n number of inverters (NOT Gates), the process of subtraction becomes an addition as we can use two’s complement notation on all the bits in the subtrahend and setting the carry input of the least significant bit to a logic “1” (HIGH).
for 8 bit subtractor n will be 8 and the circuit diagram will look like this