Fact-checked by Grok 2 weeks ago

Adder–subtractor

An adder–subtractor is a combinational digital circuit that performs both binary addition and of two multi-bit unsigned or signed numbers using a shared set of full adders controlled by a single mode input signal. This design leverages the principle that can be achieved by adding the of the subtrahend, allowing efficient implementation without separate and subtractor . The core structure of an adder–subtractor consists of n full adders for n-bit operands, where each full adder's B input is passed through an with the signal M. When M = 0 (addition ), the XOR gates pass the B bits unchanged, the initial carry-in C0 is set to 0, and the circuit computes the A + B, producing bits and an carry-out. In (M = 1), the XOR gates invert the B bits to form B', C0 is set to 1, and the circuit adds A + (B' + 1), which equals A – B in arithmetic. For unsigned numbers, the result is A – B if A ≥ B; otherwise, it yields the of (B – A), requiring a separate for . Adder–subtractors form a key component of arithmetic logic units (ALUs) in microprocessors and are implemented in various forms, such as ripple-carry for simplicity or parallel-prefix (e.g., carry-lookahead) for reduced propagation delay in high-speed applications. They support in , handling both positive and negative values without overflow in properly ranged operations.

Fundamentals

Binary Arithmetic Operations

Binary addition is performed bit by bit, starting from the least significant bit (LSB), similar to addition but using base-2 arithmetic where digits are only or . When adding two bits, if both are , the sum is with no carry; if one is and the other , the sum is with no carry; if both are , the sum bit is and a carry of is generated to the next higher bit position. This carry may propagate through subsequent bits, potentially causing a chain reaction if multiple consecutive bits sum to 2 (i.e., + with incoming carry). For multi-bit numbers, the process repeats across all positions, with the final carry out indicating if the result exceeds the bit width. Consider the example of adding the 3-bit numbers 101 ( 5) and 011 ( 3). Starting from the LSB: + = with carry ; next, + + carry = with carry ; then, + + carry = with carry out, resulting in 1000 ( 8). This illustrates carry generation at the LSB and through the higher bits. Key concepts in include the bit, which represents the result 2 at each position, and the carry signal, a ( or ) value indicating whether a 2 was exceeded, passed to the next bit. These operate in standard 0/ logic, where denotes false/low and true/high. For a single-bit (half adder), the is as follows:
ABSum (A ⊕ B)Carry (A ∧ B)
0000
0110
1010
1101
This table defines the basic logic for sum and carry generation without an incoming carry. Binary subtraction also proceeds bit by bit from the LSB, subtracting the subtrahend from the minuend, but requires borrowing when the minuend bit is smaller than the subtrahend bit. Borrowing adds 2 (binary 10) to the current minuend bit (effectively subtracting 1 from the next higher bit) and sets a borrow signal of 1 to be repaid in the next position. This method can lead to challenges like borrow propagation across multiple bits, increasing the time for the operation in hardware implementations. Unlike addition, direct subtraction hardware must handle negative differences at each bit, often making it less efficient without complementary techniques. For example, subtracting 011 (decimal 3) from 101 (decimal 5): LSB 1 - 1 = 0, no borrow; next, 0 - 1 requires borrow (0 becomes 10 or 2 , minus 1 = 1, and borrow 1 from higher bit); highest bit 1 - 0 - borrow 1 = 0, resulting in 010 ( 2). This shows borrow initiation and limited propagation. In subtraction, the difference bit is the result modulo 2 after borrowing, and the borrow signal (0 or 1) indicates if a borrow was needed for the next bit. These follow 0/1 logic. The for single-bit subtraction (half subtractor) is:
ABDifference (A ⊕ B)Borrow (¬A ∧ B)
0000
0111
1010
1100
This defines the logic without an incoming borrow.

Complement Methods for Subtraction

Complement methods for subtraction transform the operation into an by representing the subtrahend's , allowing the reuse of existing circuitry in systems. These techniques are fundamental in arithmetic, where direct is avoided to simplify hardware design. The two primary approaches are one's complement and , each handling negative values differently during the addition process. One's complement negation is achieved by inverting all bits of the subtrahend through a bitwise NOT operation, effectively representing the negative value. To perform subtraction of B from A (A - B), the one's complement of B is added to A using standard binary addition, including an end-around carry where the overflow bit is added back to the least significant bit if present. This method ensures the result accounts for the but introduces complexity due to the need for carry adjustment. For example, in a 3-bit , subtracting 011 (3) from 101 (5): the one's complement of 011 is 100 (-3), adding 101 + 100 yields 1001, and applying the end-around carry (adding the overflow 1 to the result) gives 010 (2). Two's complement, the more widely adopted method, negates the subtrahend by first taking its one's complement and then adding , given by the formula \tilde{B} + 1, where \tilde{B} denotes the bitwise NOT of . Subtraction proceeds by adding this two's complement value to A, with any carry simply discarded, eliminating the need for end-around carry and simplifying detection. In the same 3-bit example, the two's complement of 011 is 100 (one's complement) + = 101 (-3), and 101 + 101 yields 1010, discarding the carry to obtain 010 (2) directly. This approach is preferred in modern digital circuits for its efficiency and uniform treatment of and . The primary advantages of complement methods lie in hardware simplification: they enable a single to handle both and by conditionally generating the complement of the subtrahend, reducing overall gate count, power consumption, and design complexity compared to dedicated subtractor logic. This unification supports versatile logic units (ALUs) capable of fast operations without separate pathways for . Early computer designs, such as those from the mid-20th century, explicitly leveraged for this purpose to achieve high-speed with minimal additional .

