DIRECTORY
Rope,
Imager USING [Context, PathProc, SetGray, SetXY, ShowRope, MaskBox, MaskStroke],
CDOrient,
IPConstants,
IPParams,
IP,
IPToolBox,
IPPinNets;
IPPinNetsImpl:
CEDAR
PROGRAM
IMPORTS Imager, CDOrient, IP, IPParams, IPToolBox
EXPORTS IPPinNets = BEGIN OPEN TB: IPToolBox, IPPinNets;
PaintPinNets:
PUBLIC
PROC[pNetsOwner: Component, context: Imager.Context, xOffset, yOffset:
REAL ← 0.0, scaleFactor:
REAL ← 1.0, showNames:
BOOL ←
TRUE, size:
NAT ← IPParams.PhyPinRectSize, activeStipple:
CARDINAL ← IPConstants.Black, nonActiveStipple:
CARDINAL ← IPConstants.White] ={
originX, originY, halfDim: REAL;
currentPin: PinNet;
drawPhyPinProc:
PROC[phyPin: PhysicalPin] ={
stipple: CARDINAL ← IF phyPin.active THEN activeStipple ELSE nonActiveStipple;
coordX, coordY: REAL;
[coordX, coordY] ← phyPin.coord;
coordX ← (coordX * scaleFactor) + originX;
coordY ← (coordY * scaleFactor) + originY;
IF stipple = IPConstants.White
THEN {
path: Imager.PathProc ~ {
moveTo[[coordX - halfDim, coordY - halfDim]];
lineTo[[coordX + halfDim, coordY - halfDim]];
lineTo[[coordX + halfDim, coordY + halfDim]];
lineTo[[coordX - halfDim, coordY + halfDim]];
lineTo[[coordX - halfDim, coordY - halfDim]];};
Imager.MaskStroke[context, path];}
ELSE {
Imager.SetGray[context, stipple];
Imager.MaskBox[context, [coordX - halfDim, coordY - halfDim, coordX + halfDim, coordY + halfDim]];};
IF showNames
THEN {
Imager.SetXY[context, [coordX - halfDim, coordY + (1.25 * halfDim)]];
Imager.ShowRope[context, currentPin.name]};
}; --drawPhyPinProc
[[originX, originY]] ← IPToolBox.GetCoOrigin[pNetsOwner];
originX ← xOffset + (originX * scaleFactor);
originY ← yOffset + (originY *scaleFactor);
halfDim ← (scaleFactor * size)/2.0;
FOR l: PinNets ← pNetsOwner.pinNets, l.rest
UNTIL l =
NIL
DO
currentPin ← l.first;
FOR phyPins: PhysicalPins ← currentPin.physicalPins, phyPins.rest
UNTIL phyPins =
NIL
DO
drawPhyPinProc[phyPins.first];
ENDLOOP;
ENDLOOP;
}; --PaintPinNets
OrientPinNets:
PUBLIC
PROC [pNetsOwner: Component, operation:
IP.Orientation] ={
coDimX, coDimY: NAT;
[coDimX, coDimY] ← IPToolBox.GetCoDim[pNetsOwner];
FOR l: PinNets ← pNetsOwner.pinNets, l.rest
UNTIL l =
NIL
DO
TB.OrientPhysicalPins[l.first.physicalPins, [coDimX, coDimY], operation]
ENDLOOP;
}; --OrientPinNets
MirrorPinNets:
PUBLIC
PROC[pNetsOwner: Component, mirrorOrient:
IP.OrientationTypes] ={
coDimX, coDimY: NAT;
[coDimX, coDimY] ← IPToolBox.GetCoDim[pNetsOwner];
FOR l: PinNets ← pNetsOwner.pinNets, l.rest
UNTIL l =
NIL
DO
TB.MirrorXPhysicalPins[l.first.physicalPins, [coDimX, coDimY]];
ENDLOOP;
IF mirrorOrient = hor
THEN {
FOR l: PinNets ← pNetsOwner.pinNets, l.rest
UNTIL l =
NIL
DO
TB.Rotate90PhysicalPins[l.first.physicalPins, [coDimX, coDimY], 2]
ENDLOOP;
}; --endIF
}; --MirrorPinNets
Rotate90PinNets:
PUBLIC PROC [pNetsOwner: Component, numberOfRot:
INT ← 1] ={
coDimX, coDimY: NAT;
[coDimX, coDimY] ← IPToolBox.GetCoDim[pNetsOwner];
FOR l: PinNets ← pNetsOwner.pinNets, l.rest
UNTIL l =
NIL
DO
TB.Rotate90PhysicalPins[l.first.physicalPins, [coDimX, coDimY], numberOfRot]
ENDLOOP;
}; --Rotate90PinNets
--Operation on PinNet(s)
AddPinNetsToNets:
PUBLIC
PROC [pinNets: PinNets] = {
WHILE pinNets #
NIL
DO
net: Net ← pinNets.first.net;
net.pinNets ← CONS[pinNets.first, net.pinNets];
pinNets ← pinNets.rest;
ENDLOOP;
}; --AddPinNet
RemPinNetsFromNets:
PUBLIC
PROC [pinNets: PinNets] ={
WHILE pinNets #
NIL
DO
RemPinNetFromNet[pinNets.first, pinNets.first.net];
pinNets ← pinNets.rest;
ENDLOOP;
};--RemPinNetsFromNets
--Operation on individual PinNet
RemPinNetFromNet:
PROC[pinNet: PinNet, net: Net] ={
lHd, lTl: PinNets;
lHd ← lTl ← CONS[NIL, NIL];
FOR l: PinNets ← net.pinNets, l.rest
UNTIL l =
NIL
DO
IF l.first = pinNet
THEN {lTl.rest ← l.rest; EXIT}
ELSE {lTl.rest ← LIST[l.first]; lTl ← lTl.rest};
REPEAT
FINISHED => ERROR IP.Error[missingRegistration];
ENDLOOP;
net.pinNets ← lHd.rest;
}; --RemPinNet
EnumPhysicalPins:
PUBLIC
PROC[pinNets: PinNets, action: EachPhysicalPinAction] ={
WHILE pinNets #
NIL
DO
FOR pS: PhysicalPins ← pinNets.first.physicalPins, pS.rest
UNTIL pS =
NIL
DO
IF action[pS.first] THEN RETURN;
ENDLOOP;
pinNets ← pinNets.rest;
ENDLOOP;
}; --PhysicalPins
END.