bin-register

def to_bin(n):
    if n == 0: return 0
    elif n == 1: return 1
    # Quotient (left side) + Remainder (right side)
    else: return to_bin(n // 2) * 10 + to_bin(n % 2)

Standard Binary (2^n): The decimal number 3 in binary is 0011.

In a hardware sense, a Binary Adder is a masterpiece of efficiency because it uses the absolute minimum number of logic gates to process a carry.

  1. The Binary Full Adder (Minimalist) A standard binary full adder adds three bits (A, B, and a Carry-in) and outputs a Sum and a Carry-out. It only requires 5 logic gates.

Equation:

Context: The Full Adder This specific formula defines the Sum output of a Full Adder circuit. In this context, the operation can also be described as:

Carry-out ($C_{out}$) of a full adder is typically expressed in one of two ways:

  1. Standard Logic Form $C_{out} = (A \cdot B) + (C_{in} \cdot (A \oplus B))$ In plain English, this translates to: "Carry-out is equal to (A AND B) OR (Carry-in AND (A XOR B))." This version is most common because it reuses the $A \oplus B$ result already calculated for the Sum, making it efficient to build with physical gates.
  2. Simplified (Sum-of-Products) Form $C_{out} = AB + BC_{in} + AC_{in}$ In plain English: "Carry-out is equal to (A AND B) OR (B AND Carry-in) OR (A AND Carry-in)." What this formula means The Carry-out bit is "1" if at least two of the three inputs are "1". [8, 10, 11]

The truth table for a full adder shows every possible combination of the three inputs ($A$, $B$, and $C_{in}$) and the resulting Sum and Carry-out ($C_{out}$).

$A$ $B$ $C_{in}$ Sum ($S$) Carry-out ($C_{out}$)
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1

How to read this table: