InsertChipwichPins.mesa
Frank Bowers January 24, 1986 10:59:50 am PST
McCreight, April 14, 1986 2:07:35 pm PST
DIRECTORY
CD,
CDCells,
CDSymbolicObjects,
CMos,
IntStorageDefs,
IO,
ReadCif,
ReadCifUserCmd,
Rope;
InsertChipwichPins: CEDAR PROGRAM
IMPORTS 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.ROPENARROW[userCmd.data];
text: IO.STREAMIO.RIS[userCmdText];
pinName, layer: Rope.ROPENIL;
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;
MyBreakProc: IO.BreakProc = {
RETURN[SELECT char FROM
IN [IO.NUL .. IO.SP], ',, ':, '; => sepr,
'[, '], '(, '), '{, '}, '", '+, '*, '/, '@ => break,
ENDCASE => other]};
FixPinName: PROC RETURNS [name: Rope.ROPE] = {
ros: IO.STREAMIO.ROS[];
ris: IO.STREAMIO.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]];
pinInst ← CDCells.IncludeOb[
design: IF cell = NIL THEN design ELSE NIL,
cell: cell,
ob: pinOb,
position: [center.x/ReadCif.cifUnitsPerLambda+horizAdjust,
center.y/ReadCif.cifUnitsPerLambda+vertAdjust], 
orientation: 0,
cellCSystem: originCoords,
obCSystem: interrestCoords,
mode: dontPropagate].newInst;
CDSymbolicObjects.SetName[pinInst, pinName];
CDSymbolicObjects.SetLayer[pinInst, cdLayer];
};
END.