Binary Subtraction:Suppose, M is Minuend and N is subtrahend, Then, M – N can be
done based on following three steps:
Step 1: Take 2’s complement of N and add it to M.
M – N = M + (2^n – N)
Step 2: If M is greater than or equal to N then end carry is discarded from the result.
M –N = M + (2^n – N) – 2^n
Step 3:If M is less than N then take 2’s complement of the result and append negative
‘-‘ sign in front.
M-N = (-) [2^n – (M + (2^n -1))]
Two solved examples are shown below.
Example 1 : Perform binary subtraction of two binary numbers M = 10101010 and N =
Example 2 : Perform binary subtraction of two binary numbers N = 10101010 and M =
Discard end carry from the subtraction
Answer. Binary subtraction of M and N = 01110010
- 00111000 +11001000
- 10101010 + 01010110
Result = 10001110
No end carry in result
2’s complement of result = 01110010
Answer. Binary subtraction of M and N = - (2’s complement of result) = -01110010
Binary addition or subtraction can be implemented using a single circuit as discussed below. With this implementation any length (no of bits = N) of binary numbers can be used to calculate the results by using N number of full-adders and N number of XOR gates. Circuit is very similar to the binary adder circuitdiscussed earlier except for a XOR gate at second input of full-adders.
Switch Mode (SM)
Discussion of Adder-subtractor circuit above: Switch Mode (SM) is a control input to the circuit to switch between addition or subtraction operations. Adder When SM = 0 the circuit is equivalent to Binary Adder. B (bit ) XOR 0 = B (bit) Subtractor When SM = 1 the circuit is equivalent to Binary subtractor. B (bit ) XOR 1 = invert(B (bit)) ‘B’ input become’s and inverted in this case. Examples Refer following sections @ fullchipdesign for examples:- Binary adder example. Subtraction examples -Unsigned numbers. Subtraction examples -Signed numbers.