<> <> <> <> DIRECTORY Atom, CD, CDBasics, CDCommandOps, CDCSUtil, CDErrors, CDOps, CDProperties, CDSequencer, CDSimpleRules, CStitching, CornerBasedDRC, D2Basic, IO, Rope, TerminalIO; CornerBasedDRCTest: CEDAR PROGRAM IMPORTS Atom, CDBasics, CDCommandOps, CDCSUtil, CDErrors, CDOps, CDProperties, CDSequencer, CDSimpleRules, CornerBasedDRC, IO, TerminalIO = BEGIN CheckProc: TYPE = PROC [cw: CDCSUtil.CDWorld, errorOwner: ATOM_NIL] RETURNS [errNo: INT_0]; okIfConnected: BOOL = FALSE; --fails if true CornerBasedCheckPolySpacing: PROC [cw: CDCSUtil.CDWorld, errorOwner: ATOM] RETURNS [errNo: INT_0] = { tech: CD.Technology _ cw.design.technology; poly: CD.Layer _ CDSimpleRules.GetLayer[tech, $poly]; pLayers: CDCSUtil.Layers _ LIST[NEW[CDCSUtil.LayerDescRec_[poly]]]; pol: CDCSUtil.Tesselation _ CDCSUtil.Make[cw, pLayers]; rule: CornerBasedDRC.Rule _ NEW[CornerBasedDRC.RuleRep_[ extent: CDSimpleRules.MinDist[poly, poly], okIfConnected: okIfConnected, message: "poly spacing" ]]; task: REF CornerBasedDRC.DrcTask _ NEW[CornerBasedDRC.DrcTask_[ geometry: pol, rules: LIST[rule], error: CBErrorProc, properties: Atom.PutPropOnList[NIL, $errorOwner, errorOwner], data: cw ]]; rule.isStuff[CornerBasedDRC.nodeConstraintIndex] _ TRUE; rule.isError[CornerBasedDRC.nodeConstraintIndex] _ TRUE; CornerBasedDRC.Check[task, CDBasics.Extend[cw.restrict, MAX[rule.extent, cw.minGrowClip]]]; }; CBErrorProc: CornerBasedDRC.ErrorProc = { <<--PROC [task: REF DrcTask, rule: Rule, r: CD.Rect];>> what: CDCSUtil.CDWorld _ NARROW[task.data]; [] _ CDErrors.IncludeMessage[design: what.design, ob: what.ob, rect: CDCSUtil.BackRect[what, r], message: rule.message, owner: NARROW[Atom.GetPropFromList[task.properties, $errorOwner]]]; }; ------------------------------------------------ checkProc: CheckProc _ CornerBasedCheckPolySpacing; CornerBasedDRCTestComm: PROC [comm: CDSequencer.Command] = { inst: CD.Instance; inst _ CDOps.TheInstance[design: comm.design, text: "CDCS\n"]; IF inst#NIL THEN { no: INT; cw: CDCSUtil.CDWorld _ NEW[CDCSUtil.CDWorldRec _ [ design: comm.design, ob: inst.ob, propRef: CDProperties.InitPropRef[] ]]; no _ checkProc[cw, errorOwner].errNo; TerminalIO.PutF[" CDCS found %g problems\n", IO.int[no]]; }; }; RemErrCommand: PROC [comm: CDSequencer.Command] = { inst: CD.Instance; inst _ CDOps.TheInstance[design: comm.design, text: "remove errors"]; IF inst#NIL THEN { CDErrors.RemoveMessages[design: comm.design, ob: inst.ob, owner: NIL, alsoOthers: TRUE]; }; }; errorOwner: ATOM _ $CornerBasedDRCTest; [] _ CDProperties.RegisterProperty[errorOwner, $chj]; CDCommandOps.RegisterWithMenu[menu: $ProgramMenu, entry: "CornerBasedDRCTest", key: $CornerBasedDRCTest]; CDSequencer.ImplementCommand[key: $CornerBasedDRCTest, proc: CornerBasedDRCTestComm, queue: doQueue]; CDCommandOps.RegisterWithMenu[menu: $ProgramMenu, entry: "remove errors", key: $CornerBasedDRCTestRemoveErrs]; CDSequencer.ImplementCommand[key: $CornerBasedDRCTestRemoveErrs, proc: RemErrCommand, queue: doQueue]; END.