IFUPWPad144.mesa
Copyright c 1985 by Xerox Corporation. All rights reserved.
Last Edited by Curry, January 28, 1986 3:47:59 pm PST
DIRECTORY
CD,
CDFrame,
CDPinObjects,
IFUPW,
IO,
PW,
PWPins,
Rope;
IFUPWPad144: CEDAR PROGRAM
IMPORTS CDFrame, CDPinObjects, IO, IFUPW, PW, PWPins, Rope
EXPORTS IFUPW =
BEGIN
Pad144ToSideIndex: PUBLIC PROC[pad: INT] RETURNS[side: IFUPW.Side, index: INT] = {
SELECT pad FROM
IN [1..1]  => RETURN[top,   0];
IN [2..36]  => RETURN[left,   36-pad];
IN [37..73] => RETURN[bottom,  pad-37];
IN [74..108] => RETURN[right,  pad-74];
IN [109..144] => RETURN[top,   145-pad];
ENDCASE => ERROR};
Pad144FromSideIndex: PUBLIC PROC[side: IFUPW.Side, index: INT] RETURNS[pad: INT] = {
RETURN[SELECT side FROM
top  => (144-index)MOD 144 +1,
bottom => index+37,
left  => 36-index,
right  => index+74,
ENDCASE => ERROR]};
Pad144: PUBLIC PROC[design: CD.Design, side: IFUPW.Side, index: INT, pad: IFUPW.Pad144Type, data1, data2, enable: Rope.ROPENIL] RETURNS[frame: IFUPW.Frame] = {
labelFound: BOOLFALSE;
findLabelProc: PWPins.InstanceEnumerator ~ {
IF NOT Rope.Equal[CDPinObjects.GetName[inst], "label"] THEN RETURN[FALSE];
labelFound ← TRUE;
pos ← inst.location;
size ← inst.ob.size;
RETURN[TRUE]};
renameProc: PWPins.RenameProc ~ {
IF Rope.Find[oldRope, "vdd",  0, FALSE]#-1 THEN RETURN[oldRope];
IF Rope.Find[oldRope, "gnd",  0, FALSE]#-1 THEN RETURN[oldRope];
IF Rope.Find[oldRope, "dataOut", 0, FALSE]#-1 THEN RETURN[data2];
IF Rope.Find[oldRope, "dataIn", 0, FALSE]#-1 THEN RETURN[data1];
IF Rope.Find[oldRope, "data",  0, FALSE]#-1 THEN RETURN[data1];
IF Rope.Find[oldRope, "enable", 0, FALSE]#-1 THEN RETURN[enable];
ERROR};
pos, size: CD.Position ← [0, 0];
cell, text: CD.Object;
name:  Rope.ROPEIF data1#NIL THEN data1 ELSE data2;
CheckPads[];
IF name#NIL THEN {
[ ] ← PWPins.EnumerateDeepPins[pads[pad], findLabelProc];
text ← IF labelFound
THEN CDFrame.ScaledText[design, name, [size.x, size.y-12], IFUPW.cmosMet]
ELSENIL};
cell ← PWPins.RenamePins[design, pads[pad], renameProc];
IF text#NIL THEN [] ← PW.IncludeInCell
[cell, text, [pos.x+(size.x-text.size.x)/2, pos.y+(size.y-text.size.y)/2]];
SELECT side FROM
top  => { };
left  => cell ← PW.Rot90 [design, cell];
bottom => cell ← PW.Rot180 [design, cell];
right  => cell ← PW.Rot270 [design, cell];
ENDCASE => ERROR;
IF pad=ext
THEN name ← CDFrame.ID["PadExt"]
ELSE IF name=NIL
THEN name ← IO.PutFR["Pad%g", IO.int[ Pad144FromSideIndex[side, index] ] ];
PW.RenameObject[design, cell, name];
frame ← NEW[CDFrame.FrameSeq[0]];
frame.data ← cell;
frame.shell ← CDFrame.ShellFromObject[cell]};
pads: REF ARRAY IFUPW.Pad144Type OF CD.Object;
padDesign: CD.Design ← NIL;
RawPad: PUBLIC PROC[type: IFUPW.Pad144Type] RETURNS[CD.Object] =
{CheckPads[]; RETURN[pads[type]]};
CheckPads: PROC = {
IF padDesign#NIL THEN RETURN;
pads ← NEW[ARRAY IFUPW.Pad144Type OF CD.Object];
padDesign ← PW.OpenDesign["CmosPadLibraryPGA144x.dale"];
pads[ext]   ← PW.Get[padDesign, "Extension"];  -- 8 lambda extension
pads[empty]  ← PW.Get[padDesign, "EmptyPad"];  -- PadVdd PadGnd Vdd Gnd
pads[in]   ← PW.Get[padDesign, "InputPad"];   -- data
pads[out]   ← PW.Get[padDesign, "OutputPad"];  --   dataOut enWt
pads[tri]   ← PW.Get[padDesign, "IOTristatePad"]; -- dataIn dataOut enWt
pads[clock]  ← PW.Get[padDesign, "ClockPad"];   -- data
pads[padgnd] ← PW.Get[padDesign, "PadGndPad"];  -- Gnd
pads[padvdd] ← PW.Get[padDesign, "PadVddPad"];  -- Vdd
pads[gndcnr] ← PW.Get[padDesign, "GndCornerPad"];
pads[vddcnr] ← PW.Get[padDesign, "VddCornerPad"];
pads[gnd]  ← PW.Get[padDesign, "GndPad"];
pads[vdd]  ← PW.Get[padDesign, "VddPad"] };
END.