⚙️

4-Bit Two's Complement Adder-Subtractor Overview

May 8, 2025

Lecture Notes on 4-Bit Two's Complement Adder-Subtractor

Overview

  • The focus of this lecture is on constructing a 4-bit two's complement adder-subtractor.
  • It also covers how overflow is detected in this context.

Two's Complement Basics

  • Two's Complement is a method for representing signed numbers in binary form.
  • Signed Numbers: Numbers can be positive or negative, represented by binary digits (bits).
  • 4-bit Representation: Limits the range of numbers that can be represented.
    • Range: -8 to +7

Construction of 4-bit Adder-Subtractor

  • Components Required:
    • Full Adders: Used for performing bitwise addition.
    • XOR Gates: Used to toggle between addition and subtraction.
    • Control Signal: Dictates whether the operation is an addition or subtraction.

Diagram Overview

  • The diagram typically consists of:
    • 4 full adders connected in series.
    • XOR gates connected to the input of each full adder for the B inputs.
    • A control signal determines if each XOR gate will invert its input (to switch between addition and subtraction).

Operation Details

  • Addition: Direct addition of A and B without inversion of B.
  • Subtraction: Inversion of B via XOR gates, then added to A along with a carry-in of 1 to the least significant bit.

Overflow Detection

  • Overflow Condition: Arises when the result of an operation exceeds the range of representation.
  • Detection Method:
    • Check the carry into the most significant bit (MSB) and the carry out of the MSB.
    • Overflow has occurred if these two carries are different (one is 1, the other is 0).

Practical Applications

  • Used in ALUs (Arithmetic Logic Units) within CPUs for arithmetic operations.
  • Essential for supporting signed arithmetic operations in digital circuits.

Summary

  • The 4-bit two's complement adder-subtractor is a fundamental component in digital electronics.
  • Understanding its construction and operation, including overflow detection, is crucial for designing effective computational systems.