GenJumpTest.mesa
Copyright © 1985, 1986, 1987 by Xerox Corporation. All rights reserved.
Edward Fiala February 7, 1986 1:16:25 pm PST
Fiala November 5, 1986 11:07:33 am PST Cosmetic edits.
Fiala March 25, 1987 12:59:47 pm PST Eliminate Reset, Pause, and Halt and change start to run with GenDebugger. Added the withSoftCard BOOLEAN. Rewrite the tests to stay within the 1 megabyte supplied by the Softcard except for several conditionally assembled tests of JQB. Eliminate the unused Xop and Trap procedures.
Load this diagnostic with "quad -cx GenDebugger GenJumpTest". When assembled with withSoftCard = TRUE and correctly executed, it terminates with a Halt[177777B] at instruction 73, cycle: 898, PC: 7777770B.
DIRECTORY
Basics USING [BITAND],
DebuggerDefs,
DragOpsCross USING [],
--Word, wordsPerPage, bytesPerWord, charsPerWord, bitsPerByte, bitsPerCharacter, bitsPerWord, bytesPerPage, logWordsPerPage, logBitsPerByte, logBitsPerChar, logBytesPerWord, logCharsPerWord, logBitsPerWord, logBytesPerPage, PageCount, PageNumber, maxPagesInVM, SixBitIndex, FiveBitIndex, TwoWords, FourBitIndex, Half, ThreeBitIndex, FourHalves, TwoHalves, Byte, ZerosByte, OnesByte, EightBytes, FourBytes, ByteIndex, BytesPerWord, TwoBytes, Comparison, ByteAddress, WordAddress, FieldDescriptor, RegIndex, PadByte, Lit8, Op4, Op8, JDist8, Inst, OIFormat, OQBformat, LRformat, QRformat, ShortRegQR, OBformat, LRBformat, RRformat, ODBformat, LRRBformat, RJBformat, ShortRegRJB, JBBformat, TrapWidthWords, TrapWidthBytes, XopBase, TrapBase, KernalLimit, TrapIndex, StackUnderflowTrap, IFUPageFaultTrap, ResetTrap, IFUStackOverflowTrap, EUStackOverflowTrap, RescheduleTrap, ALUCondFalse, ALUCondEZ, ALUCondLZ, ALUCondLE, ALUCondSpare, ALUCondNE, ALUCondGE, ALUCondGZ, ALUCondOver, ALUCondBC, ALUCondIL, ALUCondDO, ALUCondNotOver, ALUCondNB, ALUCondNI, ModeFault, MemAccessFault, IOAccessFault, EUPageFault, EUWriteFault, AUFault, euStack, euJunk, euToKBus, euMAR, euField, euConstant, euAux, euBogus, euLast, ifuYoungestL, ifuYoungestPC, ifuEldestL, ifuEldestPC, ifuSLimit, ifuBogus, ifuL, ifuS, ifuPC, ifuLast, EURegs, EULegalRegs, IFURegs, IFULegalRegs, StackedStatusWord, IFUStackIndex, IFUStackSize, IFUOverflow, EUStackIndex, EUStackSize, EULocalIndex, EULocals, EUAuxIndex, EUAuxRegs, EUConstIndex, EUConstants, IOLocation, ioRescheduleRequest, ioResetRequest, IOOperand, PCmdFormat, PCmdByteSelect, PCmdClass, PCmdSpace, PCmdDirection
DragOpsCrossUtils USING [CardToWord],
--InstToBytes, InstToFormat, BytePCToWordAddress, WordAddressToBytePC, IOOperandToCard, CardToIOOperand, FieldDescriptorToCard, CardToFieldDescriptor, 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, XopToBytePC, TrapIndexToBytePC, FieldUnit
HandCoding, --Has opcode and register defs.
HandCodingPseudos, --Label, SetLabel, GenLabel, GenLabelHere, UseLabel8A, UseLabel8B, UseLabel16, UseLabel32, LReg, PReg, SReg, AddReg, SubReg, SetRegConst, MoveReg, MoveRegI, LRegI, IndexedJump, ProcedureEntry, ProcedureExit, SetupField, ExtractField, ShiftLeft, LoadProcessorReg, StoreProcessorReg, CauseReschedule, CauseReset, GetSPLimit, SetSPLimit, GetYoungestPC, GetYoungestStatus, GetEldestPC, GetEldestStatus, SetYoungestPC, SetYoungestStatus, SetEldestPC, SetEldestStatus, Pause, Halt
HandCodingSupport; --Area, GetProc, PutProc, ProcList, NewArea, GenWithArea, Gen1WithArea, ForceOut, GetCurrentArea, LoadArea, GetOutputPC, SetOutputPC, WordAlign, ReserveData, OutputByte, OutputOneByte, OutputAlphaBeta, OutputAlphaBetaGammaDelta, OutputWord
GenJumpTest: CEDAR PROGRAM
IMPORTS Basics, DragOpsCrossUtils, HandCoding, HandCodingPseudos, HandCodingSupport
= BEGIN OPEN DebuggerDefs, DragOpsCrossUtils, HandCoding, HandCodingPseudos, HandCodingSupport;
All: PROC = {
area: Area = GetCurrentArea[];
enterJQBTest: Label = GenLabel[];
enterJDBTest: Label = GenLabel[];
enterJBTest: Label = GenLabel[];
enterJnTest: Label = GenLabel[];
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 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]];
};
SetLabel[enterJDBTest]; --Begin at userBasePC (DebuggerDefs.mesa) = 4040000B
This group of forward jumps never causes PC adder carry generation.
DoJDB[ 4001B]; --PC => 4044001B
DoJDB[ 10002B]; --PC => 4144003B
DoJDB[ 20004B]; --PC => 4344007B
DoJDB[ 40010B]; --PC => 4744017B
DoJDB[ 20B]; --PC => 4744037B
DoJDB[ 40B]; --PC => 4744077B
DoJDB[ 100B]; --PC => 4744177B
DoJDB[ 200B]; --PC => 4744377B
DoJDB[ 400B]; --PC => 4744777B
DoJDB[ 1000B]; --PC => 4745777B
DoJDB[ 2000B]; --PC => 4747777B
DoJDB[ 10000B]; --PC => 4757777B
DoJDB[ 20000B]; --PC => 4777777B
drJ1[];  --PC => 5000000B
These forward jumps generate PC adder carry on each bit in sequence; the carry doesn't propagate (except the ones that are **'ed).
DoJDB[ 40000B]; --PC => 5040000B
DoJDB[ 20000B]; --PC => 5060000B
DoJDB[ 10000B]; --PC => 5070000B
DoJDB[ 4000B]; --PC => 5074000B
DoJDB[ 2000B]; --PC => 5076000B
DoJDB[ 1000B]; --PC => 5077000B
DoJDB[ 400B]; --PC => 5077400B
DoJDB[ 200B]; --PC => 5077600B
DoJDB[ 100B]; --PC => 5077700B
DoJDB[ 40B]; --PC => 5077740B
DoJDB[ 20B]; --PC => 5077760B
DoJDB[ 10B]; --PC => 5077770B
DoJDB[ 10B]; --PC => 5100000B**
DoJDB[ 14B]; --PC => 5100014B
DoJDB[ 22B]; --PC => 5100036B
DoJDB[ 41B]; --PC => 5100077B
**Note that the Mesa compiler gives an overflow when -100000B is used below.
These backward jumps generate many PC adder carries.
DoJDB[-77777B-1]; --PC => 5000077B
DoJDB[-77777B-1]; --PC => 4700077B
DoJDB[40400B]; --PC => 4740477B
DoJDB[40400B]; --PC => 5301077B
};
These 1-byte jumps are really implemented as Noops by the IFU.
GenJn: PROC = {
SetLabel[enterJnTest];
drJ1[]; --5301077B to 5301100B
drJ2[]; Pause[]; --5301102B
drJ3[]; Pause[]; Pause[]; --5301105B
drJ5[]; Pause[]; Pause[]; Pause[]; Pause[]; --5301112B
};
Exercise all PC adder displacement bits with JB.
GenJB: PROC = {
Define procedure for putting out a JB 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]];
};
SetLabel[enterJBTest];
DoJB[100B];  --PC => 5301212B
DoJB[ 40B];  --PC => 5301252B
DoJB[ 20B];  --PC => 5301272B
DoJB[ 10B];  --PC => 5301302B
DoJB[ 44B];  --PC => 5301346B
DoJB[ 42B];  --PC => 5301410B
DoJB[ 41B];  --PC => 5301451B
DoJB[-140B]; --PC => 5301311B
};
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.
DoJQB: PROC [destPC: LONG CARDINAL] = {
drJQB[CardToWord[destPC]];
SetOutputPC[destPC];
};
SetLabel[enterJQBTest];
Exercise every bit position of the pc address.
DoJQB[ 5400000B];
DoJQB[ 5400010B];
DoJQB[ 5400030B];
DoJQB[ 5400070B];
DoJQB[ 5400170B];
DoJQB[ 5400270B];
DoJQB[ 5400670B];
DoJQB[ 5400770B];
DoJQB[ 5401772B];
DoJQB[ 5403772B];
DoJQB[ 5407772B];
DoJQB[ 5417776B];
DoJQB[ 5437776B];
DoJQB[ 5477776B];
DoJQB[ 5500101B];
DoJQB[ 5700000B];
DoJQB[ 6000000B];
DoJQB[ 7000000B];
IF NOT withSoftCard THEN {
DoJQB[ 10000000B];
DoJQB[ 20000000B];
DoJQB[ 40000000B];
DoJQB[ 100000000B];
DoJQB[ 200000000B];
DoJQB[ 400000000B];
DoJQB[ 1000000000B];
DoJQB[ 2000000000B];
DoJQB[ 4000000000B];
DoJQB[10000000000B];
DoJQB[20000000000B];
};
DoJQB[ 7777770B];
};
Begin at PC = userBasePC = 1010000B * 4, L = 1, S = 0 as established in GenDebugger.
GenJDB[];
GenJn[];
GenJB[];
GenJQB[];
Halt[177777B]; --PC = 7777770B Terminate here at the end of the program
};
END.