InsertChipwichPins.mesa
Frank Bowers January 24, 1986 10:59:50 am PST
McCreight, April 14, 1986 2:07:35 pm PST
Christian Jacobi, January 7, 1987 5:22:27 pm PST
InsertChipwichPins:
CEDAR
PROGRAM
IMPORTS CD, CDCells, CDSymbolicObjects, CMos, IO, ReadCif, Rope
EXPORTS ReadCifUserCmd =
BEGIN
ParseUserCmd:
PUBLIC
PROC [userCmd: IntStorageDefs.UserCmd, cell:
CD.Object, design:
CD.Design, reportError: ReadCifUserCmd.ReportErrorProc] = {
userCmdText: Rope.ROPE ← NARROW[userCmd.data];
text: IO.STREAM ← IO.RIS[userCmdText];
pinName, layer: Rope.ROPE ← NIL;
center: CD.Position ← [0, 0];
pinOb: CD.Object ← NIL;
pinInst: CD.Instance ← NIL;
width, height: CARDINAL;
adjust: INT = 4;
vertAdjust, horizAdjust: INT;
cdLayer: CD.Layer ← CMos.met2;
iBase: CD.Position;
MyBreakProc:
IO.BreakProc = {
RETURN[
SELECT char
FROM
IN [IO.NUL .. IO.SP], ',, ':, '; => sepr,
'[, '], '(, '), '{, '}, '", '+, '*, '/, '@ => break,
ENDCASE => other]};
FixPinName:
PROC
RETURNS [name: Rope.
ROPE] = {
ros: IO.STREAM ← IO.ROS[];
ris: IO.STREAM ← IO.RIS[pinName];
char: CHARACTER;
IF Rope.Equal[pinName, "VDD", FALSE] THEN RETURN["Vdd"];
IF Rope.Equal[pinName, "GND", FALSE] THEN RETURN["Gnd"];
WHILE
NOT ris.EndOf[]
DO
SELECT char ←
IO.GetChar[ris]
FROM
IN ['a..'z], IN ['A..'Z], IN ['0..'9] => ros.PutChar[char];
ENDCASE => ros.PutChar['X];
ENDLOOP;
RETURN[ros.RopeFromROS];
IF
IO.GetChar[text] # '4
THEN {
reportError[IO.PutFR["UserCmd %g not defined", IO.int[userCmd.command]], Warning];
RETURN};
pinName ← IO.GetTokenRope[text, MyBreakProc].token;
center.x ← IO.GetInt[text];
center.y ← IO.GetInt[text];
layer ← IO.GetID[text];
SELECT
TRUE
FROM
Rope.Equal[layer, "C62"] => {
width ← height ← 8;
cdLayer ← CMos.met2;
horizAdjust ← -width/2;
vertAdjust ← IF center.y < 0 THEN adjust ELSE -(adjust+height)};
Rope.Equal[layer, "C61"] => {
width ← 4; height ← 20;
cdLayer ← CMos.met;
horizAdjust ← IF center.x < 0 THEN adjust ELSE - (adjust+width);
vertAdjust ← -height/2};
ENDCASE => RETURN;
pinName ← FixPinName[];
pinOb ← CDSymbolicObjects.CreatePin[[width, height]];
iBase ← CD.InterestBase[pinOb];
pinInst ← CDCells.IncludeOb[
design: IF cell = NIL THEN design ELSE NIL,
cell: cell,
ob: pinOb,
trans: [[center.x/ReadCif.cifUnitsPerLambda+horizAdjust-iBase.x,
center.y/ReadCif.cifUnitsPerLambda+vertAdjust-iBase.y], original],
mode: dontResize].newInst;
CDSymbolicObjects.SetName[pinInst, pinName];
CDSymbolicObjects.SetLayer[pinInst, cdLayer];
};