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 = HashTable.Table; -- A HashTable with operations
SeqIndex: TYPE = HashTable.SeqIndex;
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
];
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
];
Range:
TYPE =
RECORD [
min, max: INT -- range of segment along side
];
Building The Connection Table
CreateForRopes: PROC [mod: SeqIndex ← 17] RETURNS [Table];
CreateForRefs:
PROC [mod: SeqIndex ← 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:
BOOLEAN, 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 [
BOOLEAN];
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: BOOLEAN ← TRUE];
HashKeyProc: TYPE = PROC [instance: CD.Instance] RETURNS [key: Rope.ROPE];
Using The Connection Table
EnumerateNets:
PROC [table: Table, action: EachNetAction]
RETURNS [quit:
BOOLEAN];
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: BOOLEAN ← FALSE];
EnumerateSegments:
PROC [net: Net, action: EachSegmentAction]
RETURNS [quit:
BOOLEAN];
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: BOOLEAN ← FALSE];
END.