DIRECTORY CD, Core, CoreFlat, CoreGeometry, HashTable, Properties, PWPins, Rope, RTBasic, RTCoreUtil; RTStructure: CEDAR DEFINITIONS IMPORTS RTCoreUtil, HashTable = BEGIN Error: ERROR [errorType: ErrorType _ callingError, explanation: Rope.ROPE _ NIL]; Signal: SIGNAL [signalType: ErrorType _ callingError, explanation: Rope.ROPE _ NIL]; ErrorType: TYPE = {programmingError, callingError, noResource, designRuleViolation, other}; Instances, Objects, Nets, InstancePins, ObjectPins, NetPins: TYPE = HashTable.Table; -- A HashTable for the instances, interconnections and the pins Key: TYPE = REF; Structure: TYPE = REF StructureRec; StructureRec: TYPE = RECORD [ name: Rope.ROPE _ NIL, instances: Instances _ NIL, -- invocations of objects within the cell being laid out objects: Objects _ NIL, -- objects within the cell being laid out nets: Nets _ NIL, -- public and private wires for the cell being laid out outerInstance: Instance _ NIL, -- instance representing next level of heirarchy (if any) netWidth: NetWidthProc _ NIL, properties: Properties.PropList _ NIL ]; NetWidthProc: TYPE = PROC[net: Net, structure: Structure, direction: RTBasic.Direction, context: REF ANY _ NIL] RETURNS [wireWidth: INT]; WidestPinProc: NetWidthProc; Instance: TYPE = REF InstanceRec; InstanceRec: TYPE = RECORD [ name: Rope.ROPE _ NIL, -- should be unique among the instances placed: BOOLEAN _ FALSE, -- indicates if instance has been placed position: CD.Position _ [0, 0], -- current position of instance orientation: CD.Orientation _ original, -- current orientation object: Object _ NIL, -- the object definition iPins: InstancePins _ NIL, -- bindings for pins for this instance properties: Properties.PropList _ NIL, any: REF ANY _ NIL -- for use by client ]; InstancePin: TYPE = REF InstancePinRec; -- specifies binding of pin to net InstancePinRec: TYPE = RECORD [ oPin: ObjectPin _ NIL, net: Net _ NIL ]; HeirarchyLevel: TYPE = {this, nextHigher}; -- next higher indicates a public Object: TYPE = REF ObjectRec; ObjectRec: TYPE = RECORD [ name: Rope.ROPE _ NIL, -- should be unique among the objects cdObject: CD.Object _ NIL, -- the base object definition heirarchyLevel: HeirarchyLevel _ this, -- level of this object oPins: ObjectPins _ NIL, -- bindings for pins for this instance properties: Properties.PropList _ NIL, any: REF ANY _ NIL -- for use by client ]; ObjectPin: TYPE = REF ObjectPinRec; ObjectPinRec: TYPE = RECORD [ name: Rope.ROPE _ NIL, -- optional name of connection heirarchyLevel: HeirarchyLevel _ this, -- level of this object physicalPins: LIST OF PhysicalPin _ NIL, -- physical connections for this logical pin properties: Properties.PropList _ NIL ]; PhysicalPin: TYPE = REF PhysicalPinRec; PhysicalPinRec: TYPE = RECORD [ range: Range _ [0, 0], -- in interest coordinate system side: RTBasic.SideOrNone _ none, -- side toward which routing should connect layer: CD.Layer _ CD.undefLayer, depth: INT _ 0, -- depth of pin into object, 0 if on edge properties: Properties.PropList _ NIL ]; Range: TYPE = RECORD [ min, max: INT -- range of pin along side ]; Net: TYPE = REF NetRec; NetRec: TYPE = RECORD [ name: Rope.ROPE _ NIL, -- should be unique among the nets nPins: NetPins _ NIL, -- pins for this net properties: Properties.PropList _ NIL, any: REF ANY _ NIL -- for use by client ]; NetPin: TYPE = REF NetPinRec; -- binding to instance and pin on object NetPinRec: TYPE = RECORD [ oPin: ObjectPin _ NIL, -- pin on defining object instance: Instance _ NIL -- the owning instance ]; CreateForRopes: PROC [name: Rope.ROPE _ NIL, nInsts, nObjs, nNets, nPubs: HashTable.SeqIndex _ 17, netWidth: NetWidthProc _ WidestPinProc, properties: Properties.PropList _ NIL] RETURNS [Structure]; CreateForRefs: PROC [name: Rope.ROPE _ NIL, nInsts, nObjs, nNets, nPubs: HashTable.SeqIndex _ 17, netWidth: NetWidthProc _ WidestPinProc, properties: Properties.PropList _ NIL] RETURNS [Structure]; FetchInstance: PROC [structure: Structure, key: Key] RETURNS [found: BOOLEAN, instance: Instance]; StoreInstance: PROC [structure: Structure, key: Key, instance: Instance] RETURNS [BOOLEAN] = INLINE{RETURN[HashTable.Store[structure.instances, key, instance]]}; FetchInstancePin: PROC [instance: Instance, key: Key] RETURNS [found: BOOLEAN, iPin: InstancePin]; StoreInstancePin: PROC [instance: Instance, key: Key, iPin: InstancePin] RETURNS [BOOLEAN] = INLINE{RETURN[HashTable.Store[instance.iPins, key, iPin]]}; EnumerateInstances: PROC [structure: Structure, action: EachInstanceAction] RETURNS [quit: BOOLEAN]; EachInstanceAction: TYPE = PROC [key: Key, instance: Instance] RETURNS [quit: BOOLEAN _ FALSE]; EnumerateInstancePins: PROC [instance: Instance, action: EachInstancePinAction] RETURNS [quit: BOOLEAN]; EachInstancePinAction: TYPE = PROC [key: Key, instance: Instance, iPin: InstancePin] RETURNS [quit: BOOLEAN _ FALSE]; FetchObject: PROC [structure: Structure, key: Key] RETURNS [found: BOOLEAN, object: Object]; StoreObject: PROC [structure: Structure, key: Key, object: Object] RETURNS [BOOLEAN] = INLINE{RETURN[HashTable.Store[structure.objects, key, object]]}; FetchObjectPin: PROC [object: Object, key: Key] RETURNS [found: BOOLEAN, oPin: ObjectPin]; StoreObjectPin: PROC [object: Object, key: Key, oPin: ObjectPin] RETURNS [BOOLEAN] = INLINE{RETURN[HashTable.Store[object.oPins, key, oPin]]}; StorePhysicalPin: PROC [oPin: ObjectPin, pPin: PhysicalPin] = INLINE{oPin.physicalPins _ CONS[pPin, oPin.physicalPins]}; EnumerateObjects: PROC [structure: Structure, action: EachObjectAction] RETURNS [quit: BOOLEAN]; EachObjectAction: TYPE = PROC [key: Key, object: Object] RETURNS [quit: BOOLEAN _ FALSE]; EnumerateObjectPins: PROC [object: Object, action: EachObjectPinAction] RETURNS [quit: BOOLEAN]; EachObjectPinAction: TYPE = PROC [key: Key, object: Object, oPin: ObjectPin] RETURNS [quit: BOOLEAN _ FALSE]; EnumeratePhysicalPins: PROC [oPin: ObjectPin, action: EachPhysicalPinAction] RETURNS [quit: BOOLEAN]; EachPhysicalPinAction: TYPE = PROC [oPin: ObjectPin, pPin: PhysicalPin] RETURNS [quit: BOOLEAN _ FALSE]; PosOfObjectPin: PROC [object: Object, pPin: PhysicalPin] RETURNS [position: CD.Position]; FetchNet: PROC [structure: Structure, key: Key] RETURNS [found: BOOLEAN, net: Net]; StoreNet: PROC [structure: Structure, key: Key, net: Net] RETURNS [BOOLEAN] = INLINE{RETURN[HashTable.Store[structure.nets, key, net]]}; FetchNetPin: PROC [net: Net, key: Key] RETURNS [found: BOOLEAN, nPin: NetPin]; StoreNetPin: PROC [net: Net, key: Key, nPin: NetPin] RETURNS [BOOLEAN] = INLINE{RETURN[HashTable.Store[net.nPins, key, nPin]]}; EnumerateNets: PROC [structure: Structure, action: EachNetAction] RETURNS [quit: BOOLEAN]; EachNetAction: TYPE = PROC [key: Key, net: Net] RETURNS [quit: BOOLEAN _ FALSE]; EnumerateNetPins: PROC [net: Net, action: EachNetPinAction] RETURNS [quit: BOOLEAN]; EachNetPinAction: TYPE = PROC [key: Key, net: Net, nPin: NetPin] RETURNS [quit: BOOLEAN _ FALSE]; IsPublic: PROC [net: Net] RETURNS [isPublic: BOOLEAN]; CreateFromCore: PROC [cellType: Core.CellType, flattenCellType: RTCoreUtil.FlattenCellTypeProc _ RTCoreUtil.defaultFlatten, pinFilter: CorePinFilterProc _ NIL, interestingProperties: RTCoreUtil.PropertyKeys _ NIL, userData: REF ANY _ NIL, decoration: CoreGeometry.Decoration, libDesign: CD.Design _ NIL, properties: Properties.PropList _ NIL] RETURNS [structure: Structure]; CorePinFilterProc: TYPE = PROC [wire: Core.Wire, range: Range, side: RTBasic.Side, layer: CD.Layer, userData: REF ANY] RETURNS [keepIt: BOOLEAN _ TRUE]; InsertPublic: PROC [structure: Structure, name: Rope.ROPE, cdObject: CD.Object, pinFilter: CDPinFilterProc _ NIL, userData: REF ANY _ NIL, makeHashKey: HashKeyProc _ NIL]; InsertInstance: PROC [structure: Structure, name: Rope.ROPE, position: CD.Position, orientation: CD.Orientation, cdObject: CD.Object, pinFilter: CDPinFilterProc _ NIL, userData: REF ANY _ NIL, makeHashKey: HashKeyProc _ NIL]; CDPinFilterProc: TYPE = PROC [inst: CD.Instance, obj: CD.Object, userData: REF ANY] RETURNS [keepIt: BOOLEAN _ TRUE]; HashKeyProc: TYPE = PROC [instance: CD.Instance] RETURNS [key: Rope.ROPE]; PrintStructure: PUBLIC PROC [structure: Structure]; CoordsAlongSide: PROC [instance: CD.Instance, object: CD.Object, side: RTBasic.Side] RETURNS [range: Range]; TranslateRange: PROC [instance: Instance, pPin: PhysicalPin] RETURNS [range: Range]; FromSideToSide: PROC [side: PWPins.Side] RETURNS [routeSide: RTBasic.Side]; END. โRTStructure.mesa Copyright (C) 1986 by Xerox Corporation. All rights reserved. Created by Bryan Preas, August 21, 1986 6:23:51 pm PDT Theory This interface provides a simple way to describe the structure in a cell to be laid out. This includes the interconnections (public and private), the instances and their objects, Facilities are providesd to create this structure from a Core cellType as well as a collection of ChipNDale objects with pins ( binding by name in this case). This is intended to be used as an interface to the routers as well as their internal data structure. Errors Types net width is same as width of widest pin Building and Using The Structure Table Creating The Structure Table creates new table, whose length is mod. They do the right thing for Rope and Ref tables. Instance Manipulation looks up key in table, returns associated instance (if any) if found is TRUE, net is value associated with given key if found is FALSE, instance is NIL returns TRUE after inserting new instance returns FALSE after overwriting old instance for existing key-instance pair looks up key in table, returns associated iPin (if any) if found is TRUE, net is value associated with given key if found is FALSE, iPin is NIL returns TRUE after inserting new iPin returns FALSE after overwriting old instancePin for existing key-instance pair enumerates objects currently in symbol table in unspecified order instances inserted/deleted during enumeration may or may not be seen applies action to each object until action returns TRUE or no more pairs returns TRUE if some action returns TRUE enumerates pins on instance in unspecified order pins inserted/deleted during enumeration may or may not be seen applies action to each pin until action returns TRUE or no more pins returns TRUE if some action returns TRUE Object Manipulation looks up key in table, returns associated object (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 object returns FALSE after overwriting old net for existing key-net pair looks up key in table, returns associated objectPin (if any) if found is TRUE, net is value associated with given key if found is FALSE, objectPin is NIL returns TRUE after inserting new objectPin returns FALSE after overwriting old objectPin for existing key-objectPin pair add a new physical pin to a logical pin enumerates objects currently in symbol table in unspecified order instances inserted/deleted during enumeration may or may not be seen applies action to each object until action returns TRUE or no more pairs returns TRUE if some action returns TRUE enumerates pins on object in unspecified order pins inserted/deleted during enumeration may or may not be seen applies action to each segment until action returns TRUE or no more object pins returns TRUE if some action returns TRUE enumerates physical pins on ObjectPin in unspecified order pins inserted/deleted during enumeration may or may not be seen applies action to each segment until action returns TRUE or no more object pins returns TRUE if some action returns TRUE returns position of object Pin wrt the object Net Manipulation 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 looks up key in table, returns associated netPin (if any) if found is TRUE, net is value associated with given key if found is FALSE, netPin is NIL returns TRUE after inserting new netPin returns FALSE after overwriting old net for existing key-netPin pair enumerates nets currently in symbol table in unspecified order nets inserted/deleted during enumeration may or may not be seen applies action to each net until action returns TRUE or no more nets returns TRUE if some action returns TRUE enumerates pins on net in unspecified order pins inserted/deleted during enumeration may or may not be seen applies action to each pin until action returns TRUE or no more pins returns TRUE if some action returns TRUE TRUE iff this tet has a connection to the next higher level Utilities derive the interconnection requirements from a Core data structure. instances: Core cellInstance of flattened object instancePins: Core public wires on associated object objects: Core cellType objectPins: Rope name of defining pins nets: Core actual wires of flattened object netPins: publicWire of flattened object pinFilter = NIL => keep all pins on objects provides client an opportunity to disregard some pins. This is useful when extractor returns some extra publics. construct an instance, an object and put the pins on the interest rec of the object in the structure if pinFilter returns true. makeHashKey can be used to transform the pin names to net names. Ropes are use for keys; this means that CreateForRopes must be used to create the structure used by theis procedure. In addition, the obhect and pins must be named. pinFilter = NIL => keep all pins on object. construct an instance, an object and put the pins on the interest rec of the object in the structure if pinFilter returns true. makeHashKey can be used to transform the pin names to net names. Ropes are use for keys; this means that CreateForRopes must be used to create the structure used by theis procedure. In addition, the obhect and pins must be named. pinFilter = NIL => keep all pins on object. provides client an opportunity to disregard some pins. print the given structure ส s˜Jšœ™Jšœ?™?J™6J˜šฯk œ˜ JšœY˜[—J˜šฯn œœ ˜Jšœ˜ Jš˜—head™Ibodyšœำ™ำL™d—™Jšžœœ9œœ˜QJšžœœ:œœ˜TJšœ œL˜[—™Icodešœ=œฯc@˜•šœœœ˜M˜—Mšœ œœ˜#šœœœ˜Mšœ œœ˜MšœœŸ8˜UMšœœŸ*˜DMšœ œŸ7˜KMšœœŸ9˜YMšœœ˜Mšœ"˜%M˜—MšœœœHœœœœ œ˜‰šž œ˜M™(—˜M˜—Mšœ œœ ˜!šœ œœ˜Mšœ œœŸ(˜AMšœœœŸ(˜BMšœ œŸ˜@Mšœ œŸ˜?MšœœŸ˜0MšœœŸ&˜BMšœ"œ˜&MšœœœœŸ˜)M˜M˜—Mšœ œœŸ"˜Kšœœœ˜Mšœœ˜Mšœ ˜M˜M˜—MšœœŸ!˜LMšœœœ ˜šœ œœ˜Mšœ œœŸ&˜?Mšœ œ œŸ˜9Mšœ'Ÿ˜>MšœœŸ&˜AMšœ"œ˜&MšœœœœŸ˜)M˜M˜—Mšœ œœ˜#šœœœ˜Mšœ œœŸ˜7Mšœ'Ÿ˜>MšœœœœŸ,˜UMšœ"˜%M˜M˜—Mšœ œœ˜'šœœœ˜MšœŸ ˜9Mšœ"Ÿ+˜MMšœœ œ ˜ MšœœŸ)˜;Mšœ"˜%M˜M˜—šœœœ˜Mšœ œŸ˜*Mšœ˜—M˜Mšœœœ˜šœœœ˜Mšœ œœŸ#˜™>Mšœ?™?MšœD™DMšœ(™(—Mš œœœœœœ˜PM˜šžœœ&œœ˜TMšœ+™+Mšœ?™?MšœD™DMšœ(™(—š œœœ$œœœ˜aM˜—šžœœ œœ˜6Mšœ;™;——™ šžœœ‡œ3œ œœœ2œ œ$œœ˜๖JšœC™Cšœ0™0J™4—šœ™J™(—™+Jšœ(™(—šœ+™+J™——šœœœ<œœœœ œœ˜˜M™q—™M˜—šž œœ#œ œ&œ œœœœ˜ซMšœม™มMšœ'žœœ™า—M˜šžœœ#œ œœœ&œ œœœœ˜แMšœม™มMšœ'žœœ™า—M˜šœœœœœœœœ œœ˜uM™6M™—Mš œ œœ œ œ œ˜JM˜šžœœœ˜3Mšœ™—M˜Mš žœœ œœœ˜lM˜šžœœ)œ˜TM˜—šžœœœ˜KM˜——Mšœ˜—…—!2B‡