๐ง 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) | Operation | Action on B | Cin |
|---|---|---|---|
| 0 | A + B (Addition) | Use B as it is | 0 |
| 1 | A – B (Subtraction) | 1’s complement of B | 1 |
๐งฉ 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
| Component | Function |
|---|---|
| XOR Gate | Complements B bits based on Mode M |
| Full Adder | Performs 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
| Feature | Binary Adder/Subtractor |
|---|---|
| Operations | Addition or Subtraction |
| Controlled by | Mode (M) |
| Hardware | XOR Gates + Full Adders |
| Addition Method | Direct addition |
| Subtraction Method | 2’s complement (invert B + add 1) |
| Major Use | In 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.