Circuit Design

Basic Building Blocks

The half is a fundamental designed to perform of two single-bit inputs, denoted as A and B, producing a output S and a carry output C. The is generated using an exclusive-OR (XOR) gate, where S = A \oplus B, while the carry is produced by an AND gate, C = A \cdot B. This requires only two logic gates: one XOR for the and one AND for the carry. The for the half adder is as follows:
ABS (A \oplus B)C (A \cdot B)
0000
0110
1010
1101
For example, adding the bits 1 and 1 yields a of 0 and a carry of 1, representing the result 10. The half subtractor is a basic combinational circuit that subtracts one single-bit binary number B from another A, generating a difference output D and a borrow output B_out. The difference is computed as D = A \oplus B, using an XOR gate, and the borrow is B_{out} = \overline{A} \cdot B, implemented with a NOT gate on A followed by an AND gate with B (equivalently, an NAND gate can be used but the standard form employs XOR, AND, and NOT). This requires three logic gates: one XOR, one AND, and one NOT. The for the half subtractor is:
ABD (A \oplus B)B_out (\overline{A} \cdot B)
0000
0111
1010
1100
As an illustration, subtracting 0 from 1 produces a difference of 1 and a borrow of 0. Both the half and half subtractor lack inputs for carry-in or borrow-in, making them suitable only for the least significant bit (LSB) in multi-bit operations; extensions to full versions incorporate these inputs for complete arithmetic handling.

Full Adder-Subtractor

A full is a circuit that adds three bits: two input bits A and B, along with a carry-in bit Cin, producing a sum bit S and a carry-out bit Cout. The sum output is given by the equation S = A \oplus B \oplus C_{in}, while the carry-out is C_{out} = (A \land B) \lor (A \land C_{in}) \lor (B \land C_{in}). The for a full adder is as follows:
ABCinSCout
00000
00110
01010
01101
10010
10101
11001
11111
This table enumerates all possible input combinations and their corresponding outputs. A full subtractor performs binary subtraction of three bits: minuend A, subtrahend B, and borrow-in Bin, yielding a bit D and borrow-out bit Bout. The is computed as D = A \oplus B \oplus B_{in}, and the borrow-out as B_{out} = (\lnot A \land B) \lor (\lnot A \land B_{in}) \lor (B \land B_{in}). These equations enable gate-level realization using XOR, AND, OR, and NOT gates. To implement a multi-bit adder-subtractor, n full adders are cascaded in a ripple-carry configuration, where the carry-out of each stage serves as the carry-in to the next. A mode control signal M selects the operation: M=0 for and M=1 for . For each bit position i, the B input is fed through an with M, so \tilde{B_i} = B_i \oplus M; this passes B_i unchanged for addition but inverts it (one's complement) for subtraction. Additionally, the initial carry-in to the least significant bit is set to M, adding 1 for subtraction when M=1. In a 4-bit , the circuit consists of four full adders, with XOR gates on each B input controlled by M and the first carry-in tied to M. For example, adding 1010 (A) and 0110 (B) with M=0 yields 0000 and carry-out 1 (representing in ). For subtraction (M=1), B becomes 1001 (one's complement of 0110), plus 1 via Cin=1, so A + \tilde{B} + 1 = 1010 + 1001 + 1 = 0100 with carry-out 1 (representing 4 in ). Overflow in two's complement operations is detected by comparing the carry-in to the most significant bit (sign bit) with the carry-out from it; overflow occurs if they differ. This sign bit comparison flags when the result exceeds the representable range for signed n-bit numbers.

