DIRECTORY IO, Misc, Rope, CD, CDOrient, D2Basic, IP; IPToolBox: CEDAR DEFINITIONS IMPORTS CDOrient = BEGIN PhysicalPins: TYPE = LIST OF REF IP.PhysicalPinRep; IntVector: TYPE = IP.IntVector; IPPinsFromCDPins: PROC[cdObj: CD.Object] RETURNS [LIST OF REF IP.PinRep]; -- IPPinFromCDPin: PROC[cdPin: REF CDPins.Pin] RETURNS [REF IP.PinRep]; MakeIPPins: PROC[ipPins: LIST OF REF IP.PinRep, origin: IntVector _ [0, 0], coShape: REF IP.ShapeRep _ NIL, cutOff: NAT _ 0] RETURNS [LIST OF REF IP.PinRep]; NearestSide: PROC [shape: REF IP.ShapeRep, point: IntVector, cutOff: NAT _ 0] RETURNS [inShape: BOOL, side: IP.PinSideType]; DistFromSide: PROC[shape: REF IP.ShapeRep, point: IntVector, side: IP.PinSideType] RETURNS [INT]; GetCorner: PROC [shape: IP.ShapeRep, corner: IP.CornerTypes] RETURNS [REF IP.NatVector]; GetBRect: PROC[shape: REF IP.ShapeRep, origin: IntVector _ [0, 0]] RETURNS [Misc.Rect]; GetCornerRect: PROC[shape: REF IP.ShapeRep, corner: IP.CornerTypes, origin: IntVector _ [0, 0], crop: INT _ 1] RETURNS [Misc.Rect]; GetCornerRects: PROC[shape: REF IP.ShapeRep, origin: IntVector _ [0, 0], crop: INT _ 1] RETURNS [sw, se, ne, nw: Misc.Rect]; CopyShape: PROC[oShape: REF IP.ShapeRep, orient: IP.Orientation] RETURNS [nShape: REF IP.ShapeRep]; OrientShape: PROC[shape: REF IP.ShapeRep, orient: IP.Orientation]; MirrorXShape: PROC[shape: REF IP.ShapeRep]; Rotate90Shape: PROC [shape: REF IP.ShapeRep, numberOfRot: INT _ 1]; ParseError: ERROR [reason: ATOM, at: REF]; GetIdRope: PROC[stream: IO.STREAM] RETURNS [Rope.ROPE]; GetIdAtom: PROC[stream: IO.STREAM] RETURNS [ATOM]; EnterBlock: PROC [stream: IO.STREAM]; ExitBlock: PROC [stream: IO.STREAM] RETURNS [BOOL _ TRUE]; RemoveBlock: PROC [stream: IO.STREAM]; GetNatVector: PROC[stream: IO.STREAM] RETURNS [REF IP.NatVector]; GetIntVector: PROC[stream: IO.STREAM] RETURNS [REF IntVector]; GetShape: PROC[stream: IO.STREAM] RETURNS [REF IP.ShapeRep]; GetPhysicalPins: PROC[stream: IO.STREAM] RETURNS [PhysicalPins]; PutShape: PROC[stream: IO.STREAM, shape: REF IP.ShapeRep]; PutPhysicalPins: PROC[stream: IO.STREAM, physicalPins: PhysicalPins]; OrientPhysicalPins: PROC [phyPins: PhysicalPins, cellDim: IP.NatVector, cellOrient: IP.Orientation, cellOrigin: IntVector _ [0, 0]]; MirrorXPhysicalPins: PROC [phyPins: PhysicalPins, cellDim: IP.NatVector, cellOrigin: IntVector _ [0, 0]]; Rotate90PhysicalPins: PROC [phyPins: PhysicalPins, cellDim: IP.NatVector, numberOfRot: INT _ 1, cellOrigin: IntVector _ [0, 0]]; OrientPinSide: PROC[side: IP.PinSideType, orient: IP.Orientation] RETURNS [IP.PinSideType]; MirrorXPinSide: PROC[side: IP.PinSideType] RETURNS [IP.PinSideType]; Rotate90PinSide: PROC [side: IP.PinSideType, numberOfRot: INT _ 1] RETURNS [IP.PinSideType]; CoChannels: PROC[co: REF IP.ComponentRep, action: PROC[REF IP.ChannelRep] RETURNS [quit: BOOL]]; GetCoDim: PROC[co: REF IP.ComponentRep] RETURNS[x, y: NAT] = INLINE { IF CDOrient.IncludesOddRot90[co.orient] THEN [y, x] _ co.shape.dim^ ELSE [x, y] _ co.shape.dim^; }; --GetCoDim GetCoOrigin: PROC[co: REF IP.ComponentRep] RETURNS[IntVector] = INLINE {RETURN[co.origin]}; ConstructFileName: PROC[defaultDir, inputFile, defaultExt: Rope.ROPE] RETURNS[fullName: Rope.ROPE]; END. X--File: IPToolBox.mesa Last Edited by: Preas, August 2, 1986 10:10:25 am PDT --Intro: Contains a lot of the highly commonly used procedures --Calls IPPinFromCDPin repeatedly. --Note: order of pins will be reveresed --Note: Order of physicalPins will be reversed --Basically deep copy ipPins with coordinates of copy recomputed wrt -- origin, if coShape # NIL. Side of all physical pins in iPins -- will be assigned to the nearest side of the component when -- distance of pin from side is less then cutOff, else it will be an interior pin. -- If coShape = NIL then coordinates of (physical) pins is meaningless --Shape manipulation routines -- Compute the side closest to point. If (distance of point from closest side) > cutOff -- then side = interior (even though point may actually lie outside shape.) -- inShape = TRUE iff coord actually lies on the boundary or within shape -- returns perpendicular distance of point from side -- returns LAST[INT] for pathological/meaningless cases. --doesn't modify oShape. nShape and oShape shares all REF IP.NatVector -- For examples, see IPCoTabImpl --Copy oShape and apply OrientShape --modifies shape --Some primitives for reading data from stream --read : from stream into "Id" -- ! Raise ParseError[$syntaxError, char]; --read : from stream into $Id -- ! Raise ParseError[$syntaxError, char]; --Remove { from stream. If char read is not '{ then --! Raise ParseError[$noBegn, char]; -- Return TRUE iff first non-blank char = } --Remove { } from stream --Read ( , ) --Read ( , ) --Read {( ) sw: () ...: (, ) } -- where xy IN {sw, se, ne, nw} and xx, yy are NAT's --! Raise ParseError[$badToken, $]; --Some high level stream output routines: --inverse of GetShape -- inverse of GetPhysicalPins --Physical pins manipulation procedures --Some commonly used operation on Component --enumerate channels in co in the following order: -- (i) prinChannels: south, east, north, west, followed by -- (2) cornerChannels: sw.hor, sw.ver, se.hor, ...., nw.hor, hw.ver Κ˜J™J™5J™JšΟc>™>J˜šΟk ˜ Jšžœ˜J˜J˜J˜J˜ J˜Jšžœ˜—J˜šœ žœž œ˜Jšžœ ž˜J˜Jš œžœžœžœžœžœ˜3Jšœ žœžœ ˜J˜codešΟnœžœžœ žœžœžœžœžœ ˜IK™"K™'—K˜š Ÿœžœžœ žœžœžœ ˜GK™.—J˜šŸ œžœ žœžœžœžœ.žœžœ žœ žœžœžœžœžœžœ ˜KšœG™GKšœA™AKšœ>™>KšœS™SKšœG™GK˜—K˜K™šŸ œžœ žœžœ%žœžœ žœžœ˜|KšœX™XKšœL™LK™I—K˜šŸ œžœžœžœ#žœžœžœ˜aK™4K™8—K˜KšŸ œžœžœžœžœžœžœ ˜XJ˜Kš Ÿœžœžœžœ'žœ ˜WK˜KšŸ œžœžœžœžœ0žœžœ ˜ƒK˜Kš Ÿœžœžœžœ-žœžœ˜|J˜šŸ œžœ žœžœžœžœ žœžœ ˜cKšF™FK™ KšœŸ ™#—K˜š Ÿ œžœžœžœžœ˜BK™—J˜JšŸ œžœžœžœ ˜+J˜Jš Ÿ œžœ žœžœžœ˜CJ˜J™.J˜Jšœ žœ žœžœ˜*J˜š Ÿ œžœ žœžœžœžœ˜7Jšœ"™"Jšœ*™*—J˜š Ÿ œžœ žœžœžœžœ˜2J™!Jšœ*™*J™—J˜šŸ œžœ žœžœ˜%J™3Jšœ$™$—J˜šŸ œžœ žœžœžœžœžœ˜:J™+—J˜šŸ œžœ žœžœ˜&Jšœ6™6—J˜šŸ œžœ žœžœžœžœžœ ˜AJ™J˜—š Ÿ œžœ žœžœžœžœ ˜>J™J˜—J˜šŸœžœ žœžœžœžœžœ ˜