Init:
PROC = {
[] ← Ports.InitTesterDrive[ct.public[Vdd], force];
[] ← Ports.InitTesterDrive[ct.public[Gnd], force];
[] ← Ports.InitTesterDrive[ct.public[PadVdd], force];
[] ← Ports.InitTesterDrive[ct.public[PadGnd], force];
[] ← Ports.InitTesterDrive[ct.public[PhA], force];
[] ← Ports.InitTesterDrive[ct.public[PhB], force];
[] ← Ports.InitTesterDrive[ct.public[DPData], none];
[] ← Ports.InitTesterDrive[ct.public[DPRejectB], force];
[] ← Ports.InitTesterDrive[ct.public[KBus], none];
[] ← Ports.InitTesterDrive[ct.public[EURes3BisPBus3AB], force];
[] ← Ports.InitTesterDrive[ct.public[EUWriteToPBus3AB], force];
[] ← Ports.InitTesterDrive[ct.public[EUAluOp2AB], force];
[] ← Ports.InitTesterDrive[ct.public[EUCondSel2AB], force];
[] ← Ports.InitTesterDrive[ct.public[EUCondition2B], expect];
[] ← Ports.InitTesterDrive[ct.public[DShiftAB], force];
[] ← Ports.InitTesterDrive[ct.public[DExecuteAB], force];
[] ← Ports.InitTesterDrive[ct.public[DNSelectAB], force];
[] ← Ports.InitTesterDrive[ct.public[DHoldAB], force];
[] ← Ports.InitTesterDrive[ct.public[DDataInAB], force];
[] ← Ports.InitTesterDrive[ct.public[DDataOutAB], force];
[] ← RosemaryUser.MakeStandardViewer[name: "EU2 Tester", cellType: ct, testButtons: LIST[["TestEU2", TestEU2]], displayWires: RosemaryUser.DisplayPortLeafWires[wire: ct.public]];
};
TestEU2: RosemaryUser.TestProc ~ {
Hex: PROC [r: ROPE] RETURNS [CARD] ~ {RETURN [Convert.CardFromRope[r, 16]]};
GetHex: PROC RETURNS [CARD] ~ {RETURN [Hex[IO.GetTokenRope[from].token]]};
from: IO.STREAM ← FS.StreamOpen[VecFileName];
nbPorts: INT ← IO.GetCard[from]; -- number of ports in the header
perm: FileIndexToPortIndex ← NEW[FileIndexToPortIndexRec[nbPorts]];
-- Read header
FOR i:
INT
IN [0..nbPorts)
DO
-- find a public wire with this name, and put its index in the permutation
perm[i] ← CoreOps.GetWireIndex[ct.public, IO.GetRopeLiteral[from]]; -- -1 if not found
[] ← IO.GetCard[from]; -- ignore the number of bits
ENDLOOP;
DO
-- an entry is either "." or "bs val" with b IN [0..3], s IN [0..F], and val is a cardinal.
FOR fileIndex:
INT
IN [0..nbPorts)
DO
i: INT ← perm[fileIndex];
r: ROPE;
val: CARD;
r ← IO.GetTokenRope[from].token;
IF Rope.Equal[r, "."] THEN LOOP; -- same as previously
IF i=-1 THEN {[] ← IO.GetTokenRope[from]; LOOP;}; -- ignore this port
p[i].d ←
SELECT Hex[r]/16
FROM
-- "b" field
0 => none,
1 => expect,
2 => drive,
ENDCASE => ERROR;
val ← GetHex[]; -- the value of the port
SELECT p[i].type
FROM
b => p[i].b ← (val=1);
c => p[i].c ← val;
lc => p[i].lc ← val;
ENDCASE => ERROR;
ENDLOOP;
Eval[];
ENDLOOP;
};