DIRECTORY CD, CornerStitching, CDCells, CDMenus, CDSequencer, CDInstances, CDDirectory, TerminalIO, OverlapRemover; OverlapRemoverImpl: CEDAR PROGRAM IMPORTS CornerStitching, CDCells, CDInstances, CDDirectory, CDMenus, CDSequencer, TerminalIO EXPORTS OverlapRemover = BEGIN OverlapLayerRec: TYPE = RECORD [ technology: CD.Technology, keepLayer: CD.Layer, throwAwayLayer: CD.Layer ]; overlapLayerList: LIST OF REF OverlapLayerRec _ NIL; --contains registered abstract Layers RegionList: TYPE = LIST OF REF CornerStitching.Region; OverlapRemover: PUBLIC PROC [cellOb: CD.Object, design: CD.Design] = BEGIN WITH cellOb.specificRef SELECT FROM cp: CD.CellPtr => { OverlapRemoverCell[design, cellOb]; [] _ CDCells.RepositionCell[cellOb, design]; CDDirectory.PropagateChange[cellOb, design]; }; ENDCASE => NULL; END; OverlapAllLevels: PROC [design: CD.Design] = BEGIN DoIt: CDDirectory.EachEntryAction = { OverlapRemover[cellOb: ob, design: design] }; [] _ CDDirectory.Enumerate[design, DoIt]; OverlapRemover[design.actual.first.dummyCell.ob, design]; END; OverlapAllCommand: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Overlap removal on all levels\n"]; OverlapAllLevels[design: comm.design]; TerminalIO.WriteRope["Removal Finished\n"]; END; OverlapRemoverCell: PROC [design: CD.Design, cellOb: CD.Object] = BEGIN FOR layerList: LIST OF REF OverlapLayerRec _ overlapLayerList, layerList.rest WHILE layerList #NIL DO IF layerList.first.technology = design.technology THEN { cellPtr: CD.CellPtr _ NARROW[cellOb.specificRef]; keepPlane: REF CornerStitching.Tesselation _ CornerStitching.NewTesselation[]; FillPlaneFromWires[cellPtr, layerList.first.keepLayer, keepPlane]; CompareWiresAgainstPlane[design, cellOb, cellPtr, layerList.first.throwAwayLayer, keepPlane]; }; ENDLOOP; END; FillPlaneFromWires: PROC [cellPtr: CD.CellPtr, layer: CD.Layer, plane: REF CornerStitching.Tesselation] = BEGIN FOR instanceList: CD.InstanceList _ cellPtr.contents, instanceList.rest WHILE instanceList #NIL DO IF instanceList.first.ob.class.wireTyped AND instanceList.first.ob.layer = layer THEN CornerStitching.ChangeRect[plane: plane, rect: CDInstances.InstRectI[instanceList.first], newValue: $cover]; ENDLOOP; END; CompareWiresAgainstPlane: PROC [design: CD.Design, cellOb: CD.Object, cellPtr: CD.CellPtr, layer: CD.Layer, plane: REF CornerStitching.Tesselation] = BEGIN FOR instanceList: CD.InstanceList _ cellPtr.contents, instanceList.rest WHILE instanceList #NIL DO IF instanceList.first.ob.class.wireTyped AND instanceList.first.ob.layer = layer AND RectCoveredCompletely[CDInstances.InstRectI[instanceList.first], plane] THEN [] _ CDCells.RemoveInstance[design: design, cell: cellOb, inst: instanceList.first]; ENDLOOP; END; RectCoveredCompletely: PROC [rect: CD.Rect, plane: REF CornerStitching.Tesselation] RETURNS [BOOL _ TRUE] = BEGIN FOR rectList: RegionList _ NARROW[CornerStitching.EnumerateArea[plane: plane, rect: rect, backgroundValue: $none]], rectList.rest WHILE rectList #NIL DO IF rectList.first.value = NIL THEN RETURN[FALSE]; ENDLOOP; END; RegisterOverlapLayers: PUBLIC PROC [technology: CD.Technology, keepLayer: CD.Layer, throwAwayLayer: CD.Layer] = BEGIN overlapLayerList _ CONS[NEW[OverlapLayerRec _ [technology, keepLayer, throwAwayLayer]], overlapLayerList]; END; CDMenus.CreateEntry[menu: $ProgramMenu, entry: "Overlap Remover All", key: $OverlapAll]; CDSequencer.ImplementCommand[a: $OverlapAll, p: OverlapAllCommand, queue: doQueue]; END.  OverlapRemoverImpl.mesa Last Edited by: Gbier, July 11, 1985 12:181:45 pm PDT Last Edited by: Gbier, August 8, 1985 2:21:51 pm PDT --Its not clear that an Overlap Remover on the Top level is a useful command, but if someone wants it just uncomment the below OverlapTopCommand: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Overlap removal on top level\n"]; OverlapRemover[comm.design.actual.first.dummyCell.ob, comm.design]; TerminalIO.WriteRope["Removal Finished\n"]; END; CDMenus.CreateEntry[menu: $ProgramMenu, entry: "Overlap Remover Top", key: $OverlapTop]; CDSequencer.ImplementCommand[a: $OverlapTop, p: OverlapTopCommand, queue: doQueue]; Ê\˜šœ™Jšœ5™5Jšœ4™4—J˜šÏk ˜ Jšœ˜Jšœ˜J˜J˜J˜ J˜ J˜ J˜ J˜—J˜šÏbœœ˜!JšœV˜]Jšœ˜—Jšœ˜J˜šœœœ˜ Jšœ œ ˜Jšœ œ˜Jšœœ˜J˜J˜—Jš œœœœœÏc%˜[J˜Jš œ œœœœ˜6J˜š Ïnœœœ œœ ˜DJš˜šœœ˜#šœœ ˜J˜#J˜,Jšœ,˜,J˜——Jšœœ˜Jšœ˜—J˜š œœ œ ˜,Jš˜šžœ!˜%Jšœ*˜*Jšœ˜—Jšœ)˜)Jšœ:˜:Jšœ˜—J˜š œœ˜5Jš˜Jšœ8˜8Jšœ&˜&J˜+Jšœ˜—J˜šÐbnœœ œœ ˜AJš˜š œ œœœ4œ œ˜ešœ0œ˜8Jšœ œ œ˜1Jšœ œ@˜NJ˜BJ˜]J˜—Jšœ˜—Jšœ˜—J˜š ¡œœ œœœ˜iJš˜š œœ4œœ˜bšœ'œ%œ˜VJ˜l—Jšœ˜ —Jšœ˜—J˜š¡œœ œœœœœ˜•Jš˜š œœ4œœ˜bšœ'œ%œI˜¡J˜T—Jšœ˜ —Jšœ˜—J˜š¡œœœœœœœ˜kJš˜š œœaœ œ˜˜šœœœ˜#Jšœœ˜—Jšœ˜—Jšœ˜J˜—š  ¡žœœœœœœ ˜pJš˜JšœœœO˜jJšœ˜—J˜Jšœ~™~J˜š¡œœ™5Jš™Jšœ7™7JšœC™CJ™+Jšœ™—JšœX™XJšœS™SJ™J˜JšœX˜XJšœS˜SJ˜Jšœ˜—…— ª¦