DIRECTORY Rope, PrincOps; TamDefs: CEDAR DEFINITIONS = BEGIN numFrames: NAT = 6; numWordsPerFrame: NAT = 48; Word: TYPE = PACKED ARRAY FiveBitIndex OF BOOL; ZerosWord: Word = LOOPHOLE[LONG[0]]; OnesWord: Word = LOOPHOLE[LONG[-1]]; wordsPerPage: CARDINAL = 1024; bytesPerWord: CARDINAL = 4; charsPerWord: CARDINAL = 4; bitsPerByte: CARDINAL = 8; bitsPerCharacter: CARDINAL = 8; bitsPerWord: CARDINAL = bitsPerByte*bytesPerWord; bytesPerPage: CARDINAL = wordsPerPage*bytesPerWord; logWordsPerPage: CARDINAL = 10; -- LogBase2[wordsPerPage] logBitsPerByte: CARDINAL = 3; --LogBase2[bitsPerByte] logBitsPerChar: CARDINAL = 3; --LogBase2[bitsPerCharacter] logBytesPerWord: CARDINAL = 1; --LogBase2[bytesPerWord] logCharsPerWord: CARDINAL = 1; --LogBase2[bytesPerWord] logBitsPerWord: CARDINAL = logBitsPerByte + logBytesPerWord; logBytesPerPage: CARDINAL = logBytesPerWord + logWordsPerPage; PageCount: TYPE = INT; PageNumber: TYPE = INT; maxPagesInVM: PageCount = LONG[4]*LONG[1024]*LONG[1024]; OneBitIndex: TYPE = [0..1]; TwoBitIndex: TYPE = [0..3]; ThreeBitIndex: TYPE = [0..7]; FourBitIndex: TYPE = [0..16); FiveBitIndex: TYPE = [0..32); SixBitIndex: TYPE = [0..64); SevenBitIndex: TYPE = [0..128); TwoWords: TYPE = ARRAY [0..1] OF Word; Half: TYPE = PACKED ARRAY FourBitIndex OF BOOL; ZerosHalf: Half = LOOPHOLE[0]; OnesHalf: Half = LOOPHOLE[-1]; FourHalves: TYPE = ARRAY [0..3] OF Half; TwoHalves: TYPE = ARRAY [0..1] OF Half; Byte: TYPE = PACKED ARRAY ThreeBitIndex OF BOOL; ZerosByte: Byte = LOOPHOLE[0]; OnesByte: Byte = LOOPHOLE[377B]; EightBytes: TYPE = PACKED ARRAY [0..7] OF Byte; FourBytes: TYPE = PACKED ARRAY ByteIndex OF Byte; ByteIndex: TYPE = [0..bytesPerWord); BytesPerWord: NAT = 4; TwoBytes: TYPE = PACKED ARRAY [0..1] OF Byte; Comparison: TYPE = MACHINE DEPENDENT {less(0), equal(1), greater(2)}; ByteAddress: TYPE = RECORD [Word]; WordAddress: TYPE = RECORD [Word]; TaggedWord: TYPE = RECORD [tag: TwoBitIndex, data: Word]; XBitRec: TYPE = RECORD [refcount: FourBitIndex, cdr: TwoBitIndex]; FullWord: TYPE = RECORD [xBits: XBitRec, tagWord: TaggedWord]; ZeroTaggedBus: TaggedWord = [tag: 0, data: ZerosWord]; ZeroFullBus: FullWord = [[refcount: 0, cdr: 0], [tag: 0, data: ZerosWord]]; UCodeWord: TYPE = RECORD [ rCxt, wCxt, newTopCxt, newBotCxt, altCxt, cycle, memOp, euOp, tag, rd1addr, rd2addr, w2addr, dswap, raddr, waddr, newArg, newArg2, newTos, k, k2, dpCondRes, muxCondRes, euCondRes, memCondRes, writeT, writeF, jumpT, jumpF, opLength, misc: NAT ]; DPCondCodeWord: TYPE = RECORD [tag: [0..3], word: CARD]; DPCondCodeRec: TYPE = RECORD [d1, nD1, d2, nD2, d1XorD2: DPCondCodeWord]; ClockRec: TYPE = MACHINE DEPENDENT RECORD [ clock (0: 00..00): BOOL _ FALSE, clock2 (0: 01..01): BOOL _ FALSE, clockstate (0: 02..02): BOOL _ FALSE, writeOk (0: 03..03): BOOL _ FALSE, done (0: 04..04): BOOL _ FALSE, stall (0: 05..05): BOOL _ FALSE ]; StackFrame: TYPE = MACHINE DEPENDENT { frameHead (0), -- beginning of Stack Frame pvarExt (7), -- pvar overflow (extension) slot varsEnd (15), -- end of vars space stackPtr (16), -- Stack ptr. word pc (17), -- PC nameTable (18), -- name table entry funHeader (19), -- Function Header entry cLink (20), -- clink entry stackStart (21), -- start of additional vars or stack stackEnd (numWordsPerFrame) }; ProcessorRegister: TYPE = MACHINE DEPENDENT { cxtZero (0), -- starting address for context 0 (global) cxtOne (64), -- starting address for context 1 cxtTwo (128), -- starting address for context 2 cxtThree (192), -- starting address for context 3 cxtFour (256), -- starting address for context 4 cxtFive (320), -- starting address for context 5 cxtGlobal (384), -- starting address for global context lastReg (407), -- last real processor reg curPC (408), -- last committed pc nextPC (409) }; StackedStatusWord: TYPE = MACHINE DEPENDENT RECORD [ version (0: 00..07): [0..255] _ 0, padBits (0: 08..13): [0..63] _ 0, userMode (0: 14..14): BOOL _ FALSE, -- TRUE => user, FALSE => kernel trapsEnabled (0: 15..15): BOOL _ FALSE, padByte (0: 16..23): [0..255] _ 0, lBase (0: 24..31): [0..255] _ 0 ]; -- EU local frame base EuUnits: TYPE = MACHINE DEPENDENT { NOP (0), Adder (1), LU (2), Shifter (3), Prior (4), LdMult (6), UnLdMult (7)}; LuOpType: TYPE = MACHINE DEPENDENT { tAND (1), tXOR (6), tOR (7), tNOR (8), tNAND (14)}; AdderOpType: TYPE = MACHINE DEPENDENT { tADD (0), tADDC (1), tSUB (8), tSUBC (9)}; EuControlRec: TYPE = MACHINE DEPENDENT RECORD [ euUnit (0: 00..02): EuUnits, euBits (0: 03..15): SELECT OVERLAID EuUnits FROM Adder => [adderOp (0: 03..15): AdderOpType], LU => [luOp (0: 03..15): LuOpType] ENDCASE ]; BytesToWord: PROC [fb: FourBytes] RETURNS [Word] = TRUSTED INLINE { RETURN[LOOPHOLE[fb, Word]]; }; BytesToHalf: PROC [tb: TwoBytes] RETURNS [Half] = TRUSTED INLINE { RETURN[LOOPHOLE[tb, Half]]; }; WordToBytes: PROC [w: Word] RETURNS [FourBytes] = TRUSTED INLINE { RETURN[LOOPHOLE[w, FourBytes]]; }; HalfToBytes: PROC [h: Half] RETURNS [TwoBytes] = TRUSTED INLINE { RETURN[LOOPHOLE[h, TwoBytes]]; }; HalvesToWord: PROC [th: TwoHalves] RETURNS [Word] = TRUSTED INLINE { RETURN[LOOPHOLE[th, Word]]; }; WordToHalves: PROC [w: Word] RETURNS [TwoHalves] = TRUSTED INLINE { RETURN[LOOPHOLE[w, TwoHalves]]; }; HighHalf: PROC [w: Word] RETURNS [Half] = TRUSTED INLINE { RETURN[LOOPHOLE[w, TwoHalves][0]]; }; LowHalf: PROC [w: Word] RETURNS [Half] = TRUSTED INLINE { RETURN[LOOPHOLE[w, TwoHalves][1]]; }; LeftHalf: PROC [w: Word] RETURNS [Half] = TRUSTED INLINE { RETURN[LOOPHOLE[w, TwoHalves][0]]; }; RightHalf: PROC [w: Word] RETURNS [Half] = TRUSTED INLINE { RETURN[LOOPHOLE[w, TwoHalves][1]]; }; SwapHalves: PROC [w: Word] RETURNS [Word] = TRUSTED MACHINE CODE { PrincOps.zEXCH; }; WordToInt: PROC [w: Word] RETURNS [INT] = TRUSTED MACHINE CODE { PrincOps.zEXCH; }; IntToWord: PROC [int: INT] RETURNS [Word] = TRUSTED MACHINE CODE { PrincOps.zEXCH; }; WordToCard: PROC [w: Word] RETURNS [CARD] = TRUSTED MACHINE CODE { PrincOps.zEXCH; }; HalfToCard: PROC [h: Half] RETURNS [CARDINAL] = TRUSTED INLINE { RETURN [LOOPHOLE[h, CARDINAL]]; }; ByteToCard: PROC [b: Byte] RETURNS [[0..255]] = TRUSTED INLINE { RETURN [LOOPHOLE[b]]; }; CardToWord: PROC [card: CARD] RETURNS [Word] = TRUSTED MACHINE CODE { PrincOps.zEXCH; }; CardToHalf: PROC [card: CARDINAL] RETURNS [Half] = TRUSTED INLINE { RETURN [LOOPHOLE[card, Half]]; }; CardToByte: PROC [card: [0..255]] RETURNS [Byte] = TRUSTED INLINE { RETURN [LOOPHOLE[card, Byte]]; }; TamAnd: PROC [a,b: Word] RETURNS [Word] = INLINE { RETURN [HalvesToWord[[ HalfAnd[LeftHalf[a], LeftHalf[b]], HalfAnd[RightHalf[a], RightHalf[b]] ]]]; }; TamOr: PROC [a,b: Word] RETURNS [Word] = INLINE { RETURN [HalvesToWord[[ HalfOr[LeftHalf[a], LeftHalf[b]], HalfOr[RightHalf[a], RightHalf[b]] ]]]; }; TamXor: PROC [a,b: Word] RETURNS [Word] = INLINE { RETURN [HalvesToWord[[ HalfXor[LeftHalf[a], LeftHalf[b]], HalfXor[RightHalf[a], RightHalf[b]] ]]]; }; TamNot: PROC [w: Word] RETURNS [Word] = INLINE { RETURN [HalvesToWord[[ HalfNot[LeftHalf[w]], HalfNot[RightHalf[w]] ]]]; }; VanillaAdd: PROC [a,b: Word] RETURNS [Word] = INLINE { RETURN [IntToWord[WordToInt[a]+WordToInt[b]]]; }; VanillaSub: PROC [a,b: Word] RETURNS [Word] = INLINE { RETURN [IntToWord[WordToInt[a]-WordToInt[b]]]; }; AddDelta: PROC [delta: INT, w: Word] RETURNS [Word] = TRUSTED MACHINE CODE { PrincOps.zEXCH; PrincOps.zDADD; PrincOps.zEXCH; }; HalfNot: PROC [h: Half] RETURNS [nh: Half] = TRUSTED MACHINE CODE { PrincOps.zLIN1; PrincOps.zXOR }; HalfAnd: PROC [h0,h1: Half] RETURNS [h: Half] = TRUSTED MACHINE CODE { PrincOps.zAND; }; HalfOr: PROC [h0,h1: Half] RETURNS [h: Half] = TRUSTED MACHINE CODE { PrincOps.zOR; }; HalfXor: PROC [h0,h1: Half] RETURNS [h: Half] = TRUSTED MACHINE CODE { PrincOps.zXOR; }; HalfShift: PROC [h: Half, dist: INTEGER] RETURNS [Half] = TRUSTED MACHINE CODE { PrincOps.zSHIFT; }; DoubleWordShiftRight: PROC [w0, w1: Word, dist: SixBitIndex] RETURNS [Word] = TRUSTED INLINE { SELECT dist FROM < 16 => RETURN [HalvesToWord[[ HalfOr[HalfShift[LeftHalf[w0], -dist], HalfShift[RightHalf[w1], 16-dist]], HalfOr[HalfShift[RightHalf[w0], -dist], HalfShift[LeftHalf[w0], 16-dist]]]]]; ENDCASE => { RETURN [HalvesToWord[[ HalfOr[HalfShift[RightHalf[w1], 16-dist], HalfShift[LeftHalf[w1], 32-dist]], HalfOr[HalfShift[LeftHalf[w0], 16-dist], HalfShift[RightHalf[w1], 32-dist]]]]]; }; }; DoubleWordShiftLeft: PROC [w0,w1: Word, dist: SixBitIndex] RETURNS [Word] = TRUSTED INLINE { SELECT dist FROM < 16 => RETURN [HalvesToWord[[ HalfOr[HalfShift[LeftHalf[w0], dist], HalfShift[RightHalf[w0], dist-16]], HalfOr[HalfShift[RightHalf[w0], dist], HalfShift[LeftHalf[w1], dist-16]]]]]; ENDCASE => { RETURN [HalvesToWord[[ HalfOr[HalfShift[RightHalf[w0], dist-16], HalfShift[LeftHalf[w1], dist-32]], HalfOr[HalfShift[LeftHalf[w1], dist-16], HalfShift[RightHalf[w1], dist-32]]]]]; }; }; SingleWordShiftLeft: PROC [word: Word, dist: SixBitIndex] RETURNS [Word] = TRUSTED INLINE { SELECT dist FROM < 16 => RETURN [HalvesToWord[[ HalfOr[HalfShift[LeftHalf[word], dist], HalfShift[RightHalf[word], dist-16]], HalfShift[RightHalf[word], dist]]]]; ENDCASE => { RETURN [HalvesToWord[[HalfShift[RightHalf[word], dist-16], ZerosHalf]]]; }; }; SingleWordShiftRight: PROC [word: Word, dist: SixBitIndex] RETURNS [Word] = TRUSTED INLINE { SELECT dist FROM < 16 => RETURN [HalvesToWord[[ HalfShift[LeftHalf[word], -dist], HalfOr[HalfShift[LeftHalf[word], 16-dist], HalfShift[RightHalf[word], -dist]] ]]]; ENDCASE => { RETURN [HalvesToWord[[ZerosHalf, HalfShift[LeftHalf[word], 16-dist]]]]; }; }; END. ΖTamDefs.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. by Krivacic April 10, 1987 12:49:32 pm PST Last Edited by: Krivacic April 22, 1987 3:46:56 pm PST This interface consists entirely of type definitions for the architectural data structures for the Tamarin Lisp processor. Much of this is borrowed from [Indigo]DragOps>DragOpsCross.mesa with many thanks to Russ. Basic Types and Associated Values We would like to use ALL[FALSE], but the compiler is really stupid We would like to use ALL[TRUE], but the compiler is really stupid actually, [0..maxPagesInVM]; intended for use by VM actually, [0..maxPagesInVM); intended for use by VM 22-bit page index This type is the type to be returned from comparison operations. To be used to denote byte addresses, when the difference between bytes addresses and other words needs to be indicated. To be used to denote word addresses, when the difference between addresses and other words needs to be indicated. Register Numbers Processor Register Numbers (tentative) These assignments are to be used with the LIP, and SIP instructions. We use the ProcessorRegister declarations for both IFU and EU parts. There are actually more assignments than are accessible through these instructions. These are marked by (NA), which indicates that the decode is reserved for the register, but that the data paths to allow the register to be used are not present. Note: this numbering reflects the actual implementation of the decoding logic Tamarin unit conversions TamarinOps/PrincOps conversions Note: the Tamarin convention is to have the low order half word (16 bits) in the right half of the word (32 bits), while the Dorado convention is to have the low order word (16 bits) in the left half of the doubleword (32 bits). Word basic operations This procedure is a 32-bit AND This procedure is a 32-bit OR This procedure is a 32-bit XOR This procedure is a 32-bit XOR This procedure is just a convenience to add without carry or overflow. This procedure is just a convenience to subtract without carry or overflow. This procedure is a convenience to use when adding a small delta to a word. It is faster than using VanillaAdd directly. Halfword basic operations This procedure is just a convenience to invert a half word. This procedure is just a convenience to AND two half words. This procedure is just a convenience to OR two half words. This procedure is just a convenience to OR two half words. This procedure is just a half word shift left (if dist >= 0) or right (if dist <= 0). Shift utility inlines This procedure shifts two Tamarin words right by dist bits and returns the rightmost word. w1 is the ms word of the two word quantity (w0 is the ls word). This procedure shifts two Tamarin words left by dist bits and returns the leftmost word. This procedure shifts one Tamarin word left by dist bits and returns the shifted word. This procedure shifts one Tamarin word right by dist bits and returns the shifted word. Κ[˜™ Icode™K–0.8 in tabStops˜–0.8 in tabStopsšœ œœ˜K–0.8 in tabStopsšœ1™3—–0.8 in tabStopsšœ œœ˜K–0.8 in tabStopsšœ1™3—K–0.8 in tabStops˜–0.8 in tabStopsšœœœœ˜8K–0.8 in tabStopsšœ™—K–0.8 in tabStops˜Kšœ œ ˜Kšœ œ ˜Kšœœ ˜Kšœœ ˜Kšœœ ˜K–0.8 in tabStopsšœ œ ˜K–0.8 in tabStopsšœœ ˜K˜Kšœ œœœ˜&š œœœœœœ˜/Kšž œ œ˜Kšžœ œ˜—Kšœ œœœ˜(Kšœ œœœ˜'K˜K˜K˜š œœœœœœ˜0Kšž œ œ˜Kšžœ œ˜ —Kš œ œœœœ˜/š œ œœœ œ˜1Kšœ œ˜$Kšž œœ˜—Kš œ œœœœ˜-K˜šœ œœ œ!˜EKšœ@™@K˜—šœ œœ˜"Kšœw™wK˜—šœ œœ˜"Kšœq™q—K™Jšœ œœ ˜9Jšœ œœ,˜BJšœ œœ'˜>Jšž œ)˜6Jšž œ@˜KJ˜J˜šœ œœ˜J˜!J˜J˜J˜J˜J˜J˜J˜J˜J˜J˜J˜J˜J˜J˜J˜J˜J˜-J˜J˜ J˜ J˜ Jšœ˜—J˜Jšœœœœ˜8Jšœœœ-˜IJ˜š œ œœ œœ˜+J–1.2 in tabStopsšœœœ˜ J–1.2 in tabStopsšœœœ˜!J–1.2 in tabStopsšœœœ˜%J–1.2 in tabStopsšœœœ˜"J–1.2 in tabStopsšœœœ˜J–1.2 in tabStopsšœœ˜J–1.2 in tabStops˜—J–1.2 in tabStops˜J˜J–1.2 in tabStops˜—™K–0.75 in tabStops™K–0.75 in tabStops™&K–36 sp tabStopsšœ*Οfœ œT™ŠK–36 sp tabStops™K–36 sp tabStopsšœφ™φK–36 sp tabStops˜–26 sp tabStopsšœ œœ œ˜'K–26 sp tabStopsšœŸ˜,K–26 sp tabStopsšœŸ!˜0K–26 sp tabStopsšœŸ˜#K–26 sp tabStopsšœŸ˜#K–26 sp tabStopsšœ Ÿ˜K–26 sp tabStopsšœŸ˜$K–26 sp tabStopsšœŸ˜)K–26 sp tabStopsšœ Ÿ˜K–26 sp tabStopsšœŸ$˜6K–26 sp tabStopsšœ˜K–26 sp tabStops˜K–26 sp tabStops˜—–26 sp tabStopsšœœœ œ˜-K–26 sp tabStops™NK–26 sp tabStopsšœŸ*˜:K–26 sp tabStopsšœŸ!˜/K–26 sp tabStopsšœŸ!˜0K–26 sp tabStopsšœŸ!˜2K–26 sp tabStopsšœŸ!˜1K–26 sp tabStopsšœŸ!˜1K–26 sp tabStopsšœŸ&˜8K–26 sp tabStopsšœŸ˜+K–26 sp tabStopsšœŸ˜$K–26 sp tabStops˜ K–26 sp tabStops˜K–26 sp tabStops˜—–1.2 in tabStopsšœœœ œ ˜5J–1.2 in tabStopsšœ"˜"J–1.2 in tabStopsšœ!˜!J–1.2 in tabStopsšœœœŸ ˜DJ–1.2 in tabStopsšœœœ˜'J–1.2 in tabStopsšœ"˜"J–1.2 in tabStopsšœ#Ÿ˜9J–1.2 in tabStops˜—K–26 sp tabStops˜–26 sp tabStopsšœ œœ œ˜#Kšœ˜K˜ Kšœ˜K˜ K˜ K˜ K˜—K–26 sp tabStops˜–26 sp tabStopsšœ œœ œ˜$Kšœ˜ Kšœ˜ Kšœ˜Kšœ˜ Kšœ˜ K˜—šœ œœ œ˜'Kšœ˜ Kšœ˜ Kšœ˜ Kšœ˜ —K˜K˜š œœœ œœ˜/J–1.2 in tabStopsšœ˜–1.2 in tabStopsšœ˜–1.2 in tabStopsšœœ ˜J–1.2 in tabStopsšœ-˜-J–1.2 in tabStopsšœ ˜"J–1.2 in tabStopsš˜——J–1.2 in tabStops˜—J˜—K–26 sp tabStops˜K–26 sp tabStops˜–26 sp tabStopsšœ™K˜š ž œœœ œœ˜CKšœœ ˜K˜K˜—š ž œœœ œœ˜BKšœœ ˜K˜K˜—š ž œœ œœœ˜BKšœœ˜K˜K˜—š ž œœ œœœ˜AKšœœ˜K˜K˜—š ž œœœ œœ˜DKšœœ ˜K˜K˜—š ž œœ œœœ˜CKšœœ˜K˜K˜—š žœœ œ œœ˜:Kšœœ˜"K˜K˜—š žœœ œ œœ˜9Kšœœ˜"K˜K˜—š žœœ œ œœ˜:Kšœœ˜"K˜K˜—š ž œœ œ œœ˜;Kšœœ˜"K˜K˜—š ž œœ œ œœœ˜BK˜K˜—K˜—šœ™K™δK˜šž œœ œœœœœ˜@K˜K˜K˜—šž œœœœ œœœ˜BK˜K˜K˜—šž œœ œœœœœ˜BK˜K˜K˜—š ž œœ œœœœ˜@Kšœœœ˜K˜K˜—š ž œœ œœœ˜@Kšœœ˜K˜K˜—šž œœœœ œœœ˜EK˜K˜K˜—š ž œœœœ œœ˜CKšœœ˜K˜K˜—š ž œœœ œœ˜CKšœœ˜K˜K˜——šœ™K™šžœœ œ œ˜2Kšœ™šœ˜Kšœ"˜"Kšœ#˜#Kšœ˜—K˜K˜—šžœœ œ œ˜1Kšœ™šœ˜Kšœ!˜!Kšœ"˜"Kšœ˜—K˜K˜—šžœœ œ œ˜2Kšœ™šœ˜Kšœ"˜"Kšœ#˜#Kšœ˜—K˜K˜—šžœœ œ œ˜0Kšœ™šœ˜Kšœ˜Kšœ˜Kšœ˜—K˜K˜—šž œœ œ œ˜6KšœF™FKšœ(˜.K˜K˜—šž œœ œ œ˜6KšœK™KKšœ(˜.K˜K˜—š žœœ œ œ œœ˜LKšœy™yK˜K˜K˜K˜K˜——šœ™K™š žœœ œœœ˜CKšœ;™;K˜K˜ K˜K˜—š žœœœ œœ˜FKšœ;™;Kšœ˜K˜K˜—š žœœœ œœ˜EKšœ:™:Kšœ ˜ K˜K˜—š žœœœ œœ˜FKšœ:™:Kšœ˜K˜K˜—š ž œœœœ œœ˜PKšœU™UKšœ˜K˜K˜——™K˜šžœœ#˜=Kšœ œœ˜!KšœZ™ZKšœ?™?šœ˜˜šœ˜KšœJ˜JKšœM˜M——šœ˜ šœ˜KšœL˜LKšœO˜O—K˜——K˜K˜—š žœœ"œ œœ˜\KšœX™Xšœ˜˜šœ˜KšœI˜IKšœL˜L——šœ˜ šœ˜KšœL˜LKšœO˜O—K˜——K˜K˜—š žœœ!œ œœ˜[KšœV™Všœ˜˜šœ˜KšœM˜MKšœ$˜$——šœ˜ KšœB˜HK˜——K˜K˜—š žœœ!œ œœ˜\KšœW™Wšœ˜˜šœ˜Kšœ!˜!KšœM˜MKšœ˜——šœ˜ KšœA˜GK˜——K˜K˜——K–26 sp tabStops˜Jšœ˜J˜—…—%lF