DIRECTORY CD, CDSymbolicObjects, Connections, RefTab, RefTabExtras, PWPins, Rope, RTBasic; ConnectionsImpl: CEDAR PROGRAM IMPORTS CDSymbolicObjects, RefTab, RefTabExtras, PWPins EXPORTS Connections = BEGIN OPEN Connections; CreateForRopes: PUBLIC PROC [mod: NAT _ 17] RETURNS [Table] ~ { RETURN[RefTab.Create[mod, RefTabExtras.EqualRope, RefTabExtras.HashRope]]}; CreateForRefs: PUBLIC PROC [mod: NAT _ 17] RETURNS [Table] ~ { RETURN[RefTab.Create[mod]]}; Fetch: PUBLIC PROC [table: Table, key: Key] RETURNS [found: BOOL, net: Net] ~ { value: REF; [found, value] _ RefTab.Fetch[table, key]; net _ NARROW[value]}; Store: PUBLIC PROC [table: Table, key: Key, net: Net] RETURNS [BOOL] ~ { RETURN[RefTab.Store[table, key, net]]}; InsertPins: PUBLIC PROC [table: Table, object: CD.Object, pinFilter: PinFilterProc, makeHashKey: HashKeyProc] ~ { EachPin: CDSymbolicObjects.InstEnumerator = { usePin: BOOL _ IF pinFilter = NIL THEN TRUE ELSE pinFilter[inst, object]; IF usePin THEN InsertSegments[table, object, inst, makeHashKey]}; IF object # NIL THEN [] _ PWPins.EnumerateEdgePins[object, EachPin]; }; EnumerateNets: PUBLIC PROC [table: Table, action: EachNetAction] RETURNS [BOOL] ~ { eachPair: RefTab.EachPairAction ~ {quit _ action[key, NARROW [val]]}; RETURN [RefTab.Pairs[table, eachPair]]}; EnumerateSegments: PUBLIC PROC [net: Net, action: EachSegmentAction] RETURNS [quit: BOOL _ FALSE] ~ { FOR l: Segments _ net.segments, l.rest WHILE ~quit AND l # NIL DO segment: Segment _ l.first; quit _ action[net, segment]; ENDLOOP}; InsertSegments: PROC [table: Table, object: CD.Object, instance: CD.Instance, makeHashKey: HashKeyProc] ~ { found: BOOL; val: REF; net: Net; side: RTBasic.Side _ FromSideToSide[PWPins.GetSide[object, instance].side]; rect: CD.Rect _ CDSymbolicObjects.Denotes[instance]; name: Rope.ROPE _ CDSymbolicObjects.GetName[instance]; segment: Segment _ NEW[SegmentRec _ [name: name, object: object, range: CoordsAlongSide[instance, side, object], side: side, layer: CDSymbolicObjects.GetLayer[instance], segmentDat: NIL]]; tabIndex: Rope.ROPE _ IF makeHashKey=NIL THEN name ELSE makeHashKey[instance]; [found, val] _ Fetch[table, tabIndex]; net _ IF ~found THEN NEW[NetRec _ [name: name]] ELSE NARROW[val]; net.segments _ CONS[segment, net.segments]; [] _ Store[table, tabIndex, net]}; CoordsAlongSide: PROC [instance: CD.Instance, side: RTBasic.Side, object: CD.Object] RETURNS [range: Range] ~ { rect: CD.Rect _ CDSymbolicObjects.Denotes[instance]; SELECT side FROM top, bottom => range _ [rect.x1 - object.bbox.x1, rect.x2 - object.bbox.x1]; left, right => range _ [rect.y1 - object.bbox.y1, rect.y2 - object.bbox.y1]; ENDCASE}; FromSideToSide: PROC [side: PWPins.Side] RETURNS [routeSide: RTBasic.Side] = { routeSide _ SELECT side FROM left => left, right => right, top => top, bottom => bottom, ENDCASE => ERROR; }; END. ConnectionsImpl.mesa Copyright Σ 1986, 1987 by Xerox Corporation. All rights reversed. Created by Bryan Preas, May 22, 1986 1:18:54 pm PDT Bertrand Serlet April 27, 1987 0:18:04 am PDT Building The Connection Table Creates new table, whose length is mod. They do the right thing for Rope and Ref tables. looks up key in table, returns associated net (if any) if found is TRUE, net is value associated with given key if found is FALSE, net is NIL returns TRUE after inserting new pair returns FALSE after overwriting old net for existing key-net pair put the pins on the interest rec of the object in the table if pinFilter returns true. [inst: CD.Instance] RETURNS [quit: BOOL _ FALSE] Using The Connection Table enumerates pairs currently in symbol table in unspecified order pairs inserted/deleted during enumeration may or may not be seen applies action to each pair until action returns TRUE or no more pairs returns TRUE if some action returns TRUE enumerates segments currently in net in unspecified order segments inserted/deleted during enumeration may or may not be seen applies action to each segment until action returns TRUE or no more segments returns TRUE if some action returns TRUE Internal Procedures make a segment from a pin (inst) on an object and put it in the table Κ’˜– "Cedar" stylešœ™JšœB™BJšœ0Οk™3Icodešœ-™-—J˜š œ˜ JšœN˜P—J˜šΟnœœ˜Jšœ0˜7Jšœœœ ˜-—head™š žœœœœœ ˜?KšœE˜K—š ž œœœœœ ˜>Kšœ˜Kšœ#Οeœ3™YK˜—š žœœœœ œ˜OKšœ6™6Kšœ œ(™8Kšœ œ ™K˜Kšœœ˜ Kšœ*˜*Kšœœ ˜K˜—š žœœœ$œœ˜HKšœœ™%Kšœœ4™AK˜Kšœ!˜'K˜—šž œœœœ@˜qKšœV™VK˜K˜•StartOfExpansion4 -- [inst: CD.Instance] RETURNS [quit: BOOL _ FALSE]šΠbnœ&˜-Jš œœ œœœ™0Kš œœœ œœœœ˜IJšœœ3˜AJ˜—Jšœ œœ0˜DJšœ˜——™š ž œœœ'œœ˜SKšœ?™?Kšœ@™@Kšœ1œ™FKšœœ™(K˜Kšœ6œ ˜EKšœ"˜(K˜—š žœœœ'œœœ˜eKšœ9™9KšœC™CKšœ4œ™LKšœœ™(J˜š œ$œœœ˜AJšœ˜Jšœ˜Jšœ˜ —J˜——™KšœE™Ešžœœœœ(˜kK˜Kšœœ˜ Kšœœ˜ K˜ KšœK˜KKšœœ,˜4Kšœ œ'˜6Kšœœ œ˜ΌKš œœœ œœœ˜NJšœ'˜'Jš œœœœœœ˜AJšœœ˜+Jšœ"˜"—K˜š žœœ œ'œ œ˜oKšœœ,˜4šœ˜K˜LK˜LKšœ˜ ——J˜–[]šžœœœ˜Nšœ œ˜K˜ Kšœ˜Kšœ ˜ Kšœ˜Kšœœ˜—K˜K˜——Jšœ˜J˜—…— 4Ψ