TilingSize.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Bertrand Serlet August 23, 1987 11:26:44 pm PDT
DIRECTORY CoreCreate, CoreOps, TilingClass;
TilingSize: CEDAR PROGRAM
IMPORTS CoreCreate, CoreOps, TilingClass
~ BEGIN OPEN CoreCreate;
zero: CellType = Cell[public: Wires["Gnd", "Line", "Input", "NotInput"], instances: NIL];
Row: PROC [n: NAT] RETURNS [CellType] = {
instances: CellInstances ← NIL;
FOR i: NAT IN [0 .. n) DO
instances ← CONS [Instance[zero, ["Input", Index["Input", i]], ["NotInput", Index["NotInput", i]]], instances];
ENDLOOP;
RETURN [Cell[
public: Wires["Gnd", "Line", Seq["Input", n], Seq["NotInput", n]],
instances: instances
]];
};
Rows: PROC [n, p: NAT] RETURNS [CellType] = {
instances: CellInstances ← NIL;
FOR j: NAT IN [0 .. p) DO
instances ← CONS [Instance[Row[n], ["Line", Index["Line", j]]], instances];
ENDLOOP;
RETURN [Cell[
public: Wires["Gnd", Seq["Line", p], Seq["Input", n], Seq["NotInput", n]],
instances: instances
]];
};
Record: PROC [n, p: NAT] RETURNS [CellType] = {
instances: CellInstances ← NIL;
FOR j: NAT IN [0 .. p) DO
FOR i: NAT IN [0 .. n) DO
instances ← CONS [Instance[zero, ["Input", Index["Input", i]], ["NotInput", Index["NotInput", i]], ["Line", Index["Line", j]]], instances];
ENDLOOP;
ENDLOOP;
RETURN [Cell[
public: Wires["Gnd", Seq["Line", p], Seq["Input", n], Seq["NotInput", n]],
instances: instances
]];
};
NeighborX: TilingClass.NeighborProc = {
publicPairs ← LIST[[CoreOps.FindWire[ct1.public, "Line"], CoreOps.FindWire[ct2.public, "Line"]]];
};
NeighborY: TilingClass.NeighborProc = {
publicPairs ← LIST[[CoreOps.FindWire[ct1.public, "Input"], CoreOps.FindWire[ct2.public, "Input"]], [CoreOps.FindWire[ct1.public, "Input"], CoreOps.FindWire[ct2.public, "Input"]]];
};
Tiles: PROC [n, p: NAT] RETURNS [CellType] = {
tileArray: TilingClass.TileArray ← NEW [TilingClass.TileArrayRec[p]];
FOR j: NAT IN [0 .. p) DO
tileRow: TilingClass.TileRow ← NEW [TilingClass.TileRowRec[n]];
FOR i: NAT IN [0 .. n) DO
tileRow[i] ← NEW [TilingClass.TileRec ← [zero, LIST [["Gnd", "Gnd"]]]];
ENDLOOP;
tileArray[j] ← tileRow;
ENDLOOP;
RETURN [TilingClass.CreateTiling[
public: Wires["Gnd", Seq["Line", p], Seq["Input", n], Seq["NotInput", n]],
tileArray: tileArray,
neighborX: NeighborX,
neighborY: NeighborY
]];
};
END.