RouteChannel:
CEDAR
DEFINITIONS =
BEGIN
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 [
sideOrg, sideFiducial: RoutePrivate.PQPosition ← [0, 0],
routeAreaCoord: Route.Number ← 0,
extSide: Route.Side,
barrierList: ARRAY RoutePrivate.RoutingLayer OF RoutePrivate.PQRectList ← ALL[NIL],
enclosingBarrier: RoutePrivate.PQRect ← [[0, 0], [0, 0]],
properties: Route.PropList ← NIL];
RoutingChannelPins: TYPE = REF RoutingChannelPinsRec;
RoutingChannelPinsRec:
TYPE =
RECORD [
cEnd1, cEnd2: Route.Number ← 0,
count: ZMPinsOnCh ← 0,
size: ZMPinsOnCh ← maxPinsOnCh,
sides: ARRAY MPinsOnCh OF PinPosition ← ALL[NIL]];
ChanParms: TYPE = REF ChanParmsRec;
ChanParmsRec:
TYPE =
RECORD [
maxToConvert, emptyTrackLimit: Route.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: Route.Number ← 0,
firstSeg: Segment ← NIL,
blocked: BOOLEAN ← FALSE,
keep: BOOLEAN ← FALSE];
Segment: TYPE = REF SegmentRec;
SegmentList: TYPE = LIST OF Segment;
SegmentRec:
TYPE =
RECORD [
exteriorPins: ARRAY ChanLRSide OF ChanPin ← ALL[NIL],
interiorPins: ChanPinList ← NIL,
routingLayer: RoutePrivate.RoutingLayer ← trunk,
qWidth: Route.Number ← 0,
constraintNode: RouteDiGraph.Node ← NIL,
trackNum, trackConstraint, secTrackConstraint: ZMaxTracks ← 0,
nextSeg: Segment ← NIL,
net: RoutePrivate.Net ← NIL,
failed, exitBreak: BOOLEAN ← FALSE];
SegmentConstraint: TYPE = REF SegmentConstraintRec;
SegmentConstraintRec:
TYPE =
RECORD [
name: Rope.ROPE ← NIL,
segment: Segment];
PinPosition: TYPE = REF PinPositionRec;
PinPositionRec:
TYPE =
RECORD [
pinIndex: ZMPinsOnCh,
pLoc: Route.Number ← 0,
blocked: BOOLEAN ← FALSE,
pins: ARRAY ChanTBSide OF ChanPin ← ALL[NIL],
innerPins: ChanPinList ← NIL];
ChanPinType: TYPE = {noPin, chanConnect, dogLeg, compPin, exitPin};
ChanPin: TYPE = REF ChanPinRec;
ChanPinList: TYPE = LIST OF ChanPin;
ChanPinRec:
TYPE =
RECORD [
pinSide: ChanSideOrNone,
qLoc, pWidth: Route.Number ← 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];
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;
InternPinList: TYPE = LIST OF InternPin;
InternPinRec:
TYPE =
RECORD[
name: Rope.ROPE,
chanSide: ChanSide,
location: RoutePrivate.PQPosition,
pWidth: Route.Number,
layer: RoutePrivate.RoutingLayer,
pin: Route.Pin ← NIL];
active routing track specification
ActiveTrackSpec: TYPE = REF ActiveTrackSpecRec;
ActiveTrackSpecRec:
TYPE =
RECORD[
track, minActTrack, maxActTrack: RouteChannel.ZMaxTracks ← 0,
going: RouteChannel.GoingDirection ← leftToRight,
freeArea: RouteChannel.AboveOrBelow ← below];
ActiveSegSpec: TYPE = REF ActiveSegSpecRec;
ActiveSegSpecRec:
TYPE =
RECORD[
seg: RouteChannel.Segment ← NIL,
segLayer: RoutePrivate.RoutingLayerOrNone ← trunk];
Density: TYPE = REF DensityRec;
DensityRec:
TYPE =
RECORD [
maxDensity: Route.Number ← 0,
values: ARRAY RouteChannel.MPinsOnCh OF Route.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 RouteChannel.TrackSequence OF Rope.ROPE;
directionSequenceName: ARRAY RouteChannel.DirectionSequence OF Rope.ROPE;
InitChannel:
PROCEDURE[routingArea: Route.RoutingArea, sideOrgins: Route.PositionVec, routingRect: Route.Rect, routerUsed: RoutePrivate.RouterUsed];
Initialize for channel routing
FindPinPos:
PROC [routingArea: Route.RoutingArea, thisPLoc: Route.Number]
RETURNS [index: RouteChannel.ZMPinsOnCh];
build the PinPosition data structure for this pin at thisPLoc.
NOTE: NOT intended for general use !!!
GenerateConstraints:
PROCEDURE[routingArea: Route.RoutingArea, routerUsed: RoutePrivate.RouterUsed]
RETURNS [anythingToDo:
BOOLEAN];
run through the pins on the channel,
create segment constraints from the pin to pin relationships
TopoWiring:
PROCEDURE[routingArea: Route.RoutingArea, opt: Route.Optimization]
RETURNS [routingResult: Route.RoutingResult];
channel route the routing area
EnumTracks:
PROC [routingArea: Route.RoutingArea, eachAction: EachTrackActionProc]
RETURNS [quit:
BOOLEAN ←
FALSE];
EachTrackActionProc:
TYPE =
PROC[routingArea: Route.RoutingArea, track: Track, trackIndex: ZMaxTracks]
RETURNS [quit:
BOOLEAN ←
FALSE];
EnumPins:
PROC [routingArea: Route.RoutingArea, pinPosition: PinPosition, eachAction: EachPinActionProc]
RETURNS [quit:
BOOLEAN ←
FALSE];
EnumPinsOnSeg:
PROC [routingArea: Route.RoutingArea, seg: Segment, eachAction: EachPinActionProc]
RETURNS [quit:
BOOLEAN ←
FALSE];
EachPinActionProc:
TYPE =
PROC[routingArea: Route.RoutingArea, pinPosition: PinPosition, pin: ChanPin]
RETURNS [quit:
BOOLEAN ←
FALSE];
EnumSegmentsProc:
TYPE =
PROCEDURE[
routingArea: Route.RoutingArea,
name: Rope.ROPE,
netPart: NAT,
pos1, pos2: Route.Position,
width: Route.Number,
layer: Route.Layer]; -- Call back for wiring segments
EnumPinsProc:
TYPE =
PROCEDURE[
routingArea: Route.RoutingArea,
name: Rope.ROPE,
netPart: NAT,
pos: Route.Position,
layer: Route.Layer,
pin: Route.Pin]; -- Call back for channel pins
EnumViasProc:
TYPE =
PROCEDURE[
routingArea: Route.RoutingArea,
name: Rope.ROPE,
netPart: NAT,
pos, size: Route.Position, -- rectangle of size centered on pos
layer1, layer2: Route.Layer]; -- Call back for tunnel ends
EnumExitsProc:
TYPE =
PROCEDURE[
routingArea: Route.RoutingArea,
name: Rope.ROPE,
netPart: NAT,
pos: Route.Position,
layer: Route.Layer,
pin: Route.Pin,
constructedExit: BOOLEAN]; -- Call back for channel exits
EnumIncompletesProc:
TYPE =
PROCEDURE[
routingArea: Route.RoutingArea,
name: Rope.ROPE,
netPart: NAT,
pos1, pos2: Route.Position]; -- Call back for incomplete connections
GetRouting:
PROCEDURE[
routingArea: Route.RoutingArea,
rect: Route.Rect,
properties: Route.PropList,
EnumSegments: EnumSegmentsProc,
EnumPins: EnumPinsProc,
EnumVias: EnumViasProc,
EnumExits: EnumExitsProc,
EnumIncompletes: EnumIncompletesProc] RETURNS [externalConnections: Route.PinList]; -- Enumerate routing results entities
RetrieveSegments: EnumSegmentsProc;
RetrieveVias: EnumViasProc;
RetrievePins: EnumPinsProc;
RetrieveExits: EnumExitsProc;
RetrieveIncompletes: EnumIncompletesProc;
CleanUp:
PROC [routingArea: Route.RoutingArea];
Remove circular references so garbage collection can work
ClearChan:
PUBLIC PROCEDURE[routingArea: Route.RoutingArea];
initialize for one channel routing
TrackLoc:
PROC [routingArea: Route.RoutingArea, track: RouteChannel.ZMaxTracks]
RETURNS [loc: Route.Number];
get location of the specified track
TrackSeg:
PROC [routingArea: Route.RoutingArea, track: RouteChannel.MaxTracks]
RETURNS [RouteChannel.Segment];
get first segment on the specified track
TrackSegAbs:
PROC [routingArea: Route.RoutingArea, track: RouteChannel.MaxTracks]
RETURNS [RouteChannel.Segment];
get first segment on the specified track without indirect reference
ChannelWidth:
PROC [routingArea: Route.RoutingArea]
RETURNS [Route.Number];
returns the width of th channel
InfluenceTracks:
PROC [routingArea: Route.RoutingArea, wireWidth: Route.Number]
RETURNS [Route.Number];
find how far a track can influence another track ( in tracks)
InfluenceDist:
PROC [routingArea: Route.RoutingArea, wireWidth: Route.Number]
RETURNS [Route.Number];
find how far a wire can influence anything else ( in units)
ExtSideToIntSide:
PROC [routingArea: Route.RoutingArea, extSide: Route.Side]
RETURNS [intSide: RouteChannel.ChanSide];
convert a position from x-y to p-q space.
IntSideToExtSide:
PROC [routingArea: Route.RoutingArea, intSide: RouteChannel.ChanSide]
RETURNS [extSide: Route.Side];
convert a position from p-q to x-y space.
FollowingSeg:
PROCEDURE [routingArea: Route.RoutingArea, activeSegSpec: ActiveSegSpec,
activeTrackSpec: ActiveTrackSpec, includeUnPlaced: BOOLEAN]
RETURNS [nextSegSpec: RouteChannel.ActiveSegSpec];
return the following segment in the current direction
if includeUnPlaced then tracknum must be 0
if ~includeUnPlaced, return the segment present irrespective of wheather its placed
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 [routingArea: Route.RoutingArea];
must explicitly destroy the old data
ComputeDensity:
PROC [routingArea: Route.RoutingArea]
RETURNS [density: Density];
compute the track density for the current channel
Length:
PROC [seg: RouteChannel.Segment]
RETURNS [Route.Number];
return lenth of line segment from pos1 to pos2.
WriteResult:
PROCEDURE [result: Route.RoutingResult, method: Method];
write the results
Overlap:
PROC [r1, r2: RoutePrivate.Range]
RETURNS [overlap: RoutePrivate.Range];
get the overlap of seg1, seg2
Gap:
PROC [r1, r2: RoutePrivate.Range]
RETURNS [gap: RoutePrivate.Range];
get the gap of seg1, seg2
Span:
PROC [r1, r2: RoutePrivate.Range]
RETURNS [result: RoutePrivate.Range];
determnie span of ranges 1 and 2
AddPoints:
PROC [p, s: RoutePrivate.PQPosition]
RETURNS [RoutePrivate.PQPosition] =
--p displaced by d
INLINE {RETURN [RoutePrivate.PQPosition[p: p.p+s.p, q: p.q+s.q]]};
SubPoints:
PROC [pos, neg: RoutePrivate.PQPosition]
RETURNS [RoutePrivate.PQPosition] =
--pos displaced by -neg
INLINE {RETURN [RoutePrivate.PQPosition[p: pos.p-neg.p, q: pos.q-neg.q]]};
FindConstraintLimits:
PROC [routingArea: Route.RoutingArea, nextLower, nextHigher: RouteChannel.MPinsOnCh, pinAction: RouteChannel.EachPinActionProc]
RETURNS [minLimit, maxLimit: RouteChannel.MPinsOnCh];
find the limits for constraints
CheckPins:
PROCEDURE[seg: RouteChannel.Segment,
pin: RouteChannel.ChanPin,
sideOfSeg: RouteChannel.ChanLRSide];
make sure a pin points back to segment
CheckSegs:
PROCEDURE[seg: RouteChannel.Segment,
pin: RouteChannel.ChanPin];
make sure a segment points back to pin
AuditPins:
PROC [routingArea: Route.RoutingArea];
make sure pin data is consistent
AuditSegs:
PROC [routingArea: Route.RoutingArea];
make sure seg data is consistent
Combine:
PROCEDURE [l1, l2, l3: ChanPinList]
RETURNS [l: RouteChannel.ChanPinList ←
NIL]
;
MembRopeList:
PROCEDURE [ref: Rope.
ROPE, list: Route.RopeList]
RETURNS [
BOOL]
;
GetRange:
PROC [pinList: ChanPinList]
RETURNS [range: RoutePrivate.Range];
get the range of the pins in the pinList
PinsOnSide: PROC [routingArea: Route.RoutingArea, seg: RouteChannel.Segment] RETURNS [left, top, right, bottom: BOOLEAN];
END.