CDSimpleWellTestCommand.mesa
Jacobi, November 16, 1985 4:02:43 pm PST
Jacobi, November 18, 1985 9:17:27 am PST
copy /ivy/jacobi/temp/CDWellTestCommand.mesa ← CDWellTestCommand.mesa
Simple version!!!! barks even if there s no diffusion close by
DOES NOT CHECK IF a well node has a well contact! Checks only if some (but maybe unconnected well contact is close enough.... WRONG but as long as spinifex tests the presence of connection, this distance check is close to fine.
DIRECTORY
CD,
CDBasics,
CDCommandOps,
CDErrors,
CDMenus,
CDOrient,
CDProperties,
CDSequencer,
CDSimpleRules,
CornerStitching,
IO,
TerminalIO;
CDWellTestCommand:
CEDAR
PROGRAM
IMPORTS CD, CDBasics, CDCommandOps, CDErrors, CDMenus, CDOrient, CDProperties, CDSequencer, CDSimpleRules, CornerStitching, IO, TerminalIO =
BEGIN
wellContMaxDistInLambda: INT ← 75; --in lambda (assume 75 mu, 1 lambda = 1 mu)
TessData:
TYPE =
RECORD [
toDo: ARRAY CD.Layer OF REF TessDefine ← ALL[NIL]
];
TessDefine:
TYPE =
RECORD[
tess: REF CornerStitching.Tesselation ← NIL,
surround: CD.Number ← 0,
value: REF ← $covered
];
ReportRec:
TYPE =
RECORD [
design: CD.Design,
inst: CD.Instance,
count: INT ← 0
];
WellCheckCommand:
PROC [comm: CDSequencer.Command] =
BEGIN
inst: CD.Instance;
inst ← CDCommandOps.TheInstance[comm: comm, text: "check well contacts"];
IF inst#
NIL
THEN {
no: INT;
no ← CheckAGlobalInstance[comm.design, inst].errNo;
TerminalIO.WriteF[" well contact check found %g problems\n", IO.int[no]];
};
END;
DrawInstance:
PROC [pr:
CD.DrawRef, inst:
CD.Instance] =
BEGIN
pr.drawChild[inst, inst.location, inst.orientation, pr];
END;
CheckAGlobalInstance:
PROC [design:
CD.Design, inst:
CD.Instance]
RETURNS [errNo:
INT] =
BEGIN
dist: CD.Number ← wellContMaxDistInLambda*design.technology.lambda;
pr: CD.DrawRef ← CD.CreateDrawRef[design];
report: REF ReportRec ← NEW[ReportRec←[design: design, inst: inst]];
passTessInfo: REF TessData ← NEW[TessData];
nwell: CD.Layer ← CDSimpleRules.GetLayer[design.technology, $nwell];
nwellcontact: CD.Layer ← CDSimpleRules.GetLayer[design.technology, $nwelCont];
passTessInfo.toDo[nwell] ← NEW[TessDefine];
passTessInfo.toDo[nwell].tess ← CornerStitching.NewTesselation[];
passTessInfo.toDo[nwellcontact] ← NEW[TessDefine];
passTessInfo.toDo[nwellcontact].tess ← CornerStitching.NewTesselation[];
passTessInfo.toDo[nwellcontact].surround ← dist;
pr.devicePrivate ← passTessInfo;
pr.drawRect ← DrawInTess;
DrawInstance[pr, inst];
SubTess[passTessInfo.toDo[nwell].tess, passTessInfo.toDo[nwellcontact].tess];
CDErrors.RemoveMessages[design: report.design, ob: report.inst.ob, owner: errorOwner];
CornerStitching.EnumerateArea[plane: passTessInfo.toDo[nwell].tess, rect: CDBasics.universe, perTile: ReportError, data: report];
errNo ← report.count;
END;
DrawInTess:
PROC [r:
CD.Rect, l:
CD.Layer, pr:
CD.DrawRef] =
BEGIN
tessData: REF TessData ← NARROW[pr.devicePrivate];
tessDefine: REF TessDefine;
IF (tessDefine←tessData.toDo[l])#
NIL
THEN
CornerStitching.ChangeRect[plane: tessDefine.tess, rect: CDBasics.Extend[r, tessDefine.surround], newValue: tessDefine.value]
END;
Remove: CornerStitching.PerTileProc =
BEGIN
from: REF CornerStitching.Tesselation ← NARROW[data];
CornerStitching.ChangeRect[from, CornerStitching.Area[tile], NIL]
END;
ReportError: CornerStitching.PerTileProc =
BEGIN
rect: CD.Rect;
report: REF ReportRec ← NARROW[data];
report.count ← report.count+1;
rect ← CDOrient.DeMapRect[itemInWorld: CornerStitching.Area[tile],
cellSize: report.inst.ob.size,
cellInstOrient: report.inst.orientation,
cellInstPos: report.inst.location
];
[] ← CDErrors.IncludeMessage[design: report.design, ob: report.inst.ob, rect: rect, message: "N-Well contact missing", owner: errorOwner];
END;
SubTess:
PROC [x, minus:
REF CornerStitching.Tesselation] =
BEGIN
CornerStitching.EnumerateArea[plane: minus, rect: CDBasics.universe, perTile: Remove, data: x]
END;
errorOwner: ATOM ← $WellProblem;
[] ← CDProperties.RegisterProperty[errorOwner, $chj];
CDMenus.CreateEntry[menu: $ProgramMenu, entry: "Check well contacts", key: $WellContactsCheck];
CDSequencer.ImplementCommand[a: $WellContactsCheck, p: WellCheckCommand, queue: doQueue];
END.