Applications and Integration

Role in Arithmetic Logic Units

The Arithmetic Logic Unit (ALU) serves as a core component of the central processing unit (CPU), executing a variety of arithmetic and logical operations on binary data, including addition, subtraction, bitwise AND, OR, XOR, and shifts. Within this multi-function unit, the adder-subtractor functions as the primary arithmetic backbone, enabling efficient computation of sums and differences that form the basis of numerical processing in digital systems. Integration of the adder-subtractor into the ALU occurs through the processor's , where it directly supports the execution of ADD and instructions by routing from registers or to its inputs. A mode control signal, generated from the instruction by the , toggles the operation between and , typically by selectively inverting one via XOR gates to facilitate subtraction. In architectures, which characterize most general-purpose processors, the ALU's adder-subtractor underpins register-based operations central to program execution, such as computing R1 ← R2 + R3 for accumulation tasks or R1 ← R2 - R3 for difference calculations in algorithms like or addressing. Historically, adder-subtractors emerged as essential elements in early computers. This foundational approach influenced subsequent designs, evolving through transistor-based systems in the and integrated circuits in the to the pipelined ALUs in modern CPUs, which support high-speed, multi-issue execution for complex workloads. In the Intel 8085 8-bit microprocessor, introduced in 1976, the ALU incorporates an 8-bit adder-subtractor formed by cascading eight full adder-subtractor units, enabling byte-wide arithmetic for register operations and flag updates critical to early microcontroller applications.

Performance Considerations

The ripple-carry adder (RCA), a fundamental implementation for adder-subtractor circuits, exhibits a primary limitation in its cumulative propagation delay, which scales linearly as O(n) for an n-bit operand due to the sequential rippling of the carry signal through each full adder stage. In the worst case, this delay propagates through the entire chain, akin to the cumulative gate delays in a series of AND and OR operations across all bits, making it unsuitable for high-speed applications beyond modest bit widths. To address this bottleneck, the carry-lookahead adder (CLA) introduces generate (G_i = A_i \land B_i) and propagate (P_i = A_i \oplus B_i) signals per bit position, enabling parallel carry computation via the recursive relation: C_{i+1} = G_i \lor (P_i \land C_i) This structure allows higher-order carries to be generated simultaneously, reducing the overall propagation delay to O(log n). Despite its speed advantages, the CLA incurs trade-offs in power and area compared to the RCA; the RCA's minimal gate count results in lower power dissipation and compact layout, whereas the CLA demands additional logic, such as multi-input AND-OR trees for carry expansion in a 4-bit block, leading to roughly 2-3 times the transistor count and higher dynamic power. For subtraction in adder-subtractor units, the 2's complement —adding the inverted subtrahend with a forced carry-in of 1—imposes an extra gate delay from the inversion of all B inputs via XOR gates, slightly exacerbating the propagation time relative to pure . Signed arithmetic in 2's complement further requires careful handling of and overflow detection to maintain correctness, unlike unsigned operations that treat values $2^n, though the intrinsic delay profile remains dominated by the adder's carry mechanism. As of 2025, adder-subtractor circuits in field-programmable gate arrays (FPGAs) exploit dedicated carry chains—cascadable MUX-XOR structures spanning multiple logic blocks—to achieve near-constant delay for wide operands, enhancing integration in reconfigurable systems. Emerging variants in approximate sacrifice exactness for reduced power in accelerators, while quantum reversible designs minimize ancilla qubits and garbage outputs for fault-tolerant arithmetic.

