Part 2: Arithmetic Logic Unit (ALU) Design & IEEE 754 Floating-Point Arithmetic
Arithmetic Foundations of Computation
At the operational core of every microprocessor lies the Arithmetic Logic Unit (ALU)—a combinational digital circuit responsible for performing mathematical (addition, subtraction, multiplication) and bitwise Boolean (AND, OR, XOR, shifts) operations on binary operands. While elementary ALUs rely on simple ripple-carry topologies, high-performance gigahertz processors utilize advanced Carry-Lookahead Adders (CLA), Booth's multiplication algorithm, and dedicated IEEE 754 Floating-Point Units (FPUs). In this article, we rigorously analyze circuit design, propagation delays, and binary representations.
1. Adders: The Ripple-Carry Delay Bottleneck
A 1-bit Full Adder accepts inputs $A_i$, $B_i$, and an incoming carry $C_i$, producing a sum $S_i$ and outgoing carry $C_{i+1}$:
C_{i+1} = (A_i \cdot B_i) + (C_i \cdot (A_i \oplus B_i))
In an $N$-bit Ripple-Carry Adder (RCA), $N$ full adders are cascaded serially: the carry output $C_{i+1}$ of stage $i$ feeds into the carry input of stage $i+1$. Consequently, the highest-order sum bit $S_{N-1}$ cannot stabilize until the carry bit ripples through all $N$ stages. In a 64-bit adder, if each gate introduces a delay of $t_g = 50\text{ ps}$, the total worst-case carry latency is $2N \cdot t_g \approx 6.4\text{ ns}$—capping the CPU clock frequency at an unacceptable 156 MHz.
2. Carry-Lookahead Adder (CLA): $\mathcal{O}(1)$ Parallel Logic
To eliminate ripple propagation delay, the Carry-Lookahead Adder (CLA) defines two auxiliary Boolean terms for every bit position:
- Generate ($G_i$): A carry is generated internally if both inputs are 1: $G_i = A_i \cdot B_i$.
- Propagate ($P_i$): An incoming carry is propagated to the next stage if either input is 1: $P_i = A_i \oplus B_i$.
The carry output can then be expressed recursively:
C_2 = G_1 + P_1 \cdot G_0 + P_1 \cdot P_0 \cdot C_0
C_3 = G_2 + P_2 \cdot G_1 + P_2 \cdot P_1 \cdot G_0 + P_2 \cdot P_1 \cdot P_0 \cdot C_0
C_4 = G_3 + P_3 \cdot G_2 + P_3 \cdot P_2 \cdot G_1 + P_3 \cdot P_2 \cdot P_1 \cdot G_0 + P_3 \cdot P_2 \cdot P_1 \cdot P_0 \cdot C_0
Every carry bit $C_i$ is computed simultaneously in parallel through a two-level AND-OR gate array directly from the primary inputs $A, B$ and initial carry $C_0$. The carry propagation delay drops from $\mathcal{O}(N)$ to a constant $\mathcal{O}(1)$ gate delay, enabling multi-gigahertz ALU execution.
3. Multiplication: Booth's Radix-2 & Radix-4 Algorithms
Elementary binary multiplication mimics paper-and-pencil shift-and-add arithmetic, requiring $N$ additions for an $N$-bit multiplier. In 1951, Andrew Donald Booth introduced an algorithm that accelerates signed two's complement multiplication by recoding strings of consecutive binary 1s.
For example, multiplying by the bit string $01111000_2$ ($120_{10}$) naively requires four additions. Booth recognizes that $01111000_2 = 10000000_2 - 00001000_2$ ($128 - 8$). By replacing continuous runs of 1s with a single subtraction at the beginning of the run and a single addition at the end, Booth's algorithm slashes intermediate addition cycles. Modern ALUs deploy Modified Booth Radix-4 recoding combined with Wallace / Dadda Tree reduction networks to compress partial products in $\mathcal{O}(\log_2 N)$ latency.
4. IEEE 754 Floating-Point Arithmetic Architecture
Real numbers (non-integers) are represented in hardware using the IEEE 754 Standard for Floating-Point Arithmetic. A floating-point number $V$ is encoded as:
| Format | Sign Bit | Exponent Bits | Mantissa (Fraction) | Exponent Bias | Precision |
|---|---|---|---|---|---|
| Single (binary32) | 1 bit [31] | 8 bits [30:23] | 23 bits [22:0] | 127 | ~7 decimal digits |
| Double (binary64) | 1 bit [63] | 11 bits [62:52] | 52 bits [51:0] | 1023 | ~16 decimal digits |
Related reading
How to Give Google Antigravity Direct SSH Access to Remote Servers (Proxmox & Linux)
Connect Google Antigravity directly to Proxmox and Linux servers using the Model Context Protocol (MCP), dedicated Ed25519 keys, and automated updates.
By Md. Harun-Or-Roshid
Part 9: Load Balancing: Layer 4 vs Layer 7, Algorithms, Reverse Proxies & High Availability
Master high-availability load balancing, comparing Layer 4 transport vs Layer 7 application routing, consistent hashing rings, and health checks.
By Md. Harun-Or-Roshid
Part 10: Distributed Databases: Partitioning, Sharding, 2PC & CAP Theorem
Master distributed database architecture: horizontal sharding, consistent hashing, two-phase commit (2PC), CAP theorem trade-offs, and NewSQL engines.
By Md. Harun-Or-Roshid
Part 11: Linux 64-Bit System Calls, NASM Macros & Dynamic Memory Allocation
Learn low-level systems programming: Linux 64-bit SYSCALL table, multi-argument NASM %macro directives, file I/O operations, and sys_mmap memory allocation.
By Md. Harun-Or-Roshid