Reverse-engineering the surprisingly advanced ALU of the 8008 microprocessor
A computer's arithmetic-logic unit (ALU) is the heart of the processor, performing arithmetic and logic operations on data.
If you've studied digital logic, you've probably learned how to combine simple binary adder circuits
to build an ALU.
However, the 8008's ALU
uses clever logic circuits that can perform multiple operations efficiently.
And unlike most 1970's microprocessors, the 8008 uses a complex carry-lookahead circuit to increase its performance.
The 8008 was Intel's first 8-bit microprocessor, introduced 45 years ago.1
While primitive by today's standards, the
8008 is historically important because it essentially started the microprocessor revolution and is the ancestor of the x86 processor family that are probably using right now.2
I recently took some die photos of the 8008, which I described earlier.
In this article, I reverse-engineer the 8008's ALU circuits from these die photos and explain how the ALU functions.
Inside the 8008 chip
The image below shows the 8008's tiny silicon die, highly magnified. Around the outside of the die, you can see the 18 wires connecting the die to the chip's external pins.
The rest of the chip contains the chip's circuitry, built from about 3500 tiny transistors (yellow) connected by a metal wiring layer (white).
While this ALU slice looks like it is made of many gates, physically it is only three gates: two large, multilevel AND-OR-NAND gates and one NAND gate.
The AND-OR-NAND logic is implemented on the chip as a single complex gate, rather than by combining simpler gates, since
a single large gate provides better performance with less circuitry than multiple small gates.
One feature of MOS logic is it's just as easy to form an AND-OR-NAND gate (for instance) as a plain NAND gate.
Understanding the ALU logic
The 8008's ALU circuit above looks like a mysterious collection of gates, but eventually I figured out the structure behind it.
The starting point is a full adder that handles the Sum operation.
(A full adder adds three input bits (a, b and c) and outputs the (low-order) sum bit and a carry bit.)
The full adder is then heavily modified to support the logic operations, yielding the ALU from the previous section.
The logic operations are implemented by using the mode lines to block parts of the circuit, yielding XOR, AND or OR, rather than the more complex Sum.
The diagram below strips down the 8008's ALU circuit to reveal the full adder "hidden" inside.
The gate in red generates the carry-out from the three inverted inputs, using relatively straightforward logic.
(Since the 8008 uses carry-lookahead, this carry-out signal isn't passed to the next ALU slice, but just used to generate the ALU output.)
If you examine the possible sum cases, you will see that the sum bit is almost always just the carry-out inverted, except for the 0+0+0 and 1+1+1 cases.
Thus, the sum bit can be generated by inverting the carry-out and handling the two exceptional cases.8
The two gates indicated below handle the exceptions by forcing the sum output to the correct value.
February 9, 2017 at 10:53 AM