[HN Gopher] Extracting ROM constants from the 8087 math coproces...
       ___________________________________________________________________
        
       Extracting ROM constants from the 8087 math coprocessor's die
        
       Author : matt_d
       Score  : 81 points
       Date   : 2020-05-16 17:13 UTC (5 hours ago)
        
 (HTM) web link (www.righto.com)
 (TXT) w3m dump (www.righto.com)
        
       | userbinator wrote:
       | The exponents may be implied by how the microcode uses them,
       | somewhat like how fixed-point maths assumes the position of the
       | decimal(binary) point.
        
       | bonzini wrote:
       | The 8087 emulation did not work exactly as described in footnote
       | 1. Instead of writing 8087 instructions, the compiler wrote INT
       | (software interrupt, often used for system or runtime calls)
       | instructions. The first opcode of 8087 instructions only has
       | eight possible values so you could for example use eight software
       | interrupt vectors to encode the opcode into the second byte of
       | the INT instruction.
       | 
       | If an 8087 was present, the interrupt handler simply patched in
       | place the INT instruction, replacing it with an 8087 instruction.
       | If the math coprocessor was absent, instead, the interrupt
       | handler decoded the subsequent instruction bytes from the
       | instruction stream and performed software emulation. All this was
       | needed because the 8088 and 8086 didn't have undefined opcode
       | exceptions!
        
       | madengr wrote:
       | What's ln(2)/3 used for?
       | 
       | Back in EE school in 1991, I installed an 8087 in my PC. The
       | speed-up running Micro-CAP 3 was amazing, as a simple BJT CE amp
       | sim only took a few minutes. Of course then I moved to a 486 and
       | that same sim was finished before the mouse button lifted.
       | 
       | There has been an amazing amount of progress since then, but my
       | PC is still too slow, as the simulations only get larger.
        
         | kens wrote:
         | I couldn't figure out any explanation for that constant. If I
         | had to guess, maybe some optimization for the base-2 log/exp
         | CORDIC algorithm, like a polynomial approximation of base-2 log
         | for the small remainder from CORDIC. The dividing by 3 might
         | come from the Taylor series.
        
       | kens wrote:
       | The 8087's microcode ROM is very unusual because it stores two
       | bits per transistor for higher density. The ROM uses four
       | transistor sizes so each position outputs one of four voltages,
       | which are converted to two bits.
       | 
       | (This is separate from the constant ROM, which is a normal one-
       | bit-per-transistor ROM.)
        
         | klelatti wrote:
         | Thank you for this tremendous piece of silicon detective work.
         | Really hope that that there are further instalments to come,
         | for example covering the microcode.
         | 
         | Just to highlight too that footnote 1, describing the lengths
         | that the Intel engineers had to go to ensure that interaction
         | between the 8086 and the 8087 worked, is fascinating.
        
         | bonzini wrote:
         | Ken, could the two 10^18 constants have two different signs?
         | The signs must be stored somewhere like the exponents. Since
         | most bits are zero for both signs and exponents, does it make
         | sense for them to be coded as Boolean functions instead of
         | being stored in a ROM?
        
           | kens wrote:
           | I actually wrote that idea (two different signs) in the post
           | but took it out :-) My thinking is that the hardware must
           | support negation, so it would save space to have one constant
           | and negate it instead of two constants with different signs.
           | 
           | I'm still investigating the chip, so I hope to find the
           | exponent ROM (or Boolean logic as you suggest) and solve this
           | puzzle.
        
         | mbroncano wrote:
         | Thanks for the article Ken. I'd like to remark the small
         | refresher on how transistors works, it makes up for a really
         | pleasant read. Also the footnotes are actually useful in
         | decluttering the articles but amenable and clear to read.
        
       | abotsis wrote:
       | "After more thought, I determined that the rows do not alternate
       | but are arranged in a repeating "ABBA" pattern." ... which
       | differs from Konami develops, who used a "BA" pattern in their
       | roms.
       | 
       | Sorry, couldn't resist. My brain did a thing.
        
       ___________________________________________________________________
       (page generated 2020-05-16 23:00 UTC)