GenJumpTest.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Edward Fiala February 7, 1986 1:16:25 pm PST
When correctly executed, this diagnostic terminates with a Halt[177777B] at instruction 65, cycle: 953, PC: 7000000013B.
DIRECTORY
Basics USING [BITAND],
DragOpsCross USING [XopBase, TrapBase, TrapWidthBytes, bytesPerWord, TrapIndex, Word],
--XopBase, TrapBase, TrapWidthBytes, Inst, wordsPerPage, bytesPerWord, charsPerWord, bitsPerByte, bitsPerCharacter, bitsPerWord, logWordsPerPage, logBitsPerByte, logBitsPerChar, logBytesPerWord, logCharsPerWord, logBitsPerWord, logBytesPerPage, PageCount, PageNumber, maxPagesInVM, SixBitIndex, FiveBitIndex, Word, TwoWords, FourBitIndex, Half, ThreeBitIndex, FourHalves, TwoHalves, Byte, ZerosByte, OnesByte, EightBytes, FourBytes, ByteIndex, BytesPerWord, TwoBytes, Comparison, ByteAddress, WordAddress, FieldDescriptor, TrapWidthWords, KernalLimit, TrapIndex, StackUnderflowTrap, IFUPageFaultTrap, ResetTrap, IFUStackOverflowTrap, EUStackOverflowTrap, RescheduleTrap, ALUCondOver, ALUCondBC, ALUCondIL, ALUCondDO, EUPageFault, EUWriteFault, AUFault, euStack, euJunk, euMAR, euField, euConstant, euAux, euBogus, euLast, ifuXBus, ifuStatus, ifuSLimit, ifuYoungestL, ifuYoungestPC, ifuEldestL, ifuEldestPC, ifuBogus, ifuL, ifuS, ifuPC, ifuLast, IFUStatusRec, IFUStackIndex, IFUStackSize, IFUOverflow, EUStackIndex, EUStackSize, EULocalIndex, EULocals, EUAuxIndex, EUAuxRegs, EUConstIndex, EUConstants, IOLocation, ioRescheduleRequest, ioResetRequest
DragOpsCrossUtils USING [CardToWord],
--BytePCToWordAddress, WordAddressToBytePC, IOOperandToCard, CardToIOOperand, FieldDescriptorToCard, CardToFieldDescriptor, StatusToWord, WordToStatus, BytesToWord, BytesToHalf, WordToBytes, HalfToBytes, HalvesToWord, WordToHalves, HighHalf, LowHalf, LeftHalf, RightHalf, SwapHalves, WordToInt, IntToWord, WordToCard, HalfToCard, ByteToCard, CardToWord, CardToHalf, CardToByte, DragAnd, DragOr, DragXor, DragNot, VanillaAdd, VanillaSub, AddDelta, HalfNot, HalfAnd, HalfOr, HalfXor, HalfShift, DoubleWordShiftLeft, SingleWordShiftLeft, SingleWordShiftRight, TrapIndexToBytePC, XopToBytePC
HandCoding, --Has opcode and register defs.
HandCodingPseudos, --GenLabel, GenLabelHere, SetLabel, Halt, Pause, MakeLabelGlobal, UseLabel8B, UseLabel16, UseLabel32, ProcedureEntry, ProcedureExit, EnableTraps, IndexedJump, SetupField, ExtractField, ShiftLeft, LoadProcessorReg, StoreProcessorReg, DisableTraps, CauseReschedule, CauseReset, GetSPLimit, SetSPLimit, GetL, SetL, GetYoungestPC, GetYoungestL, GetEldestPC, GetEldestL, SetYoungestPC, SetYoungestL, SetEldestPC, SetEldestL
HandCodingSupport; --Area, GetCurrentArea, ReserveData, SetOutputPC, GetProc, PutProc, ProcList, NewArea, GenWithArea, Gen1WithArea, ForceOut, GetOutputPC, WordAlign, OutputByte, OutputOneByte, OutputAlphaBeta, OutputAlphaBetaGammaDelta, OutputWord
GenJumpTest: CEDAR PROGRAM
IMPORTS Basics, DragOpsCrossUtils, HandCoding, HandCodingPseudos, HandCodingSupport
= BEGIN OPEN DragOpsCrossUtils, HandCoding, HandCodingPseudos, HandCodingSupport;
Word: TYPE = DragOpsCross.Word;
All: PROC = {
area: Area = GetCurrentArea[];
savePC: LONG CARDINAL ← GetOutputPC[area];
enterJQBTestPC: LONG CARDINAL ← 2000B;
enterJDBTestPC: LONG CARDINAL ← 4000400000B;
enterJBTestPC: LONG CARDINAL ← 6000000000B;
enterJnTestPC: LONG CARDINAL ← 7000000000B;
start: Label = GenLabel[];
dummy: Label = GenLabel[];
enterJQBTest: Label = GenLabel[];
enterJDBTest: Label = GenLabel[];
enterJBTest: Label = GenLabel[];
enterJnTest: Label = GenLabel[];
Xops trap at opcode*TrapWidthBytes + xopBase*bytesPerWord = 4,000,000B + 20B * opcode.
FillXop: PROC [inst: CARDINAL, dest: Label] = {
SetOutputPC[inst * DragOpsCross.TrapWidthBytes + DragOpsCross.XopBase * DragOpsCross.bytesPerWord];
drJDB[UseLabel16[dest]];
};
A trap's location is TrapIndex*TrapWidthBytes + TrapBase*bytesPerWord =
4,002,000B + 20B * TrapIndex. TrapIndex definitions are in DragOpsCross.
FillTrap: PROC [tx: DragOpsCross.TrapIndex, dest: Label] = {
SetOutputPC[LOOPHOLE[tx, CARDINAL] * DragOpsCross.TrapWidthBytes + DragOpsCross.TrapBase * DragOpsCross.bytesPerWord];
drJQB[UseLabel32[dest]];
};
DoJQB: PROC [destPC: LONG CARDINAL] = {
drJQB[CardToWord[destPC]];
SetOutputPC[destPC];
};
Exercises all PC address bits with JQB.
GenJQB: PROC = {
Define procedure for putting out a JQB opcode. Page creation automatically fills the unused bytes in each page with 0, so a trap will happen if a wild jump or non-jump occurs.
SetOutputPC[enterJQBTestPC];
SetLabel[start]; --Simulator begins here on a Reset
SetLabel[enterJQBTest];
Exercise every bit position of the pc address; must avoid the vector for Xops and Traps between byte positions 4000000B and 4004000B.
DoJQB[ 200040B];
DoJQB[ 400100B];
DoJQB[ 1000200B];
DoJQB[ 2000400B];
DoJQB[ 4001000B];
DoJQB[ 10002000B];
DoJQB[ 20004001B];
DoJQB[ 40010002B];
DoJQB[ 100020004B];
DoJQB[ 200040010B];
DoJQB[ 400100020B];
DoJQB[ 1000000000B];
DoJQB[ 2000000000B];
DoJQB[ 4000000000B];
DoJQB[10000000000B];
DoJQB[20000000000B];
};
Exercise all PC adder displacement bits with JDB. Each bit is tested in the following modes: (1) not generating a carry to the next bit; (2) generating a carry to the next bit but not propagating it; (3) propagating a carry from the previous bit; (4) not propagating a carry from the previous bit. Carry propagation look-ahead paths which are incompletely tested.
GenJDB: PROC = {
Define procedure for putting out a JDB opcode followed by a Pause.
DoJDB: PROC [disp: INTEGER] = {
oldPC: LONG CARDINAL ← GetOutputPC[area];
drJDB[LOOPHOLE[disp, CARDINAL]];
SetOutputPC[oldPC + LONG[disp]];
};
SetOutputPC[enterJDBTestPC]; --PC = 4000400000B
SetLabel[enterJDBTest];
This group of forward jumps never causes PC adder carry generation.
DoJDB[ 4001B]; --PC => 4000404001B
DoJDB[ 10002B]; --PC => 4000414003B
DoJDB[ 20004B]; --PC => 4000434007B
DoJDB[ 40010B]; --PC => 4000474017B
DoJDB[ 20B]; --PC => 4000474037B
DoJDB[ 40B]; --PC => 4000474077B
DoJDB[ 100B]; --PC => 4000474177B
DoJDB[ 200B]; --PC => 4000474377B
DoJDB[ 400B]; --PC => 4000474777B
DoJDB[ 1000B]; --PC => 4000475777B
DoJDB[ 2000B]; --PC => 4000477777B
These forward jumps generate PC adder carry on each bit in sequence; the carry doesn't propagate (except the one that is **'ed).
DoJDB[ 40000B]; --PC => 4000537777B
DoJDB[ 20000B]; --PC => 4000557777B
DoJDB[ 10000B]; --PC => 4000567777B
DoJDB[ 4000B]; --PC => 4000573777B
DoJDB[ 2000B]; --PC => 4000575777B
DoJDB[ 1000B]; --PC => 4000576777B
DoJDB[ 400B]; --PC => 4000577377B
DoJDB[ 200B]; --PC => 4000577577B
DoJDB[ 100B]; --PC => 4000577677B
DoJDB[ 40B]; --PC => 4000577737B
DoJDB[ 20B]; --PC => 4000577757B
DoJDB[ 10B]; --PC => 4000577767B
DoJDB[ 104B]; --PC => 4000600073B**
DoJDB[ 102B]; --PC => 4000600175B
DoJDB[ 201B]; --PC => 4000600376B
DoJQB[20000040000B]; --PC => 20000040000B
**Note that the Mesa compile gives an overflow when -100000B is used below.
This backward jump generates no PC adder carries.
DoJDB[-77777B-1]; --PC => 17777740000B
This backward jump generates PC adder carry in all of the high-order bits.
DoJDB[-77777B-1]; --PC => 17777640000B
DoJDB[ 40400B]; --PC => 17777700400B
DoJDB[ 40400B]; --PC => 17777741000B
This forward jump tests PC adder carry propagation across all the high-order bits.
DoJDB[ 40377B]; --PC => 20000001377B
};
Exercise all PC adder displacement bits with JB.
GenJB: PROC = {
Define procedure for putting out a JDB opcode followed by a Pause.
DoJB: PROC [disp: INTEGER] = {
oldPC: LONG CARDINAL ← GetOutputPC[area];
drJB[Basics.BITAND[LOOPHOLE[disp, CARDINAL], 377B]];
SetOutputPC[oldPC + LONG[disp]];
};
SetOutputPC[enterJBTestPC]; --PC = 6000000000B
SetLabel[enterJBTest];
DoJB[100B];  --PC => 6000000100B
DoJB[ 40B];  --PC => 6000000140B
DoJB[ 20B];  --PC => 6000000160B
DoJB[ 10B];  --PC => 6000000170B
DoJB[ 44B];  --PC => 6000000234B
DoJB[ 42B];  --PC => 6000000276B
DoJB[ 41B];  --PC => 6000000337B
DoJQB[6000001000B]; --PC => 6000001000B
DoJB[-100B]; --PC => 6000000700B
};
GenJn: PROC = {
SetOutputPC[enterJnTestPC]; --PC = 7000000000B
SetLabel[enterJnTest];
drJ1[]; --PC => 7000000001B
drJ2[]; --PC => 7000000003B
Pause[];
drJ3[]; --PC => 7000000006B
Pause[];
Pause[];
drJ5[]; --PC => 7000000013B
Pause[];
Pause[];
Pause[];
Pause[];
};
SetLabel[dummy];
Pause[]; Pause[]; Pause[]; Pause[]; Pause[]; Halt[123B];
Opcodes 0 and 377B are intercepted by the simulator, but make them trap to dummy here anyway.
savePC ← GetOutputPC[area];
FillTrap[ResetTrap, start];
FillXop[0, dummy];
FillXop[377B, dummy];
SetOutputPC[savePC];
WordAlign[area];
GenJQB[];
drJQB[CardToWord[enterJDBTestPC]];
GenJDB[];
drJQB[CardToWord[enterJBTestPC]];
GenJB[];
drJQB[CardToWord[enterJnTestPC]];
GenJn[];
Halt[177777B]; --PC = 7000000020B Terminate here at the end of the program
};
END.