Skip to main content

2.1 ALU Design (Circuits)

The Arithmetic Logic Unit (ALU) is the computational core of the processor. While Chapter 1.5 detailed data representations and Booth's mathematical traces, this chapter explores the physical hardware circuit implementation of the ALU. We analyze multiplexer-based operand routing, logic gate selections, the consolidated Arithmetic Logic Shift Unit (ALSU), and timing delays comparing ripple-carry and carry-lookahead adders.

Learning Objectives

  • Identify the basic components of a hardware Arithmetic Logic Unit (ALU).
  • Explain how multiplexer selection lines route binary operands to adder inputs for arithmetic and logic operations.
  • Compute adder input logic formulas ($Y_i$) for specific multiplexer designs based on operation select inputs.
  • Contrast carry-lookahead adders with ripple-carry adders inside an ALU in terms of gate propagation delay.
  • Justify the design efficiency of combining arithmetic, logic, and shift functions into a single Arithmetic Logic Shift Unit (ALSU) over separate units.
Prerequisites

Before studying this chapter, you should review Chapter 1.5: Fixed/Floating Arithmetic & Representations to understand twos complement integer math and binary addition.

1. Overview of ALU and Datapath Organization

Within the CPU, the Arithmetic Logic Unit (ALU) executes all arithmetic and logical microoperations on data. The ALU does not store data itself; rather, it is connected to a shared internal CPU bus. Operands are routed from the internal register file (or temporary registers) into the ALU inputs, and the resulting computation is placed on the bus to be written back to a destination register.

2. Design of Arithmetic Circuit

A multi-bit arithmetic circuit is constructed by cascading $N$ identical 1-bit stages. Each stage consists of a **Full Adder (FA)** and an input multiplexer that controls the second operand.

Let $A_i$ and $B_i$ be the $i$-th bits of the two input words, and $S_1, S_0$ be the operation select lines. The Full Adder receives three inputs:

  • The first input, $X_i$, is wired directly to the operand bit $A_i$: $$X_i = A_i$$
  • The second input, $Y_i$, is controlled by the multiplexer select lines $S_1, S_0$ to route different variations of the operand $B_i$:
    • When $S_1 S_0 = 00$, $Y_i = B_i$ (yielding Addition).
    • When $S_1 S_0 = 01$, $Y_i = \bar{B}_i$ (yielding Subtraction).
    • When $S_1 S_0 = 10$, $Y_i = 0$ (yielding Transfer or Increment).
    • When $S_1 S_0 = 11$, $Y_i = 1$ (yielding Decrement).
  • The third input is the Carry-In ($C_i$) from the previous stage.

2.1 Deriving the $Y_i$ Boolean Equation

To construct the input multiplexer stage using standard logic gates, we map the MUX output $Y_i$ in a truth table and derive its Boolean equation: $$Y_i = B_i S_0 + \bar{B}_i S_1$$ This simple logic slice (implemented with two AND gates, one OR gate, and one NOT gate per bit stage) routes the correct operand value to the adder.

[Figure 2.1.1: 1-Bit Arithmetic Stage Logic Diagram]
  A_i ─────────────────────────────► [ X_i ]
                                     │
  S_1 ───────┐                       │
             ├──► [ Y_i Multiplexer ]├──► [ Full Adder ] ──► Sum (D_i)
  S_0 ───────┤                       │                  
  B_i ───────┘                       │                  
                                     │
  C_i ──────────────────────────────►[ C_in ] ──► Carry-Out (C_i+1)
                                
Figure 2.1.1: Block diagram of a single-bit arithmetic stage using a multiplexed operand input to a Full Adder.

3. Design of Logic Circuit

A logic circuit executes bitwise operations (AND, OR, XOR, NOT) on the input words $A_i$ and $B_i$. Because logic operations do not generate carries, no Full Adders are required.

A 1-bit logic stage consists of four gates generating the four basic operations in parallel, connected to a $4 \times 1$ multiplexer. The select lines $S_1, S_0$ select the active output:

  • $S_1 S_0 = 00 \Rightarrow \text{AND}$ ($A_i \wedge B_i$)
  • $S_1 S_0 = 01 \Rightarrow \text{OR}$ ($A_i \vee B_i$)
  • $S_1 S_0 = 10 \Rightarrow \text{XOR}$ ($A_i \oplus B_i$)
  • $S_1 S_0 = 11 \Rightarrow \text{NOT}$ ($\bar{A}_i$)

During logic operations, the ALU disables all carry propagation lines to prevent arithmetic carry interference.

4. Consolidated Arithmetic Logic Shift Unit (ALSU)

Rather than deploying separate arithmetic, logic, and shifter units, computer designers combine these stages into a single, consolidated Arithmetic Logic Shift Unit (ALSU).

