RouteChannel.mesa
Copyright Ó 1985, 1987 by Xerox Corporation. All rights reserved.
by Bryan Preas July 10, 1985 6:57:00 pm PDT
last edited by Bryan Preas April 3, 1987 3:22:10 pm PST
Christian Le Cocq February 10, 1988 12:29:56 pm PST
DIRECTORY CD, DABasics, Rope, Route, RouteDiGraph, RoutePrivate, RTBasic;
RouteChannel: CEDAR DEFINITIONS = {
maxTrack: NAT = 600; -- MUST be even!!!
maxPinsOnCh: NAT = 2000;
ZMaxTracks: TYPE = NAT[0 .. maxTrack];
MaxTracks: TYPE = NAT[1 .. maxTrack];
MPinsOnCh: TYPE = NAT[1 .. maxPinsOnCh];
ZMPinsOnCh: TYPE = NAT[0 .. maxPinsOnCh];
ChanSideOrNone: TYPE = {none, chanBottom, chanTop, chanLeft, chanRight};
ChanSide: TYPE = ChanSideOrNone[chanBottom .. chanRight];
ChanSideName: ARRAY ChanSide OF Rope.ROPE;
ChanLRSide: TYPE = ChanSide[chanLeft .. chanRight];
ChanTBSide: TYPE = ChanSide[chanBottom .. chanTop];
AboveOrBelow: TYPE = {above, below};
AboveOrBelowName: ARRAY AboveOrBelow OF Rope.ROPE;
GoingDirection: TYPE = {leftToRight, rightToLeft};
GoingName: ARRAY GoingDirection OF Rope.ROPE;
RoutingChannelSides: TYPE = REF RoutingChannelSidesRec;
RoutingChannelSidesRec: TYPE = RECORD [
routeAreaCoord: DABasics.Number ← 0,
extSide: DABasics.Side,
barrierList: ARRAY RoutePrivate.RoutingLayer OF RTBasic.PQRectList ← ALL[NIL],
enclosingBarrier: RTBasic.PQRect ← [[0, 0], [0, 0]]
];
RoutingChannelPins: TYPE = REF RoutingChannelPinsRec;
RoutingChannelPinsRec: TYPE = RECORD [
cEnd1,
cEnd2: DABasics.Number ← 0,
count: ZMPinsOnCh ← 0,
size: ZMPinsOnCh ← maxPinsOnCh,
sides: ARRAY MPinsOnCh OF PinPosition ← ALL[NIL]
];
ChanParms: TYPE = REF ChanParmsRec;
ChanParmsRec: TYPE = RECORD [
maxToConvert,
emptyTrackLimit: DABasics.Number
];
RoutingChannelTracks: TYPE = REF RoutingChannelTracksRec;
RoutingChannelTracksRec: TYPE = RECORD [
count,
maxCount: ZMaxTracks ← 0,
size: ZMaxTracks ← maxTrack,
tracks: ARRAY MaxTracks OF Track
];
Track: TYPE = REF TrackRec;
TrackRec: TYPE = RECORD [
oldTrackNum,
trackNum: ZMaxTracks ← 0,
trackPos,
maxFeatureOnTrack: INT ← 0,
firstSeg: Segment ← NIL,
blocked: BOOLEANFALSE,
keep: BOOLEANFALSE
];
Segment: TYPE = REF SegmentRec;
SegmentRec: TYPE = RECORD [
exteriorPins: ARRAY ChanLRSide OF ChanPin ← ALL[NIL],
interiorPins: ChanPinList ← NIL,
routingLayer: RoutePrivate.RoutingLayer ← trunk,
qWidth: NAT ← 0,
constraintNode: RouteDiGraph.Node ← NIL,
trackNum,
trackConstraint,
secTrackConstraint: ZMaxTracks ← 0,
nextSeg: Segment ← NIL,
net: RoutePrivate.Net ← NIL,
part: INT ← 1,
failed,
exitBreak: BOOLEANFALSE
];
SegmentList: TYPE = LIST OF Segment;
SegmentConstraint: TYPE = REF SegmentConstraintRec;
SegmentConstraintRec: TYPE = RECORD [
name: Rope.ROPENIL,
segment: Segment
];
PinPosition: TYPE = REF PinPositionRec;
PinPositionRec: TYPE = RECORD [
pinIndex: ZMPinsOnCh,
pLoc: DABasics.Number ← 0,
blocked: BOOLEANFALSE,
pins: ARRAY ChanTBSide OF ChanPin ← ALL[NIL],
innerPins: ChanPinList ← NIL
];
ChanPinType: TYPE = {noPin, chanConnect, dogLeg, compPin, exitPin};
ChanPin: TYPE = REF ChanPinRec;
ChanPinRec: TYPE = RECORD [
pinSide: ChanSideOrNone,
qLoc: DABasics.Number ← 0,
pWidth: NAT ← 0,
kindOfPin: ChanPinType,
pinPosition: PinPosition,
trackConstraint: ZMaxTracks ← 0, -- track Consdtraint of segment attached to pin
conctSeg: ARRAY ChanLRSide OF Segment ← ALL[NIL],
altConctSeg: ARRAY ChanLRSide OF Segment ← ALL[NIL], -- used only if non pin dog leg outside range
pin: InternPin ← NIL
];
ChanPinList: TYPE = LIST OF ChanPin;
ChannelData: TYPE = REF ChannelDataRec;
ChannelDataRec: TYPE = RECORD [
constraints: RouteDiGraph.Graph ← NIL,
chanSides: ARRAY ChanSide OF RoutingChannelSides ← ALL[NIL],
chanTracks: RoutingChannelTracks ← NIL,
chanPins: RoutingChannelPins ← NIL,
chanParms: ChanParms ← NIL
];
InternPin: TYPE = REF InternPinRec;
InternPinRec: TYPE = RECORD[
name: Rope.ROPE,
chanSide: ChanSide,
location: RTBasic.PQPos,
pWidth: NAT,
layer: RoutePrivate.RoutingLayer,
pin: Route.Pin ← NIL
];
InternPinList: TYPE = LIST OF InternPin;
Density: TYPE = REF DensityRec;
DensityRec: TYPE = RECORD [
maxDensity: DABasics.Number ← 0,
values: ARRAY MPinsOnCh OF DABasics.Number ← ALL[0]
];
channel routing method
TrackSequence: TYPE = {start, outsideInTop, outsideInBottom, botToTop, topToBot};
DirectionSequence: TYPE = {start, leftToRight, rightToLeft, alternateLeft, alternateRight};
Method: TYPE = REF MethodRec;
MethodRec: TYPE = RECORD[
trackSequence: TrackSequence ← start,
directionSequence: DirectionSequence ← start
];
trackSequenceName: ARRAY TrackSequence OF Rope.ROPE;
directionSequenceName: ARRAY DirectionSequence OF Rope.ROPE;
InitChannel: PROC [extSidesData: RoutePrivate.RoutingAreaSides,
parms: RoutePrivate.RoutingAreaParms,
rules: Route.DesignRules,
netTab: RoutePrivate.NetTab,
signalSinglePinNets,
signalCoincidentPins: BOOLEANTRUE,
okToDiddleLLPins,
okToDiddleURPins: BOOLEANFALSE]
RETURNS [chanData: RouteChannel.ChannelData];
Initialize for channel routing
FindPinPos: PROC [chanPins: RoutingChannelPins, thisPLoc: DABasics.Number] RETURNS [index: ZMPinsOnCh];
build the PinPosition data structure for this pin at thisPLoc.
NOTE: NOT intended for general use !!!
GenerateConstraints: PROC [chanData: ChannelData,
parms: RoutePrivate.RoutingAreaParms,
rules: Route.DesignRules,
routerUsed: RoutePrivate.RouterUsed]
RETURNS [anythingToDo: BOOLEAN];
run through the pins on the channel,
create segment constraints from the pin to pin relationships
TopoWiring: PROC [chanData: RouteChannel.ChannelData,
parms: RoutePrivate.RoutingAreaParms,
rules: Route.DesignRules,
opt: Route.Optimization]
RETURNS [routingResult: Route.ResultData];
channel route the routing area
EnumTracks: PROC [chanTracks: RoutingChannelTracks, eachAction: EachTrackActionProc] RETURNS [quit: BOOLEANFALSE];
EachTrackActionProc: TYPE = PROC [track: Track, trackIndex: MaxTracks] RETURNS [quit: BOOLEANFALSE];
EnumPins: PROC [pinPosition: PinPosition, eachAction: EachPinActionProc] RETURNS [quit: BOOLEANFALSE];
EnumPinsOnSeg: PROC [seg: Segment, eachAction: EachPinActionProc] RETURNS [quit: BOOLEANFALSE];
EachPinActionProc: TYPE = PROC[pinPosition: PinPosition, pin: ChanPin] RETURNS [quit: BOOLEANFALSE];
EnumPinPositions: PROC [chanPins: RoutingChannelPins, eachAction: EachPinPositionActionProc] RETURNS [quit: BOOLEANFALSE];
EachPinPositionActionProc: TYPE = PROC[pinPosition: PinPosition, pinIndex: MPinsOnCh] RETURNS [quit: BOOLEANFALSE];
EnumSegmentsProc: TYPE = PROC [
parms: RoutePrivate.RoutingAreaParms,
name: Rope.ROPE,
pos1, pos2: DABasics.Position,
width: DABasics.Number,
layer: CD.Layer]; -- Call back for wiring segments
EnumViasProc: TYPE = PROC [
parms: RoutePrivate.RoutingAreaParms,
name: Rope.ROPE,
pos, size: DABasics.Position, -- rectangle of size centered on pos
layer1, layer2: CD.Layer]; -- Call back for branch ends
EnumIncompletesProc: TYPE = PROC [
parms: RoutePrivate.RoutingAreaParms,
name: Rope.ROPE,
pos1, pos2: DABasics.Position]; -- Call back for incomplete connections
GetRouting: PROC [chanData: RouteChannel.ChannelData,
parms: RoutePrivate.RoutingAreaParms,
rules: Route.DesignRules,
rect: DABasics.Rect,
brokenNetName: Route.BrokenNetProc,
channelData: REF ANY,
enumSegments: EnumSegmentsProc,
enumVias: EnumViasProc,
enumIncompletes: EnumIncompletesProc];
Enumerate routing results entities
RetrieveSegments: EnumSegmentsProc;
RetrieveVias: EnumViasProc;
RetrieveIncompletes: EnumIncompletesProc;
Destroy: PROC [chanData: ChannelData];
Remove circular references so garbage collection can work
ClearChan: PROCEDURE[chanData: ChannelData];
initialize for one channel routing
TrackLoc: PROC [chanTracks: RoutingChannelTracks, parms: RoutePrivate.RoutingAreaParms, rules: Route.DesignRules, track: ZMaxTracks] RETURNS [loc: DABasics.Number];
get location of the specified track
TrackSeg: PROC [chanTracks: RoutingChannelTracks, track: MaxTracks] RETURNS [Segment];
get first segment on the specified track
TrackSegAbs: PROC [chanTracks: RoutingChannelTracks, track: MaxTracks] RETURNS [Segment];
get first segment on the specified track without indirect reference
ChannelWidth: PROC [chanTracks: RoutingChannelTracks, parms: RoutePrivate.RoutingAreaParms, rules: Route.DesignRules] RETURNS [DABasics.Number];
returns the width of th channel
InfluenceTracks: PROC [rules: Route.DesignRules, wireWidth: NAT] RETURNS [NAT];
find how far a track can influence another track ( in tracks)
ExtSideToIntSide: PROC [rules: Route.DesignRules, extSide: DABasics.Side] RETURNS [intSide: ChanSide];
convert a position from x-y to p-q space.
IntSideToExtSide: PROC [rules: Route.DesignRules, intSide: ChanSide] RETURNS [extSide: DABasics.Side];
convert a position from p-q to x-y space.
WriteConstraints: PROC [graph: RouteDiGraph.Graph];
write the constraint graph on the terminal
GetPinsOnSeg: PROC [seg: Segment] RETURNS [pinList: ChanPinList];
find all of the segments attached to a pin
GetSegsOnPin: PROC [pin: ChanPin] RETURNS [segList: SegmentList];
find all of the segments attached to a pin
DestroyOldConstraints: PROC [chanData: ChannelData];
must explicitly destroy the old data
ComputeDensity: PROC [chanPins: RoutingChannelPins, rules: Route.DesignRules] RETURNS [density: Density];
compute the track density for the current channel
Length: PROC [seg: Segment] RETURNS [DABasics.Number];
return lenth of line segment from pos1 to pos2.
SegRange: PUBLIC PROC [seg: RouteChannel.Segment] RETURNS [range: RTBasic.Range];
return lent of line segment from pos1 to pos2.
WriteResult: PROC [result: Route.ResultData,
parms: RoutePrivate.RoutingAreaParms,
rules: Route.DesignRules,
method: Method];
write the results
FindConstraintLimits: PROC [
chanPins: RoutingChannelPins,
parms: RoutePrivate.RoutingAreaParms,
rules: Route.DesignRules,
nextLower, nextHigher: MPinsOnCh,
pinAction: EachPinActionProc]
RETURNS [minLimit, maxLimit: MPinsOnCh];
find the limits for constraints
CheckPins: PROCEDURE[seg: Segment, pin: ChanPin, sideOfSeg: ChanLRSide];
make sure a pin points back to segment
CheckSegs: PROCEDURE[seg: Segment, pin: ChanPin];
make sure a segment points back to pin
AuditPins: PROC [chanPins: RouteChannel.RoutingChannelPins];
make sure pin data is consistent
AuditSegs: PROC [chanTracks: RoutingChannelTracks];
make sure seg data is consistent
Combine: PROCEDURE [l1, l2, l3: ChanPinList] RETURNS [l: ChanPinList ← NIL];
MembRopeList: PROCEDURE [ref: Rope.ROPE, list: LIST OF Rope.ROPE] RETURNS [BOOL];
GetRange: PROC [pinList: ChanPinList] RETURNS [range: RTBasic.Range];
get the range of the pins in the pinList
PinsOnSide: PROC [seg: Segment] RETURNS [left, top, right, bottom: BOOLEAN];
}.