Intel 8087 Math Coprocessor
|Marketed by||Intel, IBM|
|Max. CPU clock rate||4 MHz to 10 MHz|
|Min. feature size||3 μm|
|Instruction set||x87 (coprocessor extension of x86-16)|
The purpose of the 8087 was to speed up computations for floating-point arithmetic, such as addition, subtraction, multiplication, division, and square root. It also computed transcendental functions such as exponential, logarithmic or trigonometric calculations, and besides floating-point it could also operate on large binary and decimal integers. The performance enhancements were from approximately 20% to over 500%, depending on the specific application. The 8087 could perform about 50,000 FLOPS using around 2.4 watts. Only arithmetic operations benefited from installation of an 8087; computers used only with such applications as word processing, for example, would not benefit from the extra expense (around $150 ) and power consumption of an 8087.
The sales of the 8087 received a significant boost when IBM included a coprocessor socket on the IBM PC motherboard. Development of the 8087 led to the IEEE 754-1985 standard for floating-point arithmetic. There were later x87 coprocessors for the 80186 (not used in PC-compatibles), 80286, 80386, and 80386SX processors. Starting with the 80486, the later Intel x86 processors did not use a separate floating point coprocessor; floating point functions were provided integrated with the processor.
Design and development
Intel had previously manufactured the 8231 Arithmetic processing unit, and the 8232 Floating Point Processor. These were designed for use with 8080 or similar processors and used an 8-bit data bus. They were interfaced to a host system either through programmed I/O or a DMA controller.
The 8087 had 45,000 transistors and was manufactured as a 3 μm depletion load HMOS circuit. It worked in tandem with the 8086 or 8088 and introduced about 60 new instructions. Most 8087 assembly mnemonics begin with F, such as FADD, FMUL, FCOM and so on, making them easy distinguishable from 8086 instructions. The binary encodings for all 8087 instructions begin with the bit pattern 11011, decimal 27, the same as the ASCII character ESC although in the higher order bits of a byte; similar instruction prefixes are also sometimes referred to as "escape codes". When the 8088 saw the escape code, it would defer to the 8087 until it was ready.
The codes are encoded in 6 bits across 2 bytes, beginning with the escape sequence:
The first three x's are the first three bits of the floating point opcode. Then two m's, then the latter half three bits of the floating point opcode, followed by three r's. The m's and r's specify the addressing mode information. 
Application programs had to be written to make use of the special floating point instructions. At run time, software could detect the coprocessor and use it for floating point operations. When detected absent, similar floating point functions had to be calculated in software or the whole coprocessor could be emulated in software for more precise numerical compatibility.
The x87 family does not use a directly addressable register set such as the main registers of the x86 processors; instead, the x87 registers form an eight-level deep stack structure ranging from st0 to st7, where st0 is the top. The x87 instructions operate by pushing, calculating, and popping values on this stack. However, dyadic operations such as FADD, FMUL, FCMP, and so on may either implicitly use the topmost st0 and st1, or it may use st0 together with an explicit memory operand or register; the st0 register may thus be used as an accumulator (i.e. as a combined destination and left operand) and can also be exchanged with any of the eight stack registers using an instruction called FXCH stX (codes D9C8..D9CFh). This makes the x87 stack usable as seven freely addressable registers plus an accumulator. This is especially applicable on superscalar x86 processors (Pentium of 1993 and later) where these exchange instructions are optimized down to a zero clock penalty.
IEEE floating point standard
When Intel designed the 8087, it aimed to make a standard floating-point format for future designs. An important aspect of the 8087 from a historical perspective was that it became the basis for the IEEE 754 floating-point standard. The 8087 did not implement the eventual IEEE 754 standard in all its details, as the standard was not finished until 1985, but the 80387 did. The 8087 provided two basic 32/64-bit floating-point data types and an additional extended 80-bit internal temporary format (that could also be stored in memory) to improve accuracy over large and complex calculations. Apart from this, the 8087 offered an 80-bit/18-digit packed BCD (binary coded decimal) format and 16, 32, and 64-bit integer data types.
|8087 Data Types|
|±||Exponent||Fraction||80-bit extended-precision real|
|±||Exponent||Fraction||64-bit double-precision real|
|±||Exponent||Fraction||32-bit single-precision real|
|±||BCD Integer||18-digit decimal integer|
|Integer||64-bit binary integer|
|Integer||32-bit binary integer|
|Integer||16-bit binary integer|
The 8087 differed from subsequent Intel coprocessors in that it was directly connected to the address and data buses. The 8088/86 looked for instructions that commenced with the '11011' sequence and relinquished control to the coprocessor. If there was a memory address in the operand, the 8088/86 retrieved the data for the 8087. The coprocessor handed control back once the sequence of coprocessor instructions ended. There was a potential crash problem if the coprocessor instruction failed to decode to one that the coprocessor understood. Intel's later coprocessors did not connect to the buses in the same way, but were handed the instructions by the main processor. This yielded an execution time penalty, but the potential crash problem was avoided because the main processor would ignore the instruction if the coprocessor refused to accept it. The 8087 was able to detect whether it was connected to a 8088 or a 8086 by monitoring the data bus during the reset cycle.
The 8087 was capable of working concurrently while the 8088 processes additional instructions. This could either lead to efficient operation, or erroneous results, if not accounted for. 
Models and second sources
Intel 8087 coprocessors were fabricated in two variants, one with ceramic side-brazed DIP (CerDIP) and one in hermetic DIP (PDIP), and were designed to operate in the following temperature ranges:
- C, D, QC and QD prefixes: 0°C - 70°C (Commercial use).
- LC, LD, TC and TD prefixes: -40 to 85°C (Industrial use).
- MC and MD prefixes: -55°C - 125°C (Military use).
All models of the 8087 had a 40 pin DIP package and operated on 5 volts, consuming around 2.4 watts. Unlike later Intel coprocessors, the 8087 had to run at the same clock speed as the main processor. Suffixes on the part number identified the clock speed:
|Intel 8087||5 MHz|
|Intel 8087-1||10 MHz|
|Intel 8087-2||8 MHz|
|Intel 8087-3||4 MHz|
|Intel 8087-6||6 MHz|
Just as the 8088 and 8086 processors were superseded by later parts, so was the 8087 superseded. Other Intel coprocessors were the 80287, 80387, and the 80187. Starting with the 80486, the later Intel processors did not use a separate floating point coprocessor; virtually all included it on the main processor die, with the significant exception of the 80486SX (which had no FPU option; an 80487SX was sold which was a complete 80486DX CPU and disabled the original 486SX if installed.) The 80487 was in fact a full blown i486DX chip with an extra pin. The 80486DX, Pentium, and later processors include floating-point functionality on the CPU core.
- Shvets, Gennadiy (8 October 2011). "IBM 8087 floating-point unit". CPU World. Retrieved 1 December 2011.
- Shvets, Gennadiy (8 October 2011). "AMD 8087 floating-point unit". CPU World. Retrieved 1 December 2011.
- Shvets, Gennadiy (8 October 2011). "Cyrix 8087 floating-point unit". CPU World. Retrieved 1 December 2011.
- "8087". Coprocessor Dot Info. 2007. Retrieved 1 December 2011.
- "Intel FPU". cpu-collection.de. 2011. Retrieved 1 December 2011.
- Scott Mueller, Upgrading and repairing PCs, second edition, Que Books, 1992 ISBN 0-88022-856-3, pages 395-403
- Intel Component Data Catalog 1980, Intel catalog no. C-864/280/150K/CP, pages 8-21, 8-28
- Assembly Language and Systems Programming for the IBM PC and Compatibles, Karen A. Lemone, page 302
- Shvets, Gennadiy (8 October 2011). "Intel 8087 family". CPU World. Retrieved 1 December 2011.
- Assembly Language and Systems Programming for the IBM PC and Compatibles, Karen A. Lemone, p300
- Frolov, Sergej (10 October 2006). "USSR-made i8087 clone". CPU World. Retrieved 1 December 2011.
- Intel 80x87 math coprocessors at cpu-collection.de
- Coprocessor.info: 8087 math coprocessor history information and pictures
- Datasheet for the Intel 8087 Math Coprocessor