A consolidated ALSU stage uses an output multiplexer to select among the arithmetic sum ($D_i$), the logic output ($H_i$), or shift-left/shift-right lines. A typical 1-bit ALSU stage uses 3 select lines ($S_2, S_1, S_0$):

  • $S_2 = 0 \Rightarrow$ Selects the Arithmetic Circuit output.
  • $S_2 = 1, S_1 = 0 \Rightarrow$ Selects the Logic Circuit output.
  • $S_2 = 1, S_1 = 1, S_0 = 0 \Rightarrow$ Selects Shift Right (shf-rt).
  • $S_2 = 1, S_1 = 1, S_0 = 1 \Rightarrow$ Selects Shift Left (shf-lt).

5. Timing Delays: Ripple Carry vs. Carry Lookahead Adders

The speed of the ALU is heavily limited by the carry propagation delay of its adder circuit.

5.1 Ripple Carry Adder (RCA)

In an $N$-bit Ripple Carry Adder, the carry-out $C_{i+1}$ of stage $i$ must propagate to the carry-in of stage $i+1$. Let $t_{gate}$ be the propagation delay of a single logic gate:

  • Each Full Adder requires 2 gate delays to generate $C_{out}$ from $C_{in}$.
  • For an $N$-bit adder, the total carry propagation delay is:
    $$t_{RCA} = 2N \times t_{gate}$$
  • For $N = 32$ bits, the delay is $64\ t_{gate}$, creating a severe speed bottleneck.

5.2 Carry Lookahead Adder (CLA)

To eliminate this serial carry delay, a Carry Lookahead Adder computes the carry signals for all stages simultaneously. It defines two terms for each stage:

  • **Carry Generate ($G_i$)**: The stage generates a carry if both inputs are $1$: $$G_i = A_i B_i$$
  • **Carry Propagate ($P_i$)**: The stage propagates a carry if at least one input is $1$: $$P_i = A_i + B_i$$

Using these terms, the carries are calculated in parallel:

$$C_1 = G_0 + P_0 C_0$$ $$C_2 = G_1 + P_1 G_0 + P_1 P_0 C_0$$ $$C_3 = G_2 + P_2 G_1 + P_2 P_1 G_0 + P_2 P_1 P_0 C_0$$

Because all $G_i$ and $P_i$ are generated in 1 gate delay, and the carries are generated through a two-level sum-of-products gate array, the total carry propagation delay is reduced to: $$t_{CLA} = 3 \times t_{gate}$$ Regardless of $N$, the CLA computes carries in $O(1)$ constant time. However, as $N$ grows beyond 4, the fan-in (number of inputs per gate) of the logic gates becomes physically unmanageable, requiring hierarchical CLA groupings (e.g. 4-bit CLA blocks).

6. Worked Examples & Numerical Problems

Timing Example 2.1.1

Ripple Carry vs. Carry Lookahead Delays

Problem: Suppose a single logic gate has a propagation delay of $1.5\text{ ns}$. Calculate the carry propagation delays of a 16-bit Ripple Carry Adder and a 16-bit Carry Lookahead Adder (constructed as a single level block).

Solution:

  1. Calculate Ripple Carry Adder delay: $$t_{RCA} = 2N \times t_{gate} = 2(16) \times 1.5\text{ ns} = 32 \times 1.5\text{ ns} = 48\text{ ns}$$
  2. Calculate Carry Lookahead Adder delay: Recall that a single-level CLA generates carries in a constant $3$ gate delays: - $1\text{ gate delay}$ to generate all $G_i$ and $P_i$ terms. - $2\text{ gate delays}$ (AND-OR levels) to compute the carries. $$t_{CLA} = 3 \times t_{gate} = 3 \times 1.5\text{ ns} = 4.5\text{ ns}$$

Answer: The RCA delay is **$48\text{ ns}$** and the CLA delay is **$4.5\text{ ns}$**.

ALU Example 2.1.2

Custom ALU Input Multiplexer Truth Table

Problem: An arithmetic circuit has a modified input multiplexer where the $Y_i$ input to the Full Adder is defined by the Boolean equation: $Y_i = B_i \bar{S}_1 + S_0$. Derive the arithmetic operations performed for the four select line configurations ($S_1 S_0 = 00, 01, 10, 11$) when $C_{in} = 0$.

Solution:

We evaluate the term $Y_i = B_i \bar{S}_1 + S_0$ for each select combination:

  1. For $S_1 S_0 = 00$: $$Y_i = B_i (1) + 0 = B_i \Rightarrow \text{Adder Input} = B_i$$ Operation: $F = A + B$ (Addition).
  2. For $S_1 S_0 = 01$: $$Y_i = B_i (1) + 1 = 1 \Rightarrow \text{Adder Input} = 1\text{s (all 1s represents -1)}$$ Operation: $F = A - 1$ (Decrement $A$).
  3. For $S_1 S_0 = 10$: $$Y_i = B_i (0) + 0 = 0 \Rightarrow \text{Adder Input} = 0$$ Operation: $F = A$ (Transfer $A$).
  4. For $S_1 S_0 = 11$: $$Y_i = B_i (0) + 1 = 1 \Rightarrow \text{Adder Input} = 1\text{s (all 1s represents -1)}$$ Operation: $F = A - 1$ (Decrement $A$).