References

  1. [1]
    5. Fixed Point Arithmetic Unit I - UMD Computer Science
    When M = 0, the circuit is an adder and when M = 1, the circuit becomes a subtractor. Each exclusive-OR gate receives input M and one of the inputs of B. When M ...
  2. [2]
    [PDF] Basic Arithmetic Circuits - People @EECS
    Because of the common part of the full-adder and the full-subtractor, are often built as a single adder/subtractor block, with a control input for selecting ...
  3. [3]
    Binary Addition - Math Alive Crypto 1
    Binary addition is much like your normal everyday addition (decimal addition), except that it carries on a value of 2 instead of a value of 10.
  4. [4]
    Binary Addition and Subtraction - UAF CS
    The truth table for full binary addition of the bits in position j is: ... To add two binary numbers, the single bit addition operation is applied to all bits in ...
  5. [5]
    [PDF] Binary Adder
    • Carry Bits. – binary adding of n-bits will produce an n+1 carry. – can be used as carry-in for next stage or as an overflow flag. • Cascading Multi-bit Adders.Missing: process | Show results with:process
  6. [6]
    [PDF] Binary arithmetic - University of Pittsburgh
    • In fact, simple bit-by-bit inversion followed by adding 1 will give the same- magnitude number with a different sign. • Examples, assume 4-bit representation.Missing: explanation | Show results with:explanation
  7. [7]
    [PDF] ECE 2300 Digital Logic and Computer Organization Topic 5 ...
    A Half Subtractor subtracts two one-bit numbers a and b. It produces the difference d = a − b and a borrow bit. Complete the truth table for this building ...
  8. [8]
    [PDF] binary arithmetic and bit operations
    For example, if you have an 8-bit binary value X and you want to guarantee that bits four through seven contain zeros, you could logically AND the value X with ...
  9. [9]
    One's and Two's complements - ChipVerify
    In digital arithmetic, one's complement is used in some older systems for subtraction operations. One's complement is not commonly used in modern digital ...
  10. [10]
    Digital Electronics - Complement Arithmetic - Tutorials Point
    In digital electronics, the 1's complement is a type of complement used to simplify the subtraction of binary numbers. Also, the 1's complement is used to ...<|separator|>
  11. [11]
    Two's Complement - Cornell: Computer Science
    To get the two's complement negative notation of an integer, you write out the number in binary. You then invert the digits, and add one to the result.Contents and Introduction · Conversion from Two's... · Conversion to Two's...
  12. [12]
    Two's Complement Representation: Theory and Examples
    Nov 16, 2017 · The two's complement representation is a basic technique in digital arithmetic which allows us to replace a subtraction operation with an addition.
  13. [13]
    Binary Adder-Subtractor - Tutorials Point
    A binary adder-subtractor is a digital circuit that is used to perform two basic arithmetic operations namely, binary addition and binary subtraction.
  14. [14]
    Binary Adder and Binary Addition using Ex-OR Gates
    From the truth table of the half adder we can see that the SUM (S) output is the result of the Exclusive-OR gate and the Carry-out (Cout) is the result of the ...
  15. [15]
    To Study & Verify Half and Full Subtractor - Virtual Labs
    The logic symbol and truth table are shown below. Figure-1:Logic Symbol of Half subtractor. Figure-2:Truth Table of Half subtractor. Figure-3:Circuit Diagram ...
  16. [16]
    None
    ### Summary of Binary Adder-Subtractor Circuit Design
  17. [17]
    [PDF] DESIGN AND ANALYSIS OF 1-BIT FULL SUBTRACTOR FOR ...
    The gate level diagram of a full subtractor is displayed in Fig. 2.5. In ... The equations provide the Boolean expression for the two output variables.
  18. [18]
    Overflow in Arithmetic Addition in Binary Number System
    Sep 22, 2025 · But Instead of using a 3-bit Comparator, Overflow can also be detected using 2 Bit Comparator just by checking Carry-in(C-in) and Carry-Out(C- ...
  19. [19]
    [PDF] CPU = datapath + control ALU: arithmetic/logic unit performs ...
    The ALU performs arithmetic and logical operations, including ADD, AND, OR, and can perform subtraction using a negated operand. It can also perform set on ...
  20. [20]
    Arithmetic Logic Unit in Digital Electronics - Tutorials Point
    The ALU can perform all arithmetic and logic operations such as addition, subtraction, multiplication, division, logical comparisons, etc. · It can also perform ...<|separator|>
  21. [21]
    ALU Control - CS2100 - NUS Computing
    ALU control is a 4-bit signal that controls the ALU's operation, including input inversion and operation selection, and is generated from opcode and funct.<|separator|>
  22. [22]
    [PDF] Von Neumann Computers 1 Introduction - Purdue Engineering
    Jan 30, 1998 · The ALU combines and transforms data using arithmetic operations, such as addition, subtraction, multiplication, and division, and logical.
  23. [23]
    5.2. The von Neumann Architecture - Dive Into Systems
    The first is the arithmetic/logic unit (ALU), which performs mathematical operations such as addition, subtraction, and logical or, to name a few. Modern ALUs ...Missing: integration adder-
  24. [24]
    ENIAC - Penn Engineering
    Concerned with the arithmetic operations twenty accumulators for addition and subtraction, a multiplier and a combination divider and square rooter.Missing: adder- | Show results with:adder-
  25. [25]
    The History of Central Processing Unit (CPU) - IBM
    Due to its generous size, the ENIAC was so large that people could stand within the CPU and program the machine by rewiring connections between functional ...
  26. [26]
    [PDF] CPU Design
    The easiest component to examine is the 8085's ALU. It performs all arithmetic, logic, and shift instructions, making its result available to the registers ...
  27. [27]
    (PDF) UNIT I 8085 ARCHITECTURE - Academia.edu
    The paper provides a detailed exposition on the architecture of the 8085 microprocessor. It covers the memory subsystem, instruction execution model, ...
  28. [28]
    [PDF] Area, Delay and Power Comparison of Adder Topologies
    The advantages of the RCA are lower power consumption as well as compact layout giving smaller chip area. The design schematic of RCA is shown in Figure (2).
  29. [29]
    [PDF] Ripple Carry and Carry Lookahead Adders
    Notice that the carry-out bit, c« + , of the last stage will be available after four delays: two gate de- lays to calculate the propagate signals and two delays ...
  30. [30]
    [PDF] Carry-Propagate Adder - People
    By pre-computing the major part of each carry equation, we can make a much faster adder. We start by computing the partial results (for each bit): pi= ai+ bi. ( ...
  31. [31]
    Comparative Analysis of Various Adder Architectures on 28nm ...
    Sep 21, 2022 · RCA having minimum transistor count has the least power dissipation and CLA gives minimum leakage current for lower supply voltages. MCC gives ...
  32. [32]
    [PDF] 2's complement … … … Sign extension 42 = ________00101010
    If we use a two's complement representation for signed integers, the same binary addition mod 2n procedure will work for adding positive and negative numbers ( ...
  33. [33]
    Carry Logic - UG474
    Apr 1, 2025 · The carry chains are cascadable to form wider add/subtract logic, as shown in Figure 1. The carry chain runs upward and has a height of four ...
  34. [34]
    FPGA‐Based Design of Ultra‐Efficient Approximate Adders for High ...
    Jul 19, 2025 · This study presents a family of logic-minimized approximate full adders (AFA1–AFA3) designed using AND-OR gate logic and implemented on an ...
  35. [35]
    A High-Speed Quantum Reversible Controlled Adder/Subtractor ...
    This paper proposes a new design of quantum-controlled adder/subtractor (QCAS) with efficient quantum criteria like delay, quantum cost, number of ancilla and ...