TestPW.mesa
Copyright Ó 1984, 1985, 1986, 1987 by Xerox Corporation. All rights reversed.
Bertrand Serlet July 7, 1987 12:01:09 pm PDT
Louis Monier August 22, 1985 1:11:41 pm PDT
DIRECTORY CD, CDRects, CDRoutingObjects, PW, Rope;
TestPW: CEDAR PROGRAM
IMPORTS CD, CDRects, CDRoutingObjects, PW = BEGIN
TestPWX: PW.GeneratorProc = {
RETURN [PW.AbutX[PW.Get[design, "a"], PW.Get[design, "b"]]];
};
TestMapFunction: PW.GeneratorProc = {
BinaryCount: PROC [x, y: INT] RETURNS [CD.Object] = {
RETURN [SELECT TRUE FROM y=0 => edge, ENDCASE => contact];
};
contact: CD.Object ← PW.Get[design, "contact"];
edge: CD.Object ← PW.Get[design, "edge"];
RETURN [PW.MapFunction[BinaryCount, 0, 16, 0, 4]];
};
TestRoutingCellP: PW.GeneratorProc = {
l: INT = design.technology.lambda;
met: CD.Layer = CD.FetchLayer[design.technology, $met];
pdif: CD.Layer = CD.FetchLayer[design.technology, $wpdif];
node1: CDRoutingObjects.Node ← CDRoutingObjects.CreateNode[LIST [
[CDRects.CreateRect[[10 * l, 4 * l], pdif], [0, 5 * l]]
]];
node2: CDRoutingObjects.Node ← CDRoutingObjects.CreateNode[LIST [
[CDRects.CreateRect[[3 * l, 7 * l], met], [4 * l, 0]],
[CDRects.CreateRect[[4 * l, 4 * l], met], [4 * l, 7 * l]]
]];
RETURN [CDRoutingObjects.CreateRoutingObject[ir: [0, 0, 10 * l, 13 * l], nodes: LIST [node1, node2]]];
};
TestRoutingCellN: PW.GeneratorProc = {
l: INT = design.technology.lambda;
met: CD.Layer = CD.FetchLayer[design.technology, $met];
ndif: CD.Layer = CD.FetchLayer[design.technology, $ndif];
node1: CDRoutingObjects.Node ← CDRoutingObjects.CreateNode[LIST [
[CDRects.CreateRect[[10 * l, 4 * l], ndif], [0, 5 * l]]
]];
node2: CDRoutingObjects.Node ← CDRoutingObjects.CreateNode[LIST [
[CDRects.CreateRect[[3 * l, 7 * l], met], [4 * l, 0]],
[CDRects.CreateRect[[4 * l, 4 * l], met], [4 * l, 7 * l]]
]];
RETURN [CDRoutingObjects.CreateRoutingObject[ir: [0, 0, 10 * l, 13 * l], nodes: LIST [node1, node2]]];
};
TestRotated: PW.GeneratorProc = {
RETURN [PW.CreateRotation[TestRoutingCellP[design, key, context, data], rotate90, "RotatedRouting", LIST [[$Foo, $Bar]]]];
};
TestTiling: PW.GeneratorProc = {
ABB: PROC [x, y: NAT] RETURNS [CD.Object] = {RETURN [PW.Get[design, IF x=0 THEN "a" ELSE "b"]]};
RETURN [PW.CreateTiling[3, 5, ABB, "Tiled"]];
};
PW.RegisterGenerator[TestPWX, "TestPWX"];
PW.RegisterGenerator[TestMapFunction, "TestMapFunction"];
PW.RegisterGenerator[TestRoutingCellP, "TestRoutingCellP"];
PW.RegisterGenerator[TestRoutingCellN, "TestRoutingCellN"];
PW.RegisterGenerator[TestRotated, "TestRotated"];
PW.RegisterGenerator[TestTiling, "TestTiling"];
END.