--File: IPChWidthEstImpl.mesa
Last Edited by: CSChow, January 23, 1985 6:56:48 pm PST
DIRECTORY
Real,
IP,
IPParams,
IPCoTab,
IPCTG,
IPTop,
IPNetTab,
IPChWidthEst;
IPChWidthEstImpl: CEDAR PROGRAM
IMPORTS Real, IPCoTab, IPCTG, IPTop, IPParams, IPNetTab
EXPORTS IPChWidthEst = BEGIN OPEN IPChWidthEst;
SimpleChWidthEstimator: PUBLIC ChWidthEstimator ={
OPEN stat: ch.statistics;
chLength: INTIPCTG.Length[ch];
assemblyLength: INT ← xDim + yDim;
coeff: REAL ← (IF IPCTG.GetType[ch] = hor THEN IPParams.CoeffForHorCh ELSE IPParams.CoeffForHorCh);
RETURN[MAX[
IPParams.ChMinWidth,
Real.RoundLI[coeff * (
(IPParams.WtTotalNetLength * totalNetLength)/assemblyLength +
(IPParams.WtActivePins * stat.activePin)/chLength +
(IPParams.WtNonActivePins * stat.nonActivePin)/chLength +
(IPParams.WtNetFactor * stat.netFactor)/(assemblyLength * Real.SqRt[activeComps + 1])
--Use Real.SqRt[#ActiveComps + 1] to take into account more comps => more nets
-- + 1 incase #ActiveComps = 0
)]]];
}; --SimpleChWidthEstimator
EstimateAndAssignChWidth: PUBLIC PROC[
top: IPTop.Ref,
estimator: ChWidthEstimator,
chNetFactorProc: IPNetTab.ChNetFactorEstimator
] RETURNS [
totalNetLength, totalActivePins, totalNonActivePins, xDim, yDim, activeComps, nonActiveComps: INT] ={
eachChAction: IPCTG.EachChannelAction = {
IPCTG.SetWidth[ch, estimator[ch, totalNetLength, totalActivePins, totalNonActivePins, xDim, yDim, activeComps, nonActiveComps]];
ch.statistics.activePin ← 0;
ch.statistics.nonActivePin ← 0;
ch.statistics.netFactor ← 0.0;
}; --eachChAction
IF IPTop.NoTopology[top] THEN RETURN; --No channels
totalNetLength ← IPNetTab.TotalNetLength[top.nets, chNetFactorProc];
[totalActivePins, totalNonActivePins] ← IPNetTab.CountAllPins[top.nets, TRUE];
xDim ← IPTop.XDim[top];
yDim ← IPTop.YDim[top];
[activeComps, nonActiveComps] ← IPNetTab.CountNets[top.nets];
ComputeChStat[top];
[] ← IPCTG.Channels[top.ctg, eachChAction];
top.initialized ← FALSE;
}; --EstimateAndAssignChWidth1
ComputeChStat: PROC[top: IPTop.Ref] ={
eachCoAction: IPCoTab.EachComponentAction ={
FOR l: LIST OF REF IP.PinNetRep ← co.pinNets, l.rest UNTIL l = NIL DO
FOR pS: LIST OF REF IP.PhysicalPinRep ← l.first.physicalPins, pS.rest UNTIL pS = NIL DO
phyPin: REF IP.PhysicalPinRep ← pS.first;
ch: IPCTG.Channel ← IPCoTab.GetChOnSide[co, phyPin.side, FALSE];
IF ch = NIL THEN LOOP; --phyPin.side = interior
IF phyPin.active
THEN ch.statistics.activePin ← ch.statistics.activePin.SUCC
ELSE ch.statistics.nonActivePin ← ch.statistics.nonActivePin.SUCC;
ENDLOOP;
ENDLOOP;
}; --eachCoAction
IPCoTab.Components[top.coTab, eachCoAction];
}; --ComputeChStat
END.