TestECC.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Gasbarro October 23, 1986 10:10:34 pm PDT
Last Edited by: Gasbarro October 28, 1986 9:20:25 am PST
DIRECTORY
BitOps, CD, CDCommandOps, CDSequencer, Core, CoreFlat, Ports, Random, Rosemary, RosemaryUser, Sisyph;
TestECC: CEDAR PROGRAM
IMPORTS BitOps, CDCommandOps, CoreFlat, Ports, Random, Rosemary, RosemaryUser, Sisyph
~ BEGIN
GoodData, BadData, CorrectedData, Parity, CheckZero: NAT;
Vdd, Gnd: NAT;
ROPE: TYPE = Core.ROPE;
Port: TYPE = Ports.Port;
Quad: TYPE = BitOps.BitQWord;
qZero: Quad = BitOps.BitQWordZero;
cellType: Core.CellType ← NIL;
tester: RosemaryUser.Tester;
design: CD.Design ← NIL;
SimpleTest: RosemaryUser.TestProc = {
p[GoodData].q ← [0,0,0, 010h];
p[BadData].q ← [0,0,0, 010h];
p[CorrectedData].q ← [0,0,0, 010h];
Eval[];
};
OldSimpleTest: RosemaryUser.TestProc = {
--PROC [cellType: Core.CellType, p: Ports.Port, Eval: PROC]--
RandomQ:
PROC
RETURNS [q: Quad] ~ {
FOR i:
NAT
IN [0..4)
DO
q[i] ← Random.ChooseInt[min:0, max: LAST[CARDINAL]];
ENDLOOP;
};
MakeSingleError:
PROC [good: Quad]
RETURNS [bad: Quad] ~ {
bit: INT ← Random.ChooseInt[min:0, max: 63];
mask: Quad ← BitOps.QuadShift[[0,0,0,1], bit];
bad ← BitOps.QXOR[mask, good];
};
MakeDoubleError:
PROC [q: Quad]
RETURNS [bad: Quad] ~ {
};
good, bad, mask: Quad;
Check each bit position for single error correct
p[Parity].b ← TRUE;
p[CheckZero].b ← FALSE;
p[CorrectedData].d ← expect;
good ← [0AAAAh, 0AAAAh, 0AAAAh, 0AAAAh];
FOR i:
NAT
IN [0..64)
DO
mask ← BitOps.QuadShift[[0,0,0,1], i];
bad ← BitOps.QXOR[mask, good];
p[GoodData].q ← good;
p[BadData].q ← bad;
p[CorrectedData].q ← good;
Eval[];
ENDLOOP;
Check each bit position for double error detect
p[Parity].b ← FALSE;
p[CheckZero].b ← FALSE;
p[CorrectedData].d ← none;
FOR i:
NAT
IN [1..64)
DO
mask ← BitOps.QuadShift[[0,0,0,1], i];
bad ← BitOps.QXOR[mask, good];
bad ← BitOps.QXOR[[0,0,0,1], bad];
p[GoodData].q ← good;
p[BadData].q ← bad;
Eval[];
ENDLOOP;
p[Parity].b ← TRUE;
p[CheckZero].b ← FALSE;
p[CorrectedData].d ← expect;
FOR i:
NAT
IN [0..100)
DO
good ← RandomQ[];
bad ← MakeSingleError[good];
p[GoodData].q ← good;
p[BadData].q ← bad;
p[CorrectedData].q ← good;
Eval[];
ENDLOOP;
};
CDExtractECC:
PROC [comm: CDSequencer.Command] = {
design ← comm.design;
cellType ← Sisyph.ExtractSchematicByName["ErrorCorrector.sch", Sisyph.Create[design]];
InitPortIndicies[cellType];
};
InitPortIndicies:
PROC [ct: Core.CellType] ~ {
[GoodData, BadData, CorrectedData, Parity, CheckZero, Vdd, Gnd] ← Ports.PortIndexes[ct.public, "GoodData", "BadData", "CorrectedData", "Parity", "CheckZero", "Vdd", "Gnd"];
};
Simulate:
PROC [ct: Core.CellType ←
NIL] = {
IF ct=NIL THEN ct ← cellType;
InitPortIndicies[ct];
Ports.InitTesterDrives[ct, force, "GoodData", "BadData",];
Ports.InitTesterDrives[ct, expect, "CorrectedData", "Parity", "CheckZero"];
Ports.InitPorts[ct, q, none, "GoodData", "BadData", "CorrectedData"];
Ports.InitPorts[ct, b, none, "Parity", "CheckZero"];
[] ← Rosemary.SetFixedWire[ct.public[Vdd], H];
[] ← Rosemary.SetFixedWire[ct.public[Gnd], L];
tester ← RosemaryUser.TestProcedureViewer[cellType: ct, testButtons: LIST["SimpleTest"], name: "ECC Tester", displayWires: RosemaryUser.DisplayPortLeafWires[ct], cutSet: CoreFlat.CreateCutSet[labels: LIST["Logic", "LogicMacro"]]];
};
RosemaryUser.RegisterTestProc["SimpleTest", SimpleTest];
CDCommandOps.RegisterWithMenu[
menu: $ProgramMenu,
entry: "Extract ECC",
doc: "",
proc: CDExtractECC
];END.