Module 2: Combinational Circuit Design · 2.2 Subtractors & ALU Design

What an ALU Is

The Arithmetic Logic Unit (ALU) forms the computational execution core of a microprocessor. While adders and subtractors perform arithmetic operations, a central processing unit (CPU) requires bitwise logic, register transfers, comparisons, and conditional flag generation. This article analyzes the structural design philosophy of the ALU. We examine the standard signal interface, partition functional operations, and explain the parallel compute-and-select multiplexer topology common to modern processors.

ALU Interface Specification

An ALU functions as a combinational hardware module with defined input, output, and status reporting lines. Table 1 outlines the signal contract:

Signal Identifier Bit Width Direction Functional Purpose
$A[N-1:0]$ $N$ Input Primary data operand
$B[N-1:0]$ $N$ Input Secondary data operand
opcode[k-1:0] $k$ Input Operation selection code ($2^k$ available operations)
result[N-1:0] $N$ Output Arithmetic or logical computation result
$Z$ 1 Output Zero flag (asserts high when result equals 0)
$N$ 1 Output Negative flag (asserts high when the two’s complement sign bit is 1)
$C$ 1 Output Carry flag (asserts on unsigned arithmetic overflow or borrow absence)
$V$ 1 Output Signed overflow flag (asserts when signed results exceed representation limits)

Figure 1 shows the top-level block diagram:

ALU interface
Figure 1: Architectural interface of an Arithmetic Logic Unit with inputs, result, and condition flags

Condition status flags feed the processor status register (PSR). Conditional branch instructions evaluate these flags to control program execution flow.

Taxonomy of Standard ALU Operations

An Instruction Set Architecture (ISA) groups ALU operations into four primary classes:

  1. Arithmetic Operations:
    • ADD: Computes $A + B$.
    • SUB: Computes $A - B$.
    • ADC (Add with Carry): Computes $A + B + C_{\text{in}}$, supporting multi-word arithmetic chaining.
  2. Bitwise Logic Operations:
    • AND: Bitwise masking.
    • OR: Bitwise setting.
    • XOR: Bitwise toggling and equality checks.
    • NOT: Bitwise inversion. Logic operations execute on individual bit positions independently with zero inter-bit carry propagation.
  3. Register Pass-Through Operations:
    • PASS_A / PASS_B: Passes operand $A$ or operand $B$ directly to the output without modification. These operations move data between registers using existing datapath buses without requiring dedicated bypass circuits.
  4. Comparison Operations:
    • CMP: Computes $A - B$ to set status flags $Z$, $N$, $C$, and $V$. The ALU suppresses the result write-back to the register file, preserving operand values.

The Parallel Compute-and-Select Architecture

Physical logic gates cannot alter their interconnect wiring dynamically in picoseconds. Instead, digital ALUs implement a parallel compute-and-select architecture:

  1. Dedicated functional sub-blocks (adder/subtractor, bitwise logic gates, shifters) connect to input buses $A$ and $B$ in parallel.
  2. All functional blocks compute their results simultaneously on every clock cycle.
  3. A multi-bit multiplexer driven by opcode routes the selected operation result to the output bus (Figure 2).
  4. Unselected computation outputs are discarded.

Parallel compute and select
Figure 2: Parallel execution topology: functional units compute concurrently while an output multiplexer selects the result

Engineering Trade-Offs of the Architecture

  • Predictable Latency: The output multiplexer introduces a small, fixed propagation delay. Timing analysis tools evaluate the critical path deterministically, simplifying synchronous pipeline design.
  • Area Efficiency: Bitwise logic gates require minimal silicon area compared to the primary adder core. Adding parallel logic blocks increases total ALU area by less than 20%.
  • Dynamic Power Dissipation: Because unselected logic units evaluate continuously, internal transistor nodes toggle dynamically, consuming power. Modern low-power CPUs use operand isolation or clock gating to suppress switching activity in idle functional blocks.

Historical Case Study: The Texas Instruments SN74181 ALU

Introduced in 1970, the Texas Instruments SN74181 was the first single-chip integrated 4-bit ALU. It contained internal carry-lookahead circuitry and provided 32 selectable operations using a 4-bit function select bus ($S_3 \dots S_0$) and a mode control pin ($M$):

  • Mode $M = 1$: Generates 16 bitwise logic functions (including NOT, AND, OR, XOR, and NAND).
  • Mode $M = 0$: Generates 16 arithmetic operations (including Addition, Subtraction, Decrement, and Increment).

Table 2 lists representative operations from the 74181 function table:

Mode ($M$) Select ($S_3 S_2 S_1 S_0$) Operational Function Description
1 0000 $\overline{A}$ Bitwise NOT
1 0110 $A \oplus B$ Bitwise XOR
1 1011 $A + B$ Bitwise OR
0 1001 $A + B$ Two’s complement addition with carry
0 0110 $A - B - 1$ Subtraction with borrow
0 0000 $A - 1$ Arithmetic decrement

The 74181 powered landmark minicomputers, including the DEC PDP-11 and the Data General Nova. Multiple 74181 units were cascaded with 74182 Lookahead Carry Units to construct 16-bit and 32-bit execution engines.

Complete 4-Bit ALU System Architecture

Figure 3 illustrates the architecture of the 4-bit ALU designed in the next article:

Complete 4-bit ALU interface
Figure 3: Detailed interconnect block diagram of the 4-bit ALU

The 3-bit operation code (opcode[2:0]) controls both the adder/subtractor mode line and the 8-to-1 output multiplexer. Status flag generation logic samples the arithmetic carry chain and the final multiplexer result bus.

Practice Exercises

Problem 1: An embedded 8-bit microcontroller requires the following eight operations: ADD, SUB, AND, OR, XOR, NOT_A, PASS_A, and CMP.

  1. Determine the minimum number of opcode bits required.
  2. Identify the necessary functional blocks.
  3. Explain how CMP is implemented without adding extra hardware blocks.
View Solution
  1. Opcode Bit Width: Eight operations require $k = \log_2 8 = 3$ opcode bits (opcode[2:0]).
  2. Functional Blocks:
    • One 8-bit adder/subtractor with mode control.
    • Parallel bitwise logic gates (AND, OR, XOR, and NOT).
    • An 8-to-1 8-bit output multiplexer.
    • Condition flag logic ($Z, N, C, V$).
  3. CMP Implementation: CMP executes an arithmetic subtraction ($A - B$) to update status flags. The processor datapath disables the register write-enable line (reg_write = 0), discarding the result while preserving the generated flags. Therefore, CMP reuses the existing subtractor hardware without requiring a separate comparator block.

Problem 2: Explain why parallel functional units in an ALU evaluate concurrently on every clock cycle, and describe an engineering technique used to reduce the resulting dynamic power dissipation.

View Solution

Combinational logic circuits do not contain internal clock enable switches; whenever input voltages switch, signals propagate through all connected transistor networks. Parallel evaluation provides fixed, deterministic propagation delays across all operations, which simplifies synchronous pipeline scheduling.

To eliminate wasted switching power in unselected units, low-power microprocessors implement operand isolation. AND gates or latches placed on the input paths of dormant units freeze their inputs at constant values when their specific opcode is not asserted. This suppresses internal capacitive node toggling, reducing dynamic power dissipation.

In the next article, we build the complete 4-bit ALU gate by gate, verify all eight operations, and evaluate its timing characteristics.

← The Adder/Subtractor Unit with Flags Building a 4-Bit ALU →