SCOpsImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Written by: Pradeep Sindhu, October 2, 1986 10:52:55 pm PDT
Pradeep Sindhu, May 15, 1987 3:45:56 pm PDT
DIRECTORY
Convert, CoreGeometry, CoreOps, Rope, Sisyph, SCOpsImpl, TilingClass;
SCOpsImpl: CEDAR PROGRAM
IMPORTS Convert, CoreGeometry, CoreOps, Rope, Sisyph, TilingClass
EXPORTS SCOpsImpl
~ BEGIN OPEN SCOpsImpl;
Types
BaseCTIx: TYPE = {0, 1, X, N, E};
Exported Procs
ComLine: PUBLIC PROC [pattern: ROPE, cx: Sisyph.Context] RETURNS [ct: CellType] ~ {
public: Wire;
tileRow: TilingClass.TileRow ← NEW [TilingClass.TileRowRec[Rope.Length[pattern]]];
tileArray: TilingClass.TileArray ← NEW [TilingClass.TileArrayRec[1]];
baseCTNames: ARRAY BaseCTIx OF Rope ← ["ComCell0.icon", "ComCell1.icon", "ComCellX.icon", "ComCellN.icon", "ComCellE.icon"];
baseCTs: ARRAY BaseCTIx OF CellType;
publicElements, arrayedWires, leftSideOnlyWires, rightSideOnlyWires: Wires ← NIL;
EachWire: CoreOps.EachWireProc = {
sides: CoreGeometry.Sides ← CoreGeometry.noSide;
EachPin: CoreGeometry.EachPinProc = {
SELECT side FROM
bottom => sides[bottom] ← TRUE;
top => sides[top] ← TRUE;
left => sides[left] ← TRUE;
right => sides[right] ← TRUE;
ENDCASE => ERROR;
};
IF wire=baseCT.public THEN RETURN;
[] ← CoreGeometry.EnumerateSides[Sisyph.mode.decoration, baseCT, wire, EachPin];
IF sides[top] OR sides[bottom]
THEN {
newPublic: Wire ← CoreOps.CreateWires[count, CoreOps.GetShortWireName[wire]];
arrayedWires ← CONS[wire, arrayedWires];
FOR i: INT IN [0..count) DO
newPublic[i] ← CoreOps.SetShortWireName[CoreOps.CopyWire[wire], NIL];
ENDLOOP;
publicElements ← CONS[newPublic, publicElements];
}
ELSE {
IF sides[left] THEN {leftSideOnlyWires ← CONS[wire, leftSideOnlyWires]; publicElements ← CONS [wire, publicElements]};
IF sides[right] THEN {rightSideOnlyWires ← CONS[wire, rightSideOnlyWires]; publicElements ← CONS [wire, publicElements]}
}
};
Extract each of the baseCT's
FOR i: BaseCTIx IN [0..E] DO baseCTs[i] ← Sisyph.ExtractSchematicByName[baseCTNames[i], cx];
[] ← CoreOps.VisitWire[baseCT.public, EachWire];
public ← CoreOps.CreateWire[publicElements];
FOR i: INT IN [0..count) DO
tileRow[i] ← NEW [TilingClass.TileRec ← [type: baseCT]]
ENDLOOP;
FOR wl: Wires ← leftSideOnlyWires, wl.rest WHILE wl#NIL DO
wireName: ROPE ← CoreOps.GetShortWireName[wl.first];
tileRow[0].renaming ← CONS[[wireName, wireName], tileRow[0].renaming];
ENDLOOP;
FOR wl: Wires ← rightSideOnlyWires, wl.rest WHILE wl#NIL DO
wireName: ROPE ← CoreOps.GetShortWireName[wl.first];
tileRow[count-1].renaming ← CONS[[wireName, wireName], tileRow[count-1].renaming];
ENDLOOP;
FOR wl: Wires ← arrayedWires, wl.rest WHILE wl#NIL DO
wireName: ROPE ← CoreOps.GetShortWireName[wl.first];
FOR i: NAT IN [0..count) DO
tileRow[i].renaming ← CONS[[wireName, Rope.Cat[wireName, "[", Convert.RopeFromInt[i], "]"]], tileRow[i].renaming];
ENDLOOP;
ENDLOOP;
tileArray[0] ← tileRow;
ct ← TilingClass.CreateTiling[public, tileArray, TilingClass.SchematicsNeighborX, TilingClass.SchematicsNeighborY, Rope.Cat[obName, ".ArrayX"]];
};
END.