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;
Connections: CEDAR DEFINITIONS = BEGIN
Theory
This interface provides a simple way to describe interconnection requirements among a group of Objects to be laid out.
Common Types
ROPE: TYPE = Rope.ROPE;
Side: TYPE ~ RTBasic.Side;
Object: TYPE = CD.Object;
Layer: TYPE = CD.Layer;
Types
Table: TYPE = RefTab.Ref;  -- A RefTab with operations
Key: TYPE = REF;
Net: TYPE = REF NetRec;
NetRec: TYPE = RECORD [
name: ROPENIL,     -- required to be unique among the nets
width: INT ← 0,      -- 0 default means minimum size
segments: Segments ← NIL,  -- pins for this net
netDat: REF ANYNIL   -- for client use
];
Segments: TYPE = LIST OF Segment;
Segment: TYPE = REF SegmentRec;
SegmentRec: TYPE = RECORD [
name: Rope.ROPENIL,  -- 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 ANYNIL-- 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: BOOLTRUE];
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: BOOLFALSE];
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: BOOLFALSE];
END.