BondWireImpl.mesa
Copyright Ó 1985, 1986, 1987 by Xerox Corporation. All rights reserved.
Don Curry February 17, 1988 7:20:12 pm PST
DIRECTORY
CD, CDBasics, CDCells, CDCurves, CDInstances, CDLayers, CDOps, CDProperties, CDRects, CDSequencer, Core, CoreGeometry, CoreOps, Sinix, Sisyph, TerminalIO;
BondWireImpl: CEDAR PROGRAM
IMPORTS CD, CDBasics, CDCells, CDCurves, CDInstances, CDLayers, CDOps, CDProperties, CDRects, CDSequencer, CoreGeometry, CoreOps, Sinix, Sisyph, TerminalIO
~ BEGIN
CreateBondWire: PROC [comm: CDSequencer.Command] ~ {
layer:  CD.Layer    ← CDLayers.CurrentLayer[comm.design];
width: INT     ← MAX[2,2*((CDLayers.LayerWidth[comm.design, layer]+1)/2)];
iRect:  CD.Rect    ← CDBasics.ToRect[comm.sPos, comm.pos];
points: LIST OF CD.Position ← LIST[[iRect.x1, iRect.y1], [iRect.x2, iRect.y2]];
spot:  CD.Object    ← CDRects.CreateRect[[width, width], CD.commentLayer];
line:  CD.Object    ← CDCurves.CreateLine[points, width, layer].ob;
cell:  CD.Object    ← CDCells.CreateEmptyCell[];
flippedA: BOOL     ← (comm.sPos.x<comm.pos.x AND comm.sPos.y>comm.pos.y);
flippedB: BOOL     ← (comm.sPos.x>comm.pos.x AND comm.sPos.y<comm.pos.y);
orient: CD.Orientation  ← IF flippedA OR flippedB THEN mirrorX ELSE original;
iList:  CD.InstanceList  ← NIL;
spot1Inst: CD.Instance   ← CDInstances.NewInst[spot];
spot2Inst: CD.Instance   ← CDInstances.NewInst[spot, [CDBasics.SizeOfRect[iRect]]];
lineInst: CD.Instance   ← CDInstances.NewInst[line];
IF comm.sPos = comm.pos THEN
{TerminalIO.PutRope["Zero length BondWire not included.\n"]; RETURN};
iList ← CONS[spot1Inst, CONS[spot2Inst, CONS[lineInst, iList]]];
cell ← CDCells.CreateCell[il: iList];
CDCells.ToSequenceMode[cell];
CDProperties.PutObjectProp[cell, Sisyph.mode.extractProcProp, $ExtractBondWire];
[] ← CDOps.IncludeObjectI[comm.design, cell, [iRect.x1, iRect.y1], orient];
TerminalIO.PutRope["BondWire included.\n"]};
ExtractBondWire: Sinix.ExtractProc = {
ir:  CD.Rect  ← CD.InterestRect[obj];
insts: CoreGeometry.Instances ← NIL;
wire: Core.Wire ← CoreOps.CreateWire[name: Sinix.NameFromSatellites[obj, properties]];
EachInstance: CDCells.InstEnumerator ~
{IF CDRects.IsBareRect[inst.ob] THEN insts ← CONS [[inst.ob, inst.trans], insts]};
[] ← CDCells.EnumerateInstances[obj, EachInstance];
CoreGeometry.PutPins[mode.decoration, wire, insts];
result ← wire};
Sinix.RegisterExtractProc[$ExtractBondWire, ExtractBondWire];
CDSequencer.ImplementCommand[$CreateBondWire, CreateBondWire,, doQueue];
END.