7 ms·
I plan to write more about the 8087. Are there any topics that you (HN readers) would be most interested in?
by kens 8y ago
I plan to write more about the 8087. Are there any topics that you (HN readers) would be most interested in?
- valarauca1 8y agoGreat article. If you could over the 8008 and 4004 that'd be awesome :D
- kens 8y agoI've taken die photos of the 8008 and written some articles about it: http://www.righto.com/search/label/8008 http://www.righto.com/search/label/8008 There's a bunch of stuff on the 4004 at 4004.com
- teh_klev 8y agoAnything really, it's always good stuff :)
- simonbyrne 8y agoI'd be keen to know more about how the transcendental instructions worked.
- kens 8y agoI plan to write about that, but the short answer is that the 8087 computes transcendental functions using CORDIC. The chip contains constants atan(2^0), ..., atan(2^-15). It operates a bit at a time using these constants to compute tan and arctan. It doesn't natively support sine and cosine, but these can be computed from the tangent. Likewise, the constants log2(1+2^(-2)), ..., log2(1+2^(-15)) are used for logarithm and exponentiation. https://en.wikipedia.org/wiki/CORDIC https://en.wikipedia.org/wiki/CORDIC Edit: the constant ROM is the vertical stripe in the lower left in the die photo. You can see each bit in the ROM as a green or purple rectangle: https://lh3.googleusercontent.com/-7S_Q0bzu-7A/W3RDsZwprvI/AAAAAAABTmQ/mUZVqFspfJEzvXyFJdQtA1AOBdKcCFDJACHMYBhgL/w9999/stripped.jpg https://lh3.googleusercontent.com/-7S_Q0bzu-7A/W3RDsZwprvI/A...
- deleted 8y ago[deleted]
- cmroanirgo 8y ago> It doesn't natively support sine and cosine, but these can be computed from the tangent. I'd not ever looked into it, but that neatly explains the existence of the sincos instruction.
- bonzini 8y agosincos is useful in general. Rotations for example often need sine and cosine of the same angle. Because transcendental functions are implemented as a microcode loop, a sincos instruction lets you cut in half the loop overhead. If the overhead were 50% (e.g. 100 cycles arithmetic and 50 cycles overhead) you could cut sincos to 250 cycles, for an overhead of only 25%.
- userbinator 8y agoCORDIC is itself a very interesting algorithm due to its conceptual simplicity: a vector rotation using successive approximations. When stripped down to its essentials, it forms the basis of a surprisingly simple circle-drawing algorithm: https://nbickford.wordpress.com/2011/04/03/the-minsky-circle-algorithm/ https://nbickford.wordpress.com/2011/04/03/the-minsky-circle... (Previously also discussed here at https://news.ycombinator.com/item?id=15266331 https://news.ycombinator.com/item?id=15266331 )
- dabockster 8y agoWhat kind of chiller you have to use to cool it. EDIT: Oh, I'm thinking of the new 8086k. Never mind.
- tropo 8y agoExplain why they wasted effort and silicon on insanity: The 80-bit format has an explicit 1, unlike the normal IEEE float and double. The chip has BCD support. There was that idea that the OS would emulate an infinite FP stack via an exception handler. There was that idea that the OS would emulate more exponent bits via an exception handler messing with the exponents. The exceptions for imprecise results seem so useless. We got an 80-bit format, but no 16-bit or 128-bit format. Don't we like powers of two?
- simonbyrne 8y agoI recall seeing a comment by Will Kahan that 80-bit bit was intended as an intermediate step: the intention was to eventually go to 128-bit. Also this was still early days: up until this point, fast floating point was the domain of much more expensive machines. No one had any idea what would be useful in consumer level hardware.
- kens 8y agoMany of your questions are discussed in detail in "The 8087 Primer" [1] but I'll give a quick summary. (I'm not defending their design decisions, just providing what I've read.) > The 80-bit format has an explicit 1, unlike the normal IEEE float and double. Apparently the explicit 1 made the hardware much simpler, and with 80 bits it doesn't cost you much to have an explicit 1. (To explain for others: in the normal float format, the first bit of the mantissa is assumed to be a 1, so this bit is not explicitly stored. This gains you a "free" bit of precision. But then you needs special handling for zero and denormalized numbers because the first bit isn't a 1. The 8087 stores numbers internally using the 80 bit format for increased accuracy. The 80 bit format stores the first bit explicitly, whether it is a 0 or 1.) > The chip has BCD support. BCD was a big thing in the 1970s; look at all the effort in the 6502 for BCD support, for instance. My hypothesis is that cheap memory killed off the benefit of packing two digits in a byte. > We got an 80-bit format, but no 16-bit or 128-bit format. They did a lot of mathematical analysis to decide that 80 bits for the internal number format would result in accurate 64 bit results. Something about losing lots of bits of accuracy during exponentiation, so you want extra bits the size of the exponent. > Don't we like powers of two? Looking at old computers has shown me that word sizes that are powers of two are really just a custom, not a necessity. In the olden days, if your missile needed 19 bits of accuracy to hit its target, you'd build a computer with 19 bit words. And if your instruction set fit in 11 bits, you'd use 11 bit instructions. Using bytes and larger powers of two for words became popular after Stretch and the IBM 360, but other sizes work just fine. [1] https://archive.org/details/8087primer00palm https://archive.org/details/8087primer00palm
- duskwuff 8y agoThe interaction between the 8087 and the host CPU. From what I understand, the way this works is kind of strange...
- dan_hawkins 8y agoThe basic idea was that FP instruction generated interrupt and set external bus to a specific state. If there was no HW FPU interrupt handler could emulate FPU in software. If there was FPU it would use CPU's dedicated signal to get activated and then read CPU bus to get details about opcode and parameters and execute it.
- pwg 8y agoI heard somewhere (long long ago, no references to point towards) that some portion of the 8087 used tri-valued logic (3 valued, as in base-3 numbers). If that was the case then an article geared towards that part of the chip design would be interesting.
- kens 8y agoI'm pretty sure there's no base-3 used in the 8087. On the other hand, multiplication is essentially base-4. It uses the standard shift-and-add cycle but multiplies by a pair of bits each step so it goes twice as fast. There are some clever tricks to make this work.
- userbinator 8y agoI think that commenter may have confused it with the 2-bit-per-cell ROM that it has: https://en.wikipedia.org/wiki/Multi-level_cell#Multi-level_cell https://en.wikipedia.org/wiki/Multi-level_cell#Multi-level_c... "For example the Intel 8087 used two-bits-per-cell technology, and in 1980 was one of the first devices on the market to use multi-level ROM cells.[9][10]" ...and indeed I thought this article would have a mention of it. Certainly interested in any more exploration you can do about that.
- pwg 8y agoThat is very likely what I was remembering. As I said, this was long ago (as in 30+ years ago) so I very well may have been remembering this multi-level ROM setup and mixing it up with three valued logic. I do concur that this would be an interesting topic for another post.
- kens 8y agoI read out the constants from the ROM earlier and it was just a normal ROM, so I was skeptical about your comment. But what do you know, I just took a closer look at the microcode ROM and there are indeed 4 different transistor sizes! I hadn't even noticed, so thanks for mentioning this. This will be annoying if I try to visually read out the microcode values since I'll need to examine each transistor closely. It was quick to read out the constant ROM since I just needed to glance to see if a transistor was present or not. Here's a photo of a 7x5 region of the microcode ROM to help the discussion. The transistors (representing bits) are where the vertical polysilicon lines cross the pinkish doped silicon. Note that the "neck" is full-width, narrowed, very narrow, or entirely gone (no transistor), corresponding to the 4 values. Image link: https://photos.app.goo.gl/pUsZSs3rx45Ry7U1A https://photos.app.goo.gl/pUsZSs3rx45Ry7U1A
- Severian 8y agoFWIW, your blog is amazing. I really like the links you provide in the footnotes for additional information.
- brandmeyer 8y agoThanks for doing this! What did they use microcode for in the 8087? How were the functional units on the die arranged? It looks like that column above and to the right of the "8087" logo could be a shifter. How many metal layers under the transistors are there for routing around the die?
- kens 8y agoI'm still figuring out the microcode. It looks like about 4K x 16 bits. The functional units are arranged with the 64-bit mantissa datapath at the bottom and the 16-bit exponent on top. The mantissa functional units have the constants at the left, then the bidirectional shifter, then the ALU, then a 2-bit and 1-bit shifter (for multiplication, etc), then three temporary registers, then register buffers and finally the 8 stack registers. The most significant bit is at the bottom. (Which is backwards to how it is stored with the most significant bit next to the exponent.) You are correct that above the 8087 logo (to the left and a fair bit to the right) is a shifter. Above is a 0-8 bit shifter and to the right is 0/8/16/.../64 bit shifter. Combined, they allow any bit shift. It's bidirectional (with buffers/drivers on both sides), so you put the bits through one way to shift left and the other way to shift right. (Shifting is a big part of floating point. For instance, to add or subtract, you need to shift the numbers so the decimal points line up. And then you need to shift the results to be normalized.) As far as layers: The bottom is silicon and doped silicon. The polysilicon for wiring / gates is above. On top is a single layer of metal. The metal and polysilicon are used for routing. Typically metal is mostly vertical and polysilicon is mostly horizontal or vice versa, but there are lots of exceptions. Metal is preferred for long routes (and power) because it has much lower resistance.
- brandmeyer 8y ago> [The shifter is] bidirectional (with buffers/drivers on both sides), so you put the bits through one way to shift left and the other way to shift right. Wait, really? I'm used to seeing mux circuits like the following, which incur a wee bit of gate delay per stage. http://www.vlsitechnology.org/html/cells/vsclib013/mxi2.html http://www.vlsitechnology.org/html/cells/vsclib013/mxi2.html http://www.vlsitechnology.org/html/cells/vsclib013/mxn2.html http://www.vlsitechnology.org/html/cells/vsclib013/mxn2.html
- substrateBias 8y agoI feel like there was a lot of heavy bias toward the substrate in this write-up. I was hoping for more detail on the sequence of events, as operations cascade through the transistor architecture, to resolve input values to a result. For example, if arithmetic operations are fairly objective, why is microcode needed in between the processor logic and the user-facing pinouts? Or is the microcode not adjustable firmware, but rather a fixed set of routing options to engage components appropriately for a given operation?
- kens 8y agoYes, this article was 100% focused on the substrate bias generator, since I wanted to start with a self-contained piece. I realize it's a bit of a strange focus, but hopefully it was interesting. As far as the microcode, I'm not sure I understand your question. The microcode is fixed firmware, stepping the 8087 through the procedure for complex operations such as logarithm. Essentially, the microcode has mini-programs that the 8087 runs to perform its functions. I'm still researching how the microcode is actually implemented.
- fapjacks 8y agoI'm interested in everything you write about. Thank you!