Connections.mesa
Copyright Ó 1986, 1987 by Xerox Corporation. All rights reserved.
Created by Bryan Preas, September 9, 1987 1:14:22 pm PDT
Bertrand Serlet April 27, 1987 0:14:30 am PDT
DIRECTORY
CD, RefTab, Rope, RTBasic;
Types
Table: TYPE = RefTab.Ref; -- A RefTab with operations
Key: TYPE = REF;
Net: TYPE = REF NetRec;
NetRec:
TYPE =
RECORD [
name: ROPE ← NIL, -- required to be unique among the nets
width: INT ← 0, -- 0 default means minimum size
segments: Segments ← NIL, -- pins for this net
netDat: REF ANY ← NIL -- for client use
];
Segments: TYPE = LIST OF Segment;
Segment: TYPE = REF SegmentRec;
SegmentRec:
TYPE =
RECORD [
name: Rope.ROPE ← NIL, -- optional name of connection
object: Object ← NIL, -- the owning object
range: Range ← [0, 0], -- in interest coordinate system
side: Side, -- side toward which routing should connect
layer: Layer ← CD.undefLayer,
segmentDat: REF ANY ← NIL -- for client use
];
Range:
TYPE =
RECORD [
min, max: INT -- range of segment along side
];
Building The Connection Table
CreateForRopes: PROC [mod: NAT ← 17] RETURNS [Table];
CreateForRefs:
PROC [mod:
NAT ← 17]
RETURNS [Table];
creates new table, whose length is mod. They do the right thing for Rope and Ref tables.
Fetch:
PROC [table: Table, key: Key]
RETURNS [found:
BOOL, net: Net];
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
Store:
PROC [table: Table, key: Key, net: Net]
RETURNS [
BOOL];
returns TRUE after inserting new pair
returns FALSE after overwriting old net for existing key-net pair
InsertPins:
PROC [table: Table, object:
CD.Object, pinFilter: PinFilterProc ←
NIL, makeHashKey: HashKeyProc ←
NIL];
put the pins on the interest rec of th object in the table if pinFilter returns true.
PinFilterProc: TYPE = PROC [inst: CD.Instance, obj: CD.Object] RETURNS [keepIt: BOOL ← TRUE];
HashKeyProc: TYPE = PROC [instance: CD.Instance] RETURNS [key: Rope.ROPE];
Using The Connection Table
EnumerateNets:
PROC [table: Table, action: EachNetAction]
RETURNS [quit:
BOOL];
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
EachNetAction:
TYPE =
PROC [key: Key, net: Net]
RETURNS [quit:
BOOL ←
FALSE];
EnumerateSegments:
PROC [net: Net, action: EachSegmentAction]
RETURNS [quit:
BOOL];
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
EachSegmentAction: TYPE = PROC [net: Net, segment: Segment] RETURNS [quit: BOOL ← FALSE];