<> <> <> DIRECTORY DABasics, CD, Core, CoreFlat, CoreGeometry, RefTab, Rope, RTBasic, RTCoreUtil; RTStructure: CEDAR DEFINITIONS IMPORTS RTCoreUtil, RefTab = 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 = RefTab.Ref; -- A RefTab 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: Core.Properties _ 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: DABasics.Position _ [0, 0], -- current position of instance orientation: DABasics.Orientation _ original, -- current orientation object: Object _ NIL, -- the object definition iPins: InstancePins _ NIL, -- bindings for pins for this instance properties: Core.Properties _ 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: Core.Properties _ 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: Core.Properties _ 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: Core.Properties _ 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: Core.Properties _ 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: NAT _ 17, netWidth: NetWidthProc _ WidestPinProc, properties: Core.Properties _ 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[RefTab.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[RefTab.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[RefTab.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[RefTab.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: DABasics.Position]; <> <> FetchNet: PROC [structure: Structure, key: Key] RETURNS [found: BOOLEAN, net: Net]; <> <> <> StoreNet: PROC [structure: Structure, key: Key, net: Net] RETURNS [BOOLEAN] = INLINE{RETURN[RefTab.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[RefTab.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 [root: Core.CellType, flattenCellType: RTCoreUtil.FlattenCellTypeProc _ RTCoreUtil.defaultFlatten, instanceName: InstanceName, wireName: WireName, interestingProperties: RTCoreUtil.PropertyKeys _ NIL, decoration: CoreGeometry.Decoration, libDesign: CD.Design _ NIL, properties: Core.Properties _ NIL] RETURNS [structure: Structure]; <> <> <> <> <> <> <> <<>> InstanceName: TYPE ~ PROC [root: Core.CellType, flatCellType: CoreFlat.FlatCellTypeRec] RETURNS [Rope.ROPE]; WireName: TYPE ~ PROC [root: Core.CellType, flatWire: CoreFlat.FlatWireRec] RETURNS [Rope.ROPE]; InsertPublic: PROC [structure: Structure, name: Rope.ROPE, cdObject: CD.Object, pinFilter: CDPinFilterProc _ NIL, userData: REF ANY _ NIL, makeHashKey: HashKeyProc _ NIL]; <> < keep all pins on object.>> InsertInstance: PROC [structure: Structure, name: Rope.ROPE, position: DABasics.Position, orientation: DABasics.Orientation, cdObject: CD.Object, pinFilter: CDPinFilterProc _ NIL, userData: REF ANY _ NIL, makeHashKey: HashKeyProc _ NIL]; <> < keep all pins on object.>> 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]; END.