DIRECTORY ArbiterTest, ChipTest, IO, Process, Rope, ViewRec; ArbiterTestImpl: CEDAR PROGRAM IMPORTS ChipTest, IO, Process, ViewRec EXPORTS ArbiterTest = BEGIN OPEN ArbiterTest, ChipTest; real: Tester; stop: PUBLIC BOOL; comment: PUBLIC Rope.ROPE _ "No tests run yet.."; testMachine: PUBLIC Rope.ROPE _ "3#154#0"; Pins48: TYPE = [1..48]; arbInputs: PUBLIC ARRAY ArbIndex OF LogicValue; arbOutputs: PUBLIC ARRAY ArbIndex OF LogicValue; arbMCmd: PUBLIC ARRAY MCmdIndex OF LogicValue; arbReset, arbNewRq, arbPhA, arbPhB: PUBLIC LogicValue; States: TYPE = [0..4); state: States _ 0; aState: ARRAY States OF BOOL _ [FALSE, TRUE, FALSE, FALSE]; bState: ARRAY States OF BOOL _ [FALSE, FALSE, FALSE, TRUE]; PinToChannel: PROC[pin: [1..48]] RETURNS [channel: Channel] = { IF pin IN [1..24] THEN RETURN[pin+35] ELSE RETURN [92+25-pin]}; inputPin0: Pins48 _ 47; outputPin0: Pins48 _ 2; inputPin1: Pins48 _ 3; outputPin1: Pins48 _ 4; inputPin11: Pins48 _ 23; outputPin11: Pins48 _ 25; inputPin12: Pins48 _ 26; outputPin12: Pins48 _ 27; mCmdPin0: Pins48 _ 43; resetPin: Pins48 _ 40; newRqPin: Pins48 _ 41; phAPin: Pins48 _ 38; nPhAPin: Pins48 _ 37; phBPin: Pins48 _ 36; nPhBPin: Pins48 _ 35; inputChannels: ARRAY ArbIndex OF Channel; outputChannels: ARRAY ArbIndex OF Channel; mCmdChannels: ARRAY MCmdIndex OF Channel; resetChannel: Channel; newRqChannel: Channel; phAChannel: Channel; nPhAChannel: Channel; phBChannel: Channel; nPhBChannel: Channel; ApplyInputsSenseOutputs: PUBLIC PROC = TRUSTED { Process.Detach[FORK ReallyApplyInputsSenseOutputs[]]}; ReallyApplyInputsSenseOutputs: PUBLIC PROC = { t: Tester; v: RWChannelVecRef = NEW[ChannelVec _ ALL[FALSE]]; o: ChannelVecRef; d: RWChannelVecRef = NEW[ChannelVec _ ALL[TRUE]]; real _ OpenTester[testMachine]; real.Initialize[]; t _ real; [] _ t.PutBBuf[d]; -- use the disable vector to initialize the b buffer to all ones so that the xor inverts so that the entire chain of logic in the tester is noninverting. FOR i: ArbIndex IN ArbIndex DO d[inputChannels[i]] _ FALSE; ENDLOOP; d[resetChannel] _ FALSE; d[newRqChannel] _ FALSE; d[phAChannel] _ TRUE; d[nPhAChannel] _ TRUE; d[phBChannel] _ TRUE; d[nPhBChannel] _ TRUE; [] _ t.PutDisables[d]; comment _ IO.PutFR["Beginning test on %g...", IO.rope[testMachine]]; stop _ FALSE; state _ 0; FOR i: ArbIndex IN ArbIndex DO arbInputs[i] _ 1; arbOutputs[i] _ 0; ENDLOOP; arbReset _ 0; arbNewRq _ 0; arbPhA _ 0; arbPhB _ 0; UNTIL stop DO FOR i: ArbIndex IN ArbIndex DO v[inputChannels[i]] _ arbInputs[i]=1; ENDLOOP; v[resetChannel] _ arbReset=1; v[newRqChannel] _ arbNewRq=1; v[phAChannel] _ arbPhA#0; v[nPhAChannel] _ arbPhA=0; v[phBChannel] _ arbPhB#0; v[nPhBChannel] _ arbPhB=0; [] _ t.PutABuf[v]; t.Step[]; o _ t.GetIBuf[]; FOR i: ArbIndex IN ArbIndex DO arbOutputs[i] _ IF o[outputChannels[i]] THEN 1 ELSE 0; ENDLOOP; FOR i: MCmdIndex IN MCmdIndex DO arbMCmd[i] _ IF o[mCmdChannels[i]] THEN 1 ELSE 0; ENDLOOP; ENDLOOP; comment _ "Finished test"; }; AdvanceClocks: PUBLIC PROC ={ state _ (state + 1) MOD 4; arbPhA _ IF aState[state] THEN 1 ELSE 0; arbPhB _ IF bState[state] THEN 1 ELSE 0; }; [] _ ViewRec.ViewInterface[name: "ArbiterTest", viewerInit: [name: "Arbiter test"]]; inputChannels[0] _ PinToChannel[inputPin0]; outputChannels[0] _ PinToChannel[outputPin0]; FOR i: ArbIndex IN [1..10] DO inputChannels[i] _ PinToChannel[inputPin1 + 2*(i-1)]; outputChannels[i] _ PinToChannel[outputPin1 + 2*(i-1)]; ENDLOOP; inputChannels[11] _ PinToChannel[inputPin11]; outputChannels[11] _ PinToChannel[outputPin11]; FOR i: ArbIndex IN [12..15] DO inputChannels[i] _ PinToChannel[inputPin12 + 2*(i-12)]; outputChannels[i] _ PinToChannel[outputPin12 + 2*(i-12)]; ENDLOOP; FOR i: MCmdIndex IN MCmdIndex DO mCmdChannels[i] _ PinToChannel[mCmdPin0 + i]; ENDLOOP; resetChannel _ PinToChannel[resetPin]; newRqChannel _ PinToChannel[newRqPin]; phAChannel _ PinToChannel[phAPin]; nPhAChannel _ PinToChannel[nPhAPin]; phBChannel _ PinToChannel[phBPin]; nPhBChannel _ PinToChannel[nPhBPin]; END. ŠArbiterTestImpl.mesa Last Edited by Barth, October 16, 1984 4:43:43 pm PDT Last Edited by: Gasbarro, April 9, 1984 6:24:11 pm PST ʺ˜Jšœ™Jšœ5™5J™6J™šÏk ˜ Jšœ ˜ Jšœ ˜ Jšœ˜J˜Jšœ˜Jšœ˜—J˜šœœ˜Jšœ œ˜&Jšœ˜šœœ˜!J˜Jšœ ˜ J˜Jšœœœ˜Jšœ œœ˜1Jšœ œœ ˜*J˜Jšœœ ˜J˜Jšœ œœ œ ˜/Jšœ œœ œ ˜0Jšœ œœ œ ˜.Jšœ$œ ˜6J˜Jšœœ ˜Jšœ˜Jšœœœœœœœœ˜;Jšœœœœœœœœ˜;J˜šÏn œœœ˜?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šœ˜Jšœ˜J˜šžœœœœ˜0Jšœœ#˜6—šžœœœ˜.J˜ Jšœœœœ˜2Jšœ˜Jšœœœœ˜1Jšœ˜Jšœ˜J˜ JšœÏc™˜¬šœ œ ˜Jšœœ˜Jšœ˜—Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœ˜Jšœ œ"œ˜DJšœœ˜ Jšœ ˜ šœ œ ˜Jšœ˜Jšœ˜Jšœ˜—Jšœ ˜ Jšœ ˜ Jšœ ˜ Jšœ ˜ šœ˜ šœ œ ˜Jšœ%˜%Jšœ˜—Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ ˜ Jšœ˜šœ œ ˜Jšœœœœ˜6Jšœ˜—šœœ ˜ Jšœ œœœ˜1Jšœ˜—Jšœ˜—Jšœ˜Jšœ˜—J˜šž œœœ˜Jšœœ˜Jšœ œœœ˜(Jšœ œœœ˜(J˜—J˜JšœT˜TJšœ+˜+Jšœ-˜-šœ œ ˜Jšœ5˜5Jšœ7˜7Jšœ˜—Jšœ-˜-Jšœ/˜/šœ œ ˜Jšœ7˜7Jšœ9˜9Jšœ˜—šœœ ˜ Jšœ-˜-Jšœ˜—Jšœ&˜&Jšœ&˜&Jšœ"˜"Jšœ$˜$Jšœ"˜"Jšœ$˜$J˜—Jšœ˜—J˜—…—ŽÒ