Heading:qjk40(635) Mesa Floating Point Implementation Notesy756qjk40 Page Numbers: Yes X: 527 Y: 10.5"qjk40 DRAFT - DRAFT - DRAFT - DRAFTz18592l4445y748c\f5b DRAFT - DRAFT - DRAFT - DRAFTz18592l4445y14c\f5b Inter-Office Memorandumz18592l4445y762\f5b To Mesa Floating Point Implementors Date July 9, 1980z18592l4445d2998e21(0,65535)(1,4445)(5,11684)(6,14146)\f1 2f0t2 1t0 32t6 1f1t0 4f0t7 1t0 z18592l4445 From L. Stewart Location Palo Altoz18592l4445d2998y716e25\f1 4f0t2 1t0 10t6 1f1t0 8f0t7 1t0 Subject Mesa Floating Point Organization PARC/CSLz18592l4445d2998e25\f1 7f0t2 1t0 19t6 1f1t0 12f0t7 1t0 Hintsz18592l4445 XEROX z18592l508y644e14(2116)\f2 5f0 Filed on: [Maxc]MesaFPImpl.bravoe30 e10 Introductione12jk40\b12B This memo presents some discussion of the implementation of Mesa 6 floating point.e12jk40 Instructionse12jk40\b12B MISC opcodes are used for Mesa 6 floating point. Here is the appropriate section of FPMiscAlpha.mesae12jk40 alpha: TYPE = [0..400B); -- Floating Point aFADD: alpha = 20B; aFSUB: alpha = 21B; aFMUL: alpha = 22B; aFDIV: alpha = 23B; aFCOMP: alpha = 24B; aFIX: alpha = 25B; aFLOAT: alpha = 26B; aFIXI: alpha = 27B; aFIXC: alpha = 30B; aFSTICKY: alpha = 31B; aFREM: alpha = 32B; aROUND: alpha = 33B; aROUNDI: alpha = 34B; aROUNDC: alpha = 35B; aSETS: alpha = 36B;l4269e12jk40\f7 Add, Subtract, Multiply, Divide, and Remainder take two REALs on the stack (4 words) and return one REAL (2 words).e12jk40 Compare takes two REALS and returns an INTEGER (1 word).e12jk40 Fix and Round take one REAL and return a LONG INTEGER (2 words).e12jk40 Float takes one LONG INTEGER and returns a REAL.e12jk40 FixI, FixC, RoundI, and RoundC take one REAL and return either an INTEGER or a CARDINAL (1 word in either case).e12jk40 SETS sets the FP package sticky flags from 1 word on the stack, it returns nothing.e12jk40 FSTICKY takes one word and returns one word. It is used to set and read the microcode copy of the inexactResult sticky flag and the microcode copy of the inexactResult trap enable.e12jk40 Runtimee12jk40\b7B Because of the complexity of the Ieee FP standard, the microcode does not handle all the 'defficult' cases. Roughly speaking, the microcode should handle operands which are normal numbers or which are true zero. The microcode should handle normal rounding. The microcode should handle the inexact result trap and sticky flag. All other cases, including denormalized operands, infinities, Not-A-Numbers, and exceptions, should be handled by trapping to Mesa code.e12jk40 Whenever the microcode finds unreasonable operands or otherwise gets into trouble, or encounters an unimplemented instruction, it should push the MISC alpha byte on the stack and trap through SD[137B]. The module [Ivy]Real>IeeeControl.mesa includes a procedure called FError which is accessed by SD[137B]. This procedure is called with a variable number of words on the stack. It uses the STATE construct in mesa to execute the Dump State instruction and then examines the stack to figure out what to do. FError dispatches on the alpha byte of the faulted instruction (left on top of the stack), picks up the original operands (the microcode must not disturb them!) and re-executes the faulted operation in Mesa. When the Mesa operation returns to FError, the results are stored in the state vector and the RETURN WITH state construct is used to return a variable number of words (depending on the instruction which faulted) to the client which executed the original instruction.e12jk40 In the case of the standard operations, the interface RealOps.mesa and inplementing modules provide FP operations that do handle all the funny cases.e12jk40\119i2I Altoe12jk40\b4B There are two sets of Alto microcode on [Ivy]Real>. Float6ni.mu does not do any work. It always traps to Mesa. In fact, rather than push the alpha byte on the stack, it is directly stuffed into stk4 and the stack pointer set to 5. This works because there are never more than 4 operands for a floating point instruction and because FError inspects the stack pointer to find the alpha byte, but works from stack[0] upwards to find the operands.e12jk40\101i6I Float6.mu actually implements most of the operations. Remainder and the Round instructions are not implemented.e12jk40 Referencese12jk40\b10B Definitions files:e12jk40 [Ivy]Real>FPMiscAlpha.mesal4269e6jk40 [Ivy]Real>Real.mesal4269jk40 [Ivy]Real>RealOps.mesal4269jk40 Implementations:e12jk40 [Ivy]Real>IeeeControl.mesal4269e6jk40 [Ivy]Real>Float6ni.mul4269jk40 [Ivy]Real>Float6.mul4269jk40 e12jk40 e12j