MDDefs.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Willie-Sue, May 2, 1986 4:36:55 pm PDT
definitions for MicroD, ONLY for Dorado Model 1
taken from MDdecl.d
DIRECTORY
BasicTime USING [GMT, nullGMT],
FS USING [OpenFile],
IO USING [STREAM],
Rope USING [ROPE];
MDDefs: CEDAR DEFINITIONS =
BEGIN
STREAM: TYPE = IO.STREAM;
ROPE: TYPE = Rope.ROPE;
OneBit: TYPE = [0..1];
Memory sizes
IFUMsize: CARDINAL = 1024;
IMsize: CARDINAL = 4096;  -- do not increase this!!!
ALUFMsize: CARDINAL = 16;
RMsize: CARDINAL = 256;
IFUMIndex: TYPE = [0..IFUMsize);
IMIndex: TYPE = [0..IMsize);
ALUFMIndex: TYPE = [0..ALUFMsize);
RMIndex: TYPE = [0..RMsize);
listing codes ( used in SrcFileRec) - less than 0 mesans don't list IM
listPrintMB: INTEGER = -2;
listNotIM: INTEGER = -1;
listConcise: INTEGER = 0;
listAbsOnly: INTEGER = 1;
listFull: INTEGER = 2;
IMWord: TYPE = REF IMRecord;
instruction memory record
IMRecord: TYPE = MACHINE DEPENDENT RECORD[
The comment describing each field begins with a sequence of characters representing the phases that use it. The first of these is the phase that sets the field. The characters have the following meaning:
G - Given (from Micro)
L - Link
A - Alist
P - Placement (Assign)
D - Dump
The first 6 words are in the same order that Micro outputs IM words
imw0 (0): WORD,
imw1 (1): WORD,
imw2 (2): WORD,
wx0 (3): W0Word,
wx1 (4): W1Word,
wx2 (5): W2Word,
the next 3 words are working storage (bcpl overlays imr0-2)
links (6): LinkInit,  -- G, D
mask (7): WORD,  -- (mask) LAP Mask of valid placements in group of 20B
dispTab (8): DispTabWord, -- G, D
these next three are copies of wx0-wx2, used for doing placement
word0 (9): W0Word,
LAPD Abs addr of this instr if atW0 eq 1, Abs page for this instr if onPage eq 1
word1 (10): W1Word, -- G, L Imaginary addr branched to from this instr
word2 (11): W2Word, -- G, L 2nd imag addr of DBLxxx or .+1
symbol (12): Symbol -- if this is a label, this is its name
];
LinkInit: TYPE = MACHINE DEPENDENT RECORD[
jbcLinked (0: 0..0): OneBit, -- LAP Same group of 20B if set
aLinked (0: 1..1): OneBit,  -- LAP An aLink points to this instr
blank (0: 2..3): [0..3],
aLink (0: 4..15): [0..7777B] -- LAP Link to next element in +1 list
];
W0Word: TYPE = MACHINE DEPENDENT RECORD[
brkPAndIFUE (0: 0..0): OneBit, -- Set breakpoint here, An IFU dispatch instruction
atW0AndatWord (0: 1..1): OneBit, -- W0 is the abs addr of this instr
  LA Low 6 bits of W0 are abs word in page
globalAndIFUSeq (0: 2..2): OneBit, -- A global call location
L In a multi-instruction IFU entry sequence (*** MDprescan knows IFUseq=global)
onPageAndPlaced (0: 3..3): OneBit,  -- LAP High 6 (or 4) bits of W0 are abs page for this instr; D Instruction was placed successfully
W0Addr (0: 4..15): [0..7777B] -- LAPD Abs addr of this instr if atW0 eq 1
   Abs page for this instr if onPage eq 1
];
W1Word: TYPE = MACHINE DEPENDENT RECORD[
returns (0: 0..0): OneBit,  -- L Does a RETURN, CORETURN, IM read/write, or
TPC read/write
calls (0: 1..1): OneBit,  -- L Does a CALL or CORETURN (place next at .+1)
jbc (0: 2..2): OneBit,  -- L Has a branch condition in JCN
usesFN (0: 3..3): OneBit,  -- L FN field unavailable for long goto/call
W1AddrAndGroupLink (0: 4..15): [0..7777B] -- Imaginary addr branched to from this instr
];
W2Word: TYPE = MACHINE DEPENDENT RECORD[
branchesAndMarked (0: 0..0): OneBit, -- Does a BRANCH; AP multi-use mark bit
goes (0: 1..1): OneBit,  -- Does a GOTO
emulator (0: 2..2): OneBit, -- Instruction is for an emulator task
iscond (0: 3..3): OneBit,  -- Has a branch condition
W2AddrAndbLink (0: 4..15): [0..7777B] -- 2nd imag addr of DBLxxx or .+1
   LAP Link to next element in page ring
];
DispTabWord: TYPE = MACHINE DEPENDENT RECORD[
blank (0: 0..3): [0..17B] ← 0,
dispTab (0: 4..15): [0..7777B] -- LAP Mask of valid placements in group of 20B
];
AddrWord: TYPE = MACHINE DEPENDENT RECORD[
addrBlank (0: 0..3): [0..17B] ← 0,
addr (0: 4..15): [0..7777B]
];
-- Reserved values in W1 and W2
WNext: WORD = 7777B;  -- from Micro, means .+1
WNull: WORD = 7777B;  -- internally, null address (end of list)
WExt: WORD = 7776B;  -- internally, external reference
NImax: WORD = 7775B;  -- max number of instruction words
placement constraints for IM words - Dorado Model 1 ONLY
globalZero: WORD = 77B;
ifuZero: WORD = 3B;
calledMask: WORD = 100000B; -- call entries at 0 mod 16
goedtoMask: WORD = 77777B; -- NOT calledMask;
jbctMask: WORD = 5000B; -- JBC branches to 4/5, 6/7, not 0/1 or 2/3 because 000x is reserved (sigh)
ifuMask: WORD = 104210B; -- IFU entries at 0 mod 4
pageIfuMax: WORD = 16;
globalMask: WORD = 100000B; -- global entries only at 0 mod 64
evenMask: WORD = 125252B; -- for false cases of conditional branches
oddMask: WORD = 52525B; -- for true cases (Basics.BITSHIFT[evenMask, -1])
DoradoPageSize: WORD = 100B;
DoradoRMBlockSize: WORD = 20B;
nGlobalPages: CARDINAL = (IMsize-1-globalZero)/(DoradoPageSize+1);
maxnPages: CARDINAL = IMsize/DoradoPageSize;
nPages: CARDINAL = IMsize/DoradoPageSize;
nIfuPages: CARDINAL = (IMsize-1-ifuZero)/DoradoPageSize + 1;
PageMask: WORD = IMsize - DoradoPageSize;
WordMask: WORD = DoradoPageSize-1;
what the IFUM looks like
IFUMRecord: TYPE = MACHINE DEPENDENT RECORD[
ifumWord0 (0): IFUMWord0,
otherData (1): WORD
];
IFUMWord0: TYPE = MACHINE DEPENDENT RECORD[
pa (0: 0..0): OneBit,  -- "packed alpha" bit, gets moved
nEnt (0: 1..2): [0..3],  -- number of consecutive entries
blank (0: 3..3): OneBit,
ifad (0: 4..15): [0..7777B]
];
-- IM mask chain
IMMask: TYPE = REF IMMaskRec;
IMMaskRec: TYPE = RECORD [
next: IMMask,
addr: WORD,
mask: WORD ← 0,
mSeq: WORD ← 0
];
-- Micro binary block types
MBend: INTEGER = 0;  -- ()
MBdata: INTEGER = 1;  -- (sourceline, data)
MBaddress: INTEGER = 2;  -- (memory, addr)
MBfixup: INTEGER = 3;  -- (memory, addr, (firstbit, lastbit), value)
MBmemory: INTEGER = 4; -- (memory, width, name)
MBsymbol: INTEGER = 5; -- (memory, addr, name)
MBexternalfixup: INTEGER = 6;  -- (memory, addr, (firstbit, lastbit), name)
-- memory numbers
nMemX: INTEGER = 16; -- max number of memories
IMmemx: INTEGER = 1;
RMmemx: INTEGER = 2;
-- IMLOCKmemx = xxx
-- DISPmemx = xxx
-- IMMASKmemx = xxx
IFUMmemx: INTEGER = 3;
ALUFMmemx: INTEGER = 4;
-- RVRELmemx = xxx
MemDescArray: TYPE = ARRAY [0..nMemX) OF MemDescRecord;
MemDescRecord: TYPE = REF MemDescObj;
MemDescObj: TYPE = RECORD[
name: ROPE ← NIL,
widthInBits: INTEGER ← 0,
wordsOfData: INTEGER ← 0,
seen: BOOLFALSE,
count: INTEGER ← 0,
symMaxAddr: CARDINAL ← 0
];
Symbol: TYPE = REF SymbolRec;
SymbolRec: TYPE = RECORD[
atm: ATOM,   -- used for symbolTable
name: ROPE,
memNum: INTEGER ← -1,  -- memory for which this is a label
labelAddr: CARDINAL ← 7777B,  -- address in memory where defined
fixup: FixupRecord  -- really a LIST OF FixupRecord
];
FixupRecord: TYPE = REF FixupRec;
FixupRec: TYPE = RECORD[
memNum: INTEGER ← 0,
fieldDesc: ExtFixField ← null,
addr: CARDINAL ← 0,
next: FixupRecord
];
ExtFixField: TYPE = {null, im1Field, im2Field, ifField};  -- only ones allowed
SrcFile: TYPE = REF SrcFileRec;
SrcFileRec: TYPE = RECORD[
fullName: ROPE,
of: FS.OpenFile,
createDate: BasicTime.GMT ← BasicTime.nullGMT,
niFirst: CARDINAL ← 0,  -- nInstructions before loading
niLast: CARDINAL ← 0,  -- nInstructions after loading
listingFlag: INTEGER ← 0,  -- how to list is encoded
next: SrcFile
];
OutputFile: TYPE = REF OutputFileRec;
OutputFileRec: TYPE = RECORD[
fullName: ROPE,
strm: STREAM
];
Error: SIGNAL[explanation: ROPENIL];
ReportType: TYPE = {fatalError, passFatal, nonFatal, infoOnly};
IFUMRecordPtr: TYPE = LONG POINTER TO IFUMRecord;
IMRecordPtr: TYPE = LONG POINTER TO IMRecord;
ALUFMRecordPtr: TYPE = LONG POINTER TO WORD;
RMRecordPtr: TYPE = LONG POINTER TO WORD;
IMlocked: TYPE = PACKED ARRAY IMIndex OF BOOL;
RMBits: TYPE = PACKED ARRAY RMIndex OF BOOL;
ALUFMBits: TYPE = PACKED ARRAY ALUFMIndex OF BOOL;
IFUMBits: TYPE = PACKED ARRAY IFUMIndex OF BOOL;
W2Fixups: TYPE = REF W2FixupRep;
W2FixupIndex: TYPE = [0..7777B);
W2FixupRep: TYPE = RECORD[w2Fix: SEQUENCE max: W2FixupIndex OF W2FixupRecord];
W2FixupRecord: TYPE = RECORD[imAddr, w2Value: CARDINAL];
END.