IFUPWGVCell.mesa,
Copyright c 1985 by Xerox Corporation. All rights reserved.
Last Edited by Curry, June 6, 1985 0:50:49 am PDT
DIRECTORY
Basics,
CD,
CDDirectory,
CDPinObjects,
IFUPW,
PW,
PWBasics;
IFUPWGVCell: CEDAR PROGRAM
IMPORTS
CDDirectory, CDPinObjects, IFUPW, PW, PWBasics
EXPORTS IFUPW =
BEGIN OPEN IFUPW;
IFUGVCellRow: PUBLIC PROC [
design: CD.Design,
name:  PW.ROPE,
ctl:  List,
type:  LIST OF REF,
top:  LIST OF REF,
in:   LIST OF REF,
out:  LIST OF REF,
bot:  LIST OF REF,
seq:  BOOLFALSE ]
RETURNS [cellName: PW.ObjName] = {
cells: LIST OF PW.ObjName;
FOR ii: INT DECREASING IN [0..rngByte*rngBit) DO
byte, index: INT;
[byte, index] ← IFUPW.ByteBitFromIndex[ii, seq];
cells ← CONS[ GVCell[
design: design,
type:  ExpandList[byte, index, type],
top:  ExpandList[byte, index, top],
in:   ExpandList[byte, index, in],
out:  ExpandList[byte, index, out],
bot:  ExpandList[byte, index, bot]], cells];
ENDLOOP;
cellName ← IFUPW.AbutListX[design, cells];
cellName ← IFUPW.AssignRowPinsAndRename
[design, cellName, name, FALSE, top, bot, ctl, seq];
RETURN[cellName]};
GVCell: PUBLIC PROC [
design: CD.Design,
type:   List,
top:  List,
in:   List,
out:  List,
bot:  List ]
RETURNS [cellName: PW.ObjName] = {
topY, in1Y, in2Y, outY, botY: INT ← 0;
cell:  CD.ObPtr;
typeN: PW.ROPE ← type.first;
in1N:  PW.ROPE ← IF in=NIL THEN NIL ELSE in.first;
in2N:  PW.ROPE ← IF in=NIL THEN NIL ELSE IF in.rest=NIL THEN NIL ELSE in.rest.first;
outN:  PW.ROPE ← IF out=NIL THEN NIL ELSE out.first;
top ← FixGVInList[top];
bot ← FixGVInList[bot];
cellName ← UniqueCellName[typeN, top, bot, in, out];
IF CDDirectory.Fetch[design, cellName].found THEN RETURN[cellName];
PWBasics.Output["."];
cell ← PWBasics.ObjFromName[
design: design,
name:  PW.Inst[
name:    typeN,
conds:    (IF outN=NIL THEN LIST["Body"] ELSE NIL),
removeNamed: TRUE]];
topY ← PWBasics.GetISize[cell].y;
IF outN#NIL THEN{
pinApl: CD.ApplicationPtr ← CDPinObjects.FindPins[cell, "Out"].first;
outY       ← pinApl.location.y;
CDPinObjects.SetName[pinApl, NIL];
IF in1N#NIL THEN {
pinApl ← CDPinObjects.FindPins[cell, "In1"].first;
in1Y  ← pinApl.location.y;
CDPinObjects.SetName[pinApl, NIL]};
IF in2N#NIL THEN {
pinApl ← CDPinObjects.FindPins[cell, "In2"].first;
in2Y  ← pinApl.location.y;
CDPinObjects.SetName[pinApl, NIL] } };
IOConnect[cell, top, in1N, in2N, outN, bot, 0, topY, in1Y, in2Y, outY, botY ];
PWBasics.RepositionCell[design, cell];
[ ] ← CDDirectory.Rename[design, cell, cellName];
RETURN[cellName] };
NandTest: PROC[design: CD.Design] RETURNS[cell: PW.ObjName] = {
cell ← GVCell[
enable: NIL,
disable: NIL,
type:  LIST["GVNand"],
top:  LIST["A", "B", NIL, "D"],
in1:  LIST["A"],
in2:  LIST["B"],
out:  LIST["C"],
bot:  LIST[NIL, "C", NIL, "D"],
design: design ] };
LatchTest: PROC[design: CD.Design] RETURNS[cell: PW.ObjName] = {
cell ← GVCell[
enable: "En",
disable: "VBB",
type:  LIST["GVLatch"],
top:  LIST[NIL, "C", NIL, "D"],
in1:  LIST["A"],
in2:  NIL,
out:  LIST["D"],
bot:  LIST["A", "C", NIL, "D"],
design: design ] };
END.