Analyzing the FScale Instruction in Intelβs 8087 FPU
During his continuing analysis of the architecture and microcode of Intelβs highly influential 8087 floating point unit (FPU) co-processor, [Ken Shirriff] has now arrived at the point where he can put together how the 8087βs microcode implements various x87 instructions. One of these, the FSCALE instruction turned out to be far more complicated than assumed, with one might assume to be a straightforward powers-of-two scaling turning out to entail over 140 micro-instructions and three levels of sub-routine calls just to handle all cases.
The annotated die shot in the heading image shows the functional blocks that are used by this one x87 instruction, to give some kind of idea of what amount of hardware even βjustβ scaling a floating point number involves.
Much like with the x86βs CISC-style ISA, these 8087 instructions break down into individual steps that involve everything from loading values into registers, performing operations, checking for and handling error conditions as well as stack management. As can be seen in [Ken]βs breakdown of the FSCALE implementation in the 8087 itβs all very logical, taking a high-level instruction and doing all thatβs needed for a robust implementation, without bothering the developer with the details.
Of note is that the 8087βs implementations led to the IEEE 754 floating point standard, providing what definitely at the time was one of the most mathematically accurate FPUs that somehow still was financially responsible enough to make it into a relatively affordable PC.