IPPlaceXamplesImpl:
CEDAR
PROGRAM
IMPORTS OrderedRefArray, IPNetTab, IPCoTab, IPCTG, IPTop, IPPlaceKit, IPTopOps
EXPORTS IPPlaceXamples = BEGIN OPEN IPPlaceKit;
ofx1Depth: PUBLIC NAT ← 3;
ofx1Breadth: PUBLIC NAT ← 5;
OrderingFnX1:
PUBLIC IPPlaceKit.OrderingFn ={
comps: Components ← NIL;
depthBreadths: LIST OF IPPlaceKit.DepthBreadthRec ← NIL;
action: IPCoTab.EachComponentAction ={
IF IPCoTab.CoActive[co] THEN RETURN;
comps ← CONS[co, comps];
depthBreadths ← CONS[IPPlaceKit.DepthBreadthRec[ofx1Depth, ofx1Breadth], depthBreadths]
}; --action
IPCoTab.AllComponents[top.coTab, action];
RETURN [comps, depthBreadths]
}; --OrderingFnX1
PlaceEvaluatorX1:
PUBLIC IPPlaceKit.PlaceEvaluator ={
IPTop.Geometrize[top];
IF yetToPlace =
NIL
THEN RETURN [IPNetTab.TotalNetLength[top.nets, NIL]]
ELSE RETURN [0];
}; --PlaceEvaluatorX1
pex2PruneCoeff: PUBLIC REAL ← 0.1; --Use interpreter to change
PlaceEvaluatorX2:
PUBLIC IPPlaceKit.PlaceEvaluator = {
IPTop.Geometrize[top];
IF yetToPlace =
NIL
THEN RETURN [IPNetTab.TotalNetLength[top.nets, NIL]]
ELSE RETURN [0, (IPNetTab.TotalNetLength[top.nets, NIL] * (1.0 + pex2PruneCoeff * IPPlaceKit.CountComps[yetToPlace])) > cutOff];
}; --PlaceEvaluatorX1
pctgX1Keep: PUBLIC NAT ← 4; --Use interpreter to change
PlaceCompTGenX1:
PUBLIC IPPlaceKit.PlaceCompTGen ={
trials: OrderedRefArray.Ref ← OrderedRefArray.Create[pctgX1Keep];
eachChAction:
IPCTG.EachChannelAction ={
eachSite: IPPlaceKit.EachChGrowSiteAction ={
value: INT ← FitEstimator[toPlace.first, ch, negBnd, posBnd].value;
site: REF IPPlaceKit.GrowRec ← NEW[IPPlaceKit.GrowRec ← [toPlace.first, ch, negBnd, posBnd]];
OrderedRefArray.Insert[trials, site, value]
}; --eachSite
IPPlaceKit.AllChGrowSites[ch, eachSite];
};--eachChAction
[] ← IPCTG.Channels[top.ctg, eachChAction, TRUE];
RETURN [trials]
}; --PlaceCompTGenX1
pctgX2Keep: PUBLIC NAT ← 4; --Use interpreter to change
PlaceCompTGenX2:
PUBLIC IPPlaceKit.PlaceCompTGen ={
trials: OrderedRefArray.Ref ← OrderedRefArray.Create[pctgX2Keep];
eachChAction:
IPCTG.EachChannelAction ={
eachSite: IPPlaceKit.EachChGrowSiteAction ={
chSpan, coSpan, value: INT;
site: REF IPPlaceKit.GrowRec;
[chSpan, coSpan, value] ← FitEstimator[toPlace.first, ch, negBnd, posBnd];
IF value > OrderedRefArray.GetPruneValue[trials]
AND chSpan
> coSpan
THEN RETURN [next: TRUE]; -- not in right direction
site ← NEW[IPPlaceKit.GrowRec ← [toPlace.first, ch, negBnd, posBnd]];
OrderedRefArray.Insert[trials, site, value]
}; --eachSite
IPPlaceKit.AllChGrowSites[ch, eachSite];
};--eachChAction
[] ← IPCTG.Channels[top.ctg, eachChAction, TRUE];
RETURN [trials]
}; --PlaceCompTGenX2
FitEstimator:
PROC[co: IPCoTab.Component, refCh, negBnd, posBnd:
IPCTG.Channel]
RETURNS [chSpan, coSpan, value:
INT] ={
-- Used by PlaceCompTGenX1 and PlaceCompTGenX2
chSpanWithSlack: INT ← IPCTG.GetSlack[posBnd].pos - IPCTG.GetSlack[negBnd].neg;
chSpan ← IPCTG.GetCoord[posBnd] - IPCTG.GetCoord[negBnd];
coSpan ← IF IPCTG.GetType[refCh] = hor THEN IPCoTab.GetDim[co].x ELSE IPCoTab.GetDim[co].y;
value ← MIN[ABS[chSpan - coSpan], ABS[chSpanWithSlack - coSpan]];
}; --FitEstimator
RemoveEvaluatorX1:
PUBLIC IPPlaceKit.RemoveEvaluator ={
IPTop.Geometrize[top];
IF yetToRemove =
0
THEN RETURN [IPTop.Area[top]]
ELSE RETURN [0]
}; --RemoveEvaluatorX1
rctgX1Keep: PUBLIC NAT ← 3;
rctgX1ShrnkDn: PUBLIC IPCTG.ChType ← hor;
RemoveCompsTGenX1:
PUBLIC IPPlaceKit.RemoveCompTGen ={
trials: OrderedRefArray.Ref ← OrderedRefArray.Create[rctgX1Keep];
eachCompAction: IPCoTab.EachComponentAction ={
coArea:
INT ← IPPlaceKit.GetComponentArea[co,
TRUE,
FALSE];
--Need more thoughts on counting of corner areas
remTrial: REF ← IPTopOps.Shrink[top, co, rctgX1ShrnkDn, TRUE].fr;
value: INT;
IPTop.Geometrize[top];
value ← IPTop.Area[top] + coArea;
[] ← IPTopOps.Undo1[top]; -- Undo shrink
OrderedRefArray.Insert[trials, remTrial, value]
}; --eachCompAction
IPCoTab.Components[top.coTab, eachCompAction];
RETURN [trials]
}; --RemoveCompsTGenX1
END.