Binary subtraction for unsigned numbers.

Binary numbers addition is straight forward, while binary subtractions involve three fundamental steps. Detailed discussions to understand when to discard carry and when to take 2s complement of final result is summarized in a table at end.

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))]

A solved example to explain binary subtraction is discussed next.

LTE - 4G Wireless Technology

Digital fundamentals.

Interview Questions.

Example 1 : Perform binary subtraction of two binary numbers M = 10101010 and N = 00111000

Convert 00111000 to 2's complement = +11001000

Now add these two numbers.  

  10101010 

+11001000 (NOTE: 2’s complement of -ve number)

Results in,

1 01110010

Discard end carry from the subtraction.

Answer. Binary subtraction of M and N = 01110010

Biggest challenge in binary subtraction is to determine, when to discard the final CARRY and when to take 2's complemtnet of final result. Lets discuss that in next section below.

Tutorials @fullchipdesign.com

Verilog Tutorial.

LTE Tutorial.

Memory Tutorial.

Table below illustrates all discard and 2’s complement options for final result.

Numbers A and B Carry discarded of final result 2’s complement of final result
A > B (A is positive, B is negative) YES NO
B > A (A is positive, B is negative) Not Generated YES
A, B are negative YES YES

Next, Access more binary subtraction examples on fullchipdesign.

OR access signed maginiute discussions for binary arithmetic. 

Hope you liked! this page. Don't forgot to access relevant previous and next sections with links below.