Thread Reader
Ken Shirriff

Ken Shirriff
@kenshirriff

Jan 23
9 tweets
Twitter

Intel's 8086 processor (1978) had a huge influence on computing. Although simple by modern standards, its die contains many different functional blocks. Code uses conditional jumps for loops and if statements. Let's take a close look and see how these jumps are implemented.🧵

A die photo of the 8086 microprocessor showing complex the metal layer on top of the silicon. Functional blocks are labeled, such as the registers, microcode ROM, and arithmetic/logic unit.
The 8086 uses microcode, running a tiny program for each machine instruction. To keep the microcode ROM small, hardware logic helps implement instructions. The 8086 has 16 conditional jump instructions: one microcode routine implements them all, with gates handling the details.
A closeup of the microcode ROM and associated circuitry on the die.
Here's the microcode for conditional jumps (Jcond). The offset goes in a temporary register. XC jumps to the relative jump routine (RELJMP) if the condition is satisfied. The offset is added to the program counter (PC) and it runs the next instruction (RNI).
A listing of seven micro-instructions.
The 8086 has 16 conditional jumps. A block of circuitry decodes bits from the instruction, determines the condition, and checks flags from the ALU to see if the condition is satisfied. Putting this in hardware keeps the microcode small and simple.
A table showing the 16 conditional jumps supported by the 8086.
A closeup of some transistors on the die.
A 21-bit micro-instruction can have a condition. These are special hardware conditions, including XC. A PLA (programmable logic array) evaluates the conditions, one per row. The microcode address is updated if the condition is satisfied.
A table showing the structure of a 21-bit micro-instruction. There are six different types of micro-instruction. Jumps and calls have a condition field that is 3 or 4 bits long.
A closeup of a grid-like programmable logic array on the die.
Microcode addresses are 13 bits, too big to put a jump in microcode directly. The Translation ROM converts a 4-bit tag into a 13-bit microcode address. The highlighted row is the address for the RELJMP routine.
A closeup of the Translation ROM on the die. It is a grid-like structure of transistors.
This diagram shows what happens in the chip for each step of a conditional jump. There's a lot going on. The prefetch queue adds complexity since it must be stopped and flushed for a jump. The program counter must be corrected because prefetching moves it ahead.
A die photo of the 8086. Arrows show movement around the die as the microcode executes a conditional jump. Active components include the ALU, flags, program counter, prefetch queue control, and the condition circuitry,
To summarize, microcode and special gate logic work together to compactly implement conditional jumps. For more details, see my blog post: righto.com/2023/01/revers…
Thanks to Andrew Jenner for disassembling the 8086 microcode. reenigne.org/blog/8086-micr…
Ken Shirriff

Ken Shirriff

@kenshirriff
Computer history. Reverse-engineering old chips. Restored Apollo Guidance Computer, Alto. Ex-Google, Sun, Msft. So-called boffin. @kenshirriff@oldbytes.space
Follow on Twitter
Missing some tweets in this thread? Or failed to load images or videos? You can try to .