Skip to content
Home ยป Binary Adder/Subtractor

Binary Adder/Subtractor

๐Ÿง  Introduction

A Binary Adder/Subtractor is a combinational circuit that can perform both addition and subtraction of two binary numbers using the same hardware.

๐Ÿ‘‰ Instead of making two separate circuits (one adder and one subtractor), we design one smart circuit that can add or subtract based on a control input.


๐ŸŽฏ Purpose

  • To add two binary numbers OR
  • To subtract one binary number from another
    using a single circuit.

โš™๏ธ Working Principle

  • The circuit uses a Parallel Adder (multiple Full Adders).
  • It takes two binary numbers: A and B.
  • A control signal called Mode (M) decides the operation:
    • If M = 0 โ†’ Perform Addition (A + B)
    • If M = 1 โ†’ Perform Subtraction (A – B)

๐Ÿ‘‰ Subtraction is done by using 2’s Complement Method:

  • Take 1’s complement of B (invert all bits of B)
  • Add 1 to it (carry-in becomes 1)

Thus, subtraction becomes:

A - B = A + (1's complement of B) + 1

๐Ÿ› ๏ธ Circuit Structure

The circuit contains:

  • XOR gates to complement B when needed
  • Full Adders to perform the binary addition

๐Ÿ“ˆ Block Diagram

Each bit has the following connection:

B[i] --|XOR|--- B'[i] ---> Full Adder
|M|

A[i] ------------------> Full Adder
Cin ---- Carry In ---> Full Adder

Sum[i] ---> Output
Carry Out --> Next Full Adder
  • XOR gate decides whether to invert B[i] or not.
  • Cin = M (control bit):
    • M=0 โ†’ Add
    • M=1 โ†’ Subtract

๐Ÿ“‘ Truth Table

Mode (M)OperationAction on BCin
0A + B (Addition)Use B as it is0
1A – B (Subtraction)1’s complement of B1

๐Ÿงฉ Detailed Working

For Addition (M = 0):

  • B[i] XOR 0 = B[i] โ†’ B remains unchanged
  • Cin = 0
  • Operation: A + B

For Subtraction (M = 1):

  • B[i] XOR 1 = ยฌB[i] โ†’ B gets complemented (1’s complement)
  • Cin = 1
  • Operation: A + (1’s complement of B) + 1 (i.e., A – B)

๐Ÿ”ฅ Example: 4-bit Binary Adder/Subtractor

Suppose we have:

  • A = 0101 (5 in decimal)
  • B = 0011 (3 in decimal)

๐Ÿ‘‰ Addition (M=0):

  0101 (A)
+ 0011 (B)
---------
1000 (8)

๐Ÿ‘‰ Subtraction (M=1):

  • 1’s complement of B = 1100
  • Add Cin = 1
 0101 (A)
+ 1100 (ยฌB)
+ 1 (Cin)
---------
0010 (2)

Thus, 5 – 3 = 2 โœ…


๐Ÿง  Important Components

ComponentFunction
XOR GateComplements B bits based on Mode M
Full AdderPerforms addition of A, modified B, and Carry In
Control Signal (M)Decides Addition or Subtraction

๐ŸŒŸ Advantages of Binary Adder/Subtractor

  • Single circuit can perform two operations (saving hardware cost).
  • Fast โ€” just by changing Mode (M) signal.
  • Simple design โ€” only need XOR gates + Full Adders.

โšก Applications

  • Arithmetic Logic Units (ALUs) inside CPUs
  • Digital calculators
  • Microprocessors and Microcontrollers
  • Digital systems that require fast arithmetic operations

๐ŸŽฏ Summary

FeatureBinary Adder/Subtractor
OperationsAddition or Subtraction
Controlled byMode (M)
HardwareXOR Gates + Full Adders
Addition MethodDirect addition
Subtraction Method2’s complement (invert B + add 1)
Major UseIn ALUs, CPUs, Digital Devices

โœ๏ธ Pro Tip for Exams

  • Always draw the Block Diagram with XOR gates and Full Adders.
  • Explain the working separately for M=0 and M=1 cases.
  • Use simple examples like 4-bit addition/subtraction to show clarity.