Microcode in Intel's 8087 floating-point chip: the scale instruction
Ken Shirriff · 2026年9月12日
AI 摘要 AI 生成,可能有误
This article examines the microcode of Intel's 8087 floating-point coprocessor, focusing on the FSCALE instruction, which scales a floating-point number by a power of two much faster than a full multiplication. Although FSCALE seems trivial—just adding an integer to the number's exponent—the author, working with the Opcode Collective to reverse-engineer the chip's microcode, finds it uses over 140 micro-instructions and three levels of subroutine calls to handle special cases such as zeros, NaNs, denormals, and overflow/underflow. Along the way, the analysis illustrates key parts of the 8087's datapath, including the shifter, adder, and exponent converter, and reveals a hidden feature of the chip.
In the 1970s, floating-point arithmetic was a mess. Computer manufacturers had a dozen incompatible arithmetic standards.
Moreover, floating-point systems were designed around hardware simplicity rather than mathematical rigor, leading to problems
with numerical stability.
This changed when Intel introduced the 8087 floating-point coprocessor chip in 1980, designed to be as accurate as possible, even in the corner cases.
The 8087 became popular because it could be installed in the IBM PC, making floating-point operations up to 100 times faster in applications ranging from
spreadsheets to CAD.
But more importantly, the 8087 became the floating-point standard used by most computers today.
The 8087 implemented its instructions in complex low-level code called microcode.
I'm part of a group, the Opcode Collective, that is reverse-engineering this microcode, and I've recently made some progress.
In this post, I examine the microcode for one of the 8087's instructions—FSCALE—and describe how this microcode works.
The FSCALE (Floating-point Scale) instruction provides a quick way to scale a number by a power of two, much faster than a multiplication.
I figured that FSCALE was a simple, almost trivial instruction that would be straightforward to understand and explain.
Spoiler: it is not simple. FSCALE uses over 140 micro-instructions and three levels of subroutine calls to handle many special cases.
But the FSCALE microcode illustrates many interesting parts of the 8087, such as the shifter, the adder, and the exponent converter, and also reveals a
hidden feature of the 8087, so hopefully you will find it interesting.
To explore the microcode, I opened up an 8087 chip and created a high-resolution image with a microscope.
The large microcode ROM is in the center, holding the 1648 micro-instructions that control the chip.
The microcode engine on the left steps through the microcode, handling jumps and subroutine calls.
The bottom half of the chip is the "datapath", the circuitry that performs floating-point calculations; it is split into a 16-bit datapath for the
number's exponent and a 64-bit datapath for the number's significand (also known as the fractional part).
继续阅读全文
为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。
AI 摘要While examining unidentified vintage ICs, the author reverse engineered a chip under a microscope and determined it was the Signetics ST680A from 1965, a quad NAND gate implemented with diode-transistor logic (DTL), part of the first IC family offered in a plastic DIP package. The article explains the chip's construction from bipolar transistors, diodes, and serpentine resistors, as well as how DTL NAND gates operate. Notably, the same silicon die was reused for at least three different chips (the 680A, 670A, and 616A) by applying different metal layers, a cost-saving technique Signetics used for both semi-custom and standard ICs.
AI 摘要This article examines the Intel 8087, a 1980 floating-point coprocessor that dramatically sped up arithmetic in the IBM PC, focusing on how its microcode and circuitry implement floating-point addition and subtraction. By decapping the chip and studying its die, the author explains key components such as the microcode ROM, the 80-bit datapath, the 69-bit integer adder, and the bit shifter. It also walks through the algorithm: aligning exponents by shifting significands, performing integer addition or subtraction, normalizing the result, and handling special cases like zero results, negative outcomes, infinities, and denormalized values.
AI 摘要The author analyzed a mysterious Harris IC labeled 'F1-10-5' and identified it as Harris's 1985 version of the MF10 switched-capacitor filter chip from National Semiconductor. The chip implements analog filters by rapidly switching 72 small polysilicon capacitors in and out of the circuit with CMOS switches, replacing resistors so that filter accuracy depends on stable capacitance ratios and a precise clock frequency rather than on-chip component values. Using a state variable filter design with three op-amps per filter, the chip provides high-pass, band-pass, and low-pass outputs while employing isolation rings, shield layers, and other techniques to suppress clock switching noise.
AI 摘要The article describes how the author reverse-engineered Intel's vintage 8087 floating-point chip—by examining its die and microcode—to explain the algorithm behind its FPTAN tangent instruction. The 8087 combined the CORDIC algorithm (16 iterations using precomputed special angles) with a Padé approximant rational polynomial (3x/(3-x²)) applied to the tiny residual angle, achieving 64-bit accuracy while avoiding a costly division since the instruction returns separate numerator and denominator values. The three-phase process—pseudo-division to determine CORDIC decision bits, rational approximation of the remaining angle, and pseudo-multiplication to apply the rotations—let the chip compute a tangent in 90 microseconds versus 13,000 microseconds on the 8086.
AI 摘要This article examines the magnetic core memory module from the Mitra 125 MS, the French-built minicomputer used in the 1980 Spacelab laboratory flown aboard the Space Shuttle. It explains how core memory works—storing bits in tiny ferrite rings using coincident current addressing, with sense, inhibit, and diode matrix circuitry for reading and writing data. The Spacelab computer's 128 KB of RAM was spread across four core plane boards holding 18-bit words, making it a notably advanced and high-density core memory design for its late date.