ArbPESimImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
E. McCreight, March 11, 1987 11:25:07 am PST
Last Edited by: McCreight October 19, 1987 3:06:30 pm PDT
DIRECTORY
CD, Core, CoreCreate, CoreFlat, CoreOps, Logic, Ports, PW, Rosemary, RosemaryUser, Random, Sisyph;
ArbPESimImpl: CEDAR PROGRAM
IMPORTS CoreCreate, CoreFlat, CoreOps, Logic, Ports, PW, Rosemary, RosemaryUser, Random, Sisyph
=
BEGIN
nInputs: INT = 8;
nBits: INT = 3;
range: INT = 8;
rs: Random.RandomStream ← Random.Create[];
peType: Core.CellType ← NIL;
ioPort: Ports.Port;
tester: RosemaryUser.Tester ← NIL;
ExtractCellType: PROC = {
In: INT; -- ports
nIn: INT;
nMin: INT;
design: CD.Design ← PW.OpenDesign["Arbiter24"];
cx: Sisyph.Context ← Sisyph.Create[design];
peType ← Sisyph.ExtractSchematicByName[name: "PE-8-3.icon", cx: cx];
In ← CoreOps.GetWireIndex[peType.public, "In"];
nIn ← CoreOps.GetWireIndex[peType.public, "nIn"];
nMin ← CoreOps.GetWireIndex[peType.public, "nMin"];
[] ← Rosemary.SetFixedWire[CoreCreate.FindWire[peType.public, "Vdd"], H];
[] ← Rosemary.SetFixedWire[CoreCreate.FindWire[peType.public, "Gnd"], L];
FOR i: INT IN [0..nInputs) DO
[] ← Ports.InitPort[wire: peType.public[In][i], levelType: c];
[] ← Ports.InitTesterDrive[wire: peType.public[In][i], initDrive: force];
[] ← Ports.InitPort[wire: peType.public[nIn][i], levelType: c];
[] ← Ports.InitTesterDrive[wire: peType.public[nIn][i], initDrive: force];
ENDLOOP;
[] ← Ports.InitPort[wire: peType.public[nMin], levelType: c, initDrive: force];
[] ← Ports.InitTesterDrive[wire: peType.public[nMin], initDrive: expect];
ioPort ← Ports.CreatePort[peType.public];
simulation ← Rosemary.InstantiateCellType[cellType: peType, testPort: ioPort];
tester ← RosemaryUser.TestProcedureViewer[cellType: peType, testButtons: LIST["PERandomTest"], name: "Priority Encoder Test", -- displayWires: RosemaryUser.DisplayPortLeafWires[peType], -- cutSet: CoreFlat.CreateCutSet[labels: LIST[Logic.logicCutSet, Logic.macroCutSet]]];
};
iterations: INT ← 0;
PERandomTestProc: RosemaryUser.TestProc = {
In: INT = CoreOps.GetWireIndex[cellType.public, "In"]; -- ports
nIn: INT = CoreOps.GetWireIndex[cellType.public, "nIn"];
nMin: INT = CoreOps.GetWireIndex[cellType.public, "nMin"];
iterations ← 0;
DO
min: NAT = rs.ChooseInt[0, range-1];
where: NAT = rs.ChooseInt[0, nInputs-1];
inputs: ARRAY [0..nInputs) OF INT;
iterations ← iterations+1;
FOR i: INT IN [0..nInputs) DO
inputs[i] ← (IF i = where THEN min ELSE rs.ChooseInt[min, range-1]);
p[In][i].c ← inputs[i];
p[nIn][i].c ← range-1-inputs[i];
ENDLOOP;
p[nMin].c ← range-1-min;
Eval[];
ENDLOOP;
};
RosemaryUser.RegisterTestProc["PERandomTest", PERandomTestProc];
END.