<> <> <> DIRECTORY DragonMicroPLA, DragonMicrocode, IO, Commander, Dragon, DragOpsCross; DragonMicroPLATest: CEDAR PROGRAM IMPORTS DragonMicroPLA, DragonMicrocode, IO, Commander, Dragon = BEGIN DoTest: Commander.CommandProc = { screen: IO.STREAM _ cmd.out; testArgs: DragonMicroPLA.PhBArgs; screen.PutF["There are %g Microcode minterms currently.\n", IO.int[DragonMicroPLA.PLAMinterms]]; testArgs _ [ state: [ exceptions : none], delayACycle : FALSE, iStkEmpty: FALSE, instReady: TRUE, alpha: 333B, beta: 257B, op: dTrap ]; FOR beta:Dragon.HexByte IN [0..255] DO testArgs.beta _ beta; FOR opcode:Dragon.Opcode IN [0..255] DO testResult: DragonMicroPLA.MicroInst; knownGoodResult: DragonMicrocode.MicroInst; unusedState: DragonMicrocode.IFUState; bArgs: DragonMicrocode.PHBargs; IF opcode=79 THEN LOOP; -- dMDIV IF opcode=81 THEN LOOP; -- dRDIV IF ( opcode=320B OR opcode=324B OR opcode=330B OR opcode=334B ) THEN LOOP; -- RJB format with condition "False", "True" IF ( opcode=303B OR opcode=304B OR opcode=305B OR opcode=310B ) THEN LOOP; -- RR format with AluOps BndChk, FOP, FOPK, undefined TRUSTED { bArgs.state _ LOOPHOLE[testArgs.state]; bArgs.op _ opcode; bArgs.alpha _ testArgs.alpha; bArgs.beta _ testArgs.beta; bArgs.delayACycle _ testArgs.delayACycle; bArgs.iStkEmpty _ testArgs.iStkEmpty; bArgs.pushPending _ testArgs.pushPending; bArgs.popPending _ testArgs.popPending; bArgs.instReady _ testArgs.instReady; testArgs.op _ LOOPHOLE[opcode]; testResult _ DragonMicroPLA.GetMicroInst[testArgs]; [ knownGoodResult, unusedState] _ DragonMicrocode.GetMicroInst[bArgs]; Dragon.Assert[ testResult.aReg = LOOPHOLE[knownGoodResult.aReg ]] ; Dragon.Assert[ testResult.bReg = LOOPHOLE[knownGoodResult.bReg ]]; Dragon.Assert[ testResult.getNextMacro = LOOPHOLE[knownGoodResult.getNextMacro ]]; Dragon.Assert[ testResult.xBSource = LOOPHOLE[knownGoodResult.xBSource ]]; Dragon.Assert[ testResult.doMacroJump = LOOPHOLE[knownGoodResult.doMacroJump ]]; Dragon.Assert[ testResult.cReg = LOOPHOLE[knownGoodResult.cReg ]]; Dragon.Assert[ testResult.lSource = LOOPHOLE[knownGoodResult.lSource ]]; Dragon.Assert[ testResult.sSource = LOOPHOLE[knownGoodResult.sSource ]]; Dragon.Assert[ knownGoodResult.deltaS = LOOPHOLE[(IF testResult.deltaSa=pop THEN -1 ELSE 0)+(IF testResult.deltaSb=pop THEN -1 ELSE 0)+(IF testResult.deltaSc=push THEN 1 ELSE 0) ]]; Dragon.Assert[ testResult.xASource = LOOPHOLE[knownGoodResult.xASource ]]; Dragon.Assert[ testResult.aluRtIsK = LOOPHOLE[knownGoodResult.aluRtIsK ]]; Dragon.Assert[ ( IF testResult.aluOp # op47 THEN testResult.aluOp ELSE LOOPHOLE[opcode MOD 16, Dragon.ALUOps] ) = LOOPHOLE[knownGoodResult.aluOp ]]; Dragon.Assert[ ( IF testResult.condSel # op57 THEN testResult.condSel ELSE LOOPHOLE[opcode MOD 8, Dragon.CondSelects] ) = LOOPHOLE[knownGoodResult.condSel ]]; Dragon.Assert[ testResult.dontBypass = LOOPHOLE[knownGoodResult.dontBypass ]]; Dragon.Assert[ testResult.iStackPostEffect = LOOPHOLE[knownGoodResult.iStackPostEffect ]]; Dragon.Assert[ testResult.iTrapPostEffect = LOOPHOLE[knownGoodResult.iTrapPostEffect ]]; Dragon.Assert[ testResult.euPBusCmd = LOOPHOLE[knownGoodResult.euPBusCmd ]]; Dragon.Assert[ testResult.pipedPLSASpec = LOOPHOLE[knownGoodResult.pipedPLSASpec ]]; Dragon.Assert[ testResult.pushLevel3 = LOOPHOLE[knownGoodResult.pushLevel3 ]]; Dragon.Assert[ testResult.delayed = LOOPHOLE[unusedState.delayed ]]; }; ENDLOOP; ENDLOOP; }; Commander.Register [ key: "PLATest", proc: DoTest, doc: "Test of Dragon Microcode PLA."]; END.