7. Core Comparison Tables

Table 2.1.3: 4-Bit Arithmetic Unit Operations

S1 S0 Cin Y_i input to FA Operation Formula Operation Name
0 0 0 $B_i$ $F = A + B$ Add
0 0 1 $B_i$ $F = A + B + 1$ Add with Carry
0 1 0 $\bar{B}_i$ $F = A + \bar{B}$ Subtract with Borrow
0 1 1 $\bar{B}_i$ $F = A + \bar{B} + 1 = A - B$ Subtract (2's Complement)
1 0 0 0 $F = A$ Transfer A
1 0 1 0 $F = A + 1$ Increment A
1 1 0 all 1s $F = A - 1$ Decrement A

8. Common Mistakes Students Make

🎯 Key Takeaways

  • An **Arithmetic Circuit** stage combines a Full Adder with input logic gates to modify the second operand bit ($Y_i$).
  • The input equation $Y_i = B_i S_0 + \bar{B}_i S_1$ generates addition, subtraction, increment, and decrement operations.
  • **Ripple Carry Adders (RCA)** experience a timing delay of $2N \times t_{gate}$ due to serial carry propagation.
  • **Carry Lookahead Adders (CLA)** generate all carries in parallel in constant $3\ t_{gate}$ delays, but are physically constrained by gate fan-in limits.
  • A consolidated **Arithmetic Logic Shift Unit (ALSU)** integrates arithmetic, logic gates, and shifting networks into a single block.

🔗 Connection to Next Chapter

Now that we have designed the core ALU circuits, we must examine where the computed values are stored. Proceed to **Chapter 2.2: Accumulator Design** to study how we control register load operations.

9. Assessment Bank

9.1 Multiple Choice Questions

Q1. In a standard 4-bit arithmetic circuit, what select line and carry-in values are required to execute the operation $F = A - B$ (2's complement subtraction)?
Q2. What is the carry propagation delay of a 32-bit Ripple Carry Adder if a single gate delay is $2\text{ ns}$?
Q3. Under a single-level Carry Lookahead Adder configuration, how many gate delays are required to compute the carries?
Q4. Which Boolean formula generates the propagate ($P_i$) term inside a Carry Lookahead Adder?

9.2 Short Answer Questions

  1. Trace why the carry propagation of Ripple Carry Adders creates an execution bottleneck. State the complexity class.
  2. Derive the Boolean logic equation for the input multiplexer stage ($Y_i$) of the ALU.
  3. Why do logic operations (AND, OR) ignore the carry-in ($C_{in}$) line?

9.3 Long Answer / Exam Questions

  1. Design a 1-bit ALU slice that performs Addition, Subtraction, AND, and XOR operations. Sketch the logic diagram showing the Full Adder, input logic gates, multiplexers, and select line routing.
  2. Explain the working of a Carry Lookahead Adder. Derive the carry equations for $C_1, C_2, C_3,$ and $C_4$ using the generate ($G_i$) and propagate ($P_i$) terms. Discuss the physical fan-in limitations that restrict CLA scaling beyond 4 bits.

9.4 Viva Voce Questions

  1. "What is gate fan-in, and how does it limit the speed of Carry Lookahead Adders?" Model Answer: Fan-in is the number of input lines connected to a single logic gate. As the CLA size ($N$) increases, the Boolean equations for higher-order carries require gates with more inputs. Physically, adding inputs to a gate increases transistor capacitance and resistance, slowing down the gate and negating the CLA's speed advantages.
  2. "How does a consolidated ALSU handle logical shift operations?" Model Answer: The ALSU contains multiplexer pathways connected to adjacent bits (bit $i-1$ for shift left, bit $i+1$ for shift right). When shift select lines are activated, the output multiplexer routes the shifted inputs directly to the bus, bypassing the arithmetic adder.

References

  1. IUST COA Syllabus, CS-301 course structure, Topic 8: "ALU Design (Arithmetic/Logic Circuits)." [Local Verified]
  2. Handwritten COA Notes, ALU designs, multiplexers, and CLA math, Pages 51–58. [Local Verified]
  3. M. Morris Mano, Computer System Architecture, 3rd Edition, Pearson, 2017. Chapter 4: Register Transfer and Microoperations. [Pending Verification]
  4. Prof. Indranil Sengupta, ALU Design, NPTEL Lectures 20: Computer Architecture. [Pending Verification]