PWRouteTest:
CEDAR
PROGRAM
IMPORTS CD, CDBasics, Convert, PW, PWRoute, Rope, RouteUtil =
BEGIN
ROPE: TYPE = Rope.ROPE;
IRSize:
PROC [obj:
PW.Object]
RETURNS [size:
CD.Position] =
{size ← CDBasics.SizeOfRect[CD.InterestRect[obj]]};
TestChRouterX:
PW.UserProc =
BEGIN
routerParams: PWRoute.RouterParams ← NEW[PWRoute.RouterParamsRec ← ["metal2", "metal", design.technology.key]];
leftOrig: PW.Object ← PW.Get[design, "ChXleft"];
leftXfer: PW.Object ← PWRoute.XferPins[routerParams.technologyKey, leftOrig, right, 50, "metal"];
left: PW.Object ← PW.AbutX[leftOrig, leftXfer];
rightOrig: PW.Object ← PW.Get[design, "ChXright"];
rightXfer: PW.Object ← PWRoute.XferPins[routerParams.technologyKey, rightOrig, left, 50, "metal"];
right: PW.Object ← PW.AbutX[rightXfer, rightOrig];
topOrig: PW.Object ← PW.Get[design, "ChXtop"];
topXfer: PW.Object ← PWRoute.XferPins[routerParams.technologyKey, topOrig, bottom, 50, "metal2"];
top: PW.Object ← PW.AbutY[topXfer, topOrig];
bottomOrig: PW.Object ← PW.Get[design, "ChXbottom"];
bottomXfer: PW.Object ← PWRoute.XferPins[routerParams.technologyKey, bottomOrig, top, 50, "metal2"];
bottom: PW.Object ← PW.AbutY[bottomOrig, bottomXfer];
test: PW.Object ← PWRoute.AbutChRouteListX[LIST[left, right], LIST[bottom], LIST[top], routerParams];
RETURN[test];
END;
TestChRouterY:
PW.UserProc =
BEGIN
left, right, top, bottom, test: PW.Object;
left ← PW.Get[design, "ChYleft"];
right ← PW.Get[design, "ChYright"];
top ← PW.Get[design, "ChYtop"];
bottom ← PW.Get[design, "ChYbottom"];
test ← PWRoute.AbutChRouteListY[LIST[bottom, top], LIST[left], LIST[right]];
RETURN[test];
END;
TestSbRouterH:
PW.UserProc =
BEGIN
left, right, top, bottom, sb, column, test: PW.Object;
dx1, dx2, dy1: INT;
left ← PW.Get[design, "SbXleft"];
right ← PW.Get[design, "SbXright"];
top ← PW.Get[design, "SbXtop"];
bottom ← PW.Get[design, "SbXbottom"];
sb ← PWRoute.AbutSbRoute[bottom, right, top, left, horizontal];
column ← PW.AbutListY[LIST[bottom, sb, top]];
test ← PW.CreateEmptyCell[];
dy1 ← IRSize[bottom].y;
dx1 ← IRSize[left].x;
dx2 ← IRSize[column].x;
[] ← PW.IncludeInCell[test, left, [0, dy1]];
[] ← PW.IncludeInCell[test, column, [dx1 , 0]];
[] ← PW.IncludeInCell[test, right, [dx1 + dx2, dy1]];
PW.RepositionCell[test];
RETURN[test];
END;
TestSbSmlRouterH:
PW.UserProc =
BEGIN
left: PW.Object ← PW.Get[design, "SbXSmlLeft"];
right: PW.Object ← PW.Get[design, "SbXSmlRight"];
top: PW.Object ← PW.Get[design, "SbXSmlTop"];
bottom: PW.Object ← PW.Get[design, "SbXSmlBottom"];
h: INT ← MAX[IRSize[bottom].x, IRSize[top].x];
v: INT ← MAX[IRSize[left].y, IRSize[right].y];
dy1: INT ← IRSize[bottom].y;
dx1: INT ← IRSize[left].x;
rect: PWRoute.RefRect ← NEW[PWRoute.Rect ← [-dx1, -dy1, h + dx1, v + dy1]];
sb: PW.Object ← PWRoute.MakeChannel[bottom, top, left, right, rect, PWRoute.defaultRouterParams, FALSE, switchBox];
dx2: INT ← IRSize[sb].x;
dy2: INT ← IRSize[sb].y;
test: PW.Object ← PW.CreateEmptyCell[];
[] ← PW.IncludeInCell[test, bottom, [2*dx1, 0]];
[] ← PW.IncludeInCell[test, top, [2*dx1, dy1 + dy2]];
[] ← PW.IncludeInCell[test, left, [0, 2*dy1]];
[] ← PW.IncludeInCell[test, sb, [dx1 , dy1]];
[] ← PW.IncludeInCell[test, right, [dx1 + dx2, 2*dy1]];
PW.RepositionCell[test];
RETURN[test];
END;
TestPinsH:
PW.UserProc =
BEGIN
routerParams: PWRoute.RouterParams ← NEW[PWRoute.RouterParamsRec ← ["metal", "metal2"]];
left: PW.Object ← PW.Get[design, "PinsLeft"];
right: PW.Object ← PW.Get[design, "PinsRight"];
top: PW.Object ← PW.Get[design, "PinsTop"];
bottom: PW.Object ← PW.Get[design, "PinsBottom"];
h: INT ← MAX[IRSize[bottom].x, IRSize[top].x];
v: INT ← MAX[IRSize[left].y, IRSize[right].y];
dy1: INT ← IRSize[bottom].y;
dx1: INT ← IRSize[left].x;
-- rect: PWRoute.RefRect ← NEW[PWRoute.Rect ← [-dx1, -dy1, h + dx1, v + dy1]];
sb: PW.Object ← PWRoute.MakeChannel[bottom, top, left, right, NIL -- rect --, routerParams, FALSE, channel];
dx2: INT ← IRSize[sb].x;
dy2: INT ← IRSize[sb].y;
test: PW.Object ← PW.CreateEmptyCell[];
[] ← PW.IncludeInCell[test, bottom, [dx1, 0]];
[] ← PW.IncludeInCell[test, top, [dx1, dy1 + dy2]];
[] ← PW.IncludeInCell[test, left, [0, dy1]];
[] ← PW.IncludeInCell[test, sb, [dx1 , dy1]];
[] ← PW.IncludeInCell[test, right, [dx1 + dx2, dy1]];
PW.RepositionCell[test];
RETURN[test];
END;
TestVias:
PW.UserProc =
BEGIN
pos: CD.Position ← [0, 0];
maxY: INT ← 200;
maxX: INT ← 200;
metal: CD.Layer ← CD.FetchLayer[design.technology, $met];
metal2: CD.Layer ← CD.FetchLayer[design.technology, $met2];
test: PW.Object ← PW.CreateEmptyCell[];
FOR y:
INT ← 48, y+16
WHILE y <= maxY
DO
pos ← [0, pos.y + y];
FOR x:
INT ← 48, x+16
WHILE x <= maxX
DO
pos.x ← pos.x + x;
RouteUtil.AddVia[test, Rope.Cat[Convert.RopeFromInt[x], "x", Convert.RopeFromInt[y]], pos, [x,y], metal, metal2, design.technology.lambda];
ENDLOOP;
ENDLOOP;
PW.RepositionCell[test];
RETURN[test];
END;
TestMulDL:
PW.UserProc =
BEGIN
right, top, bottom, left, sb, row, test: PW.Object;
dx1, dy1, dy2: INT;
routerParams: PWRoute.RouterParams ← NEW[PWRoute.RouterParamsRec ← ["metal", "metal2"]];
right ← PW.Get[design, "MulDLRight"];
top ← PW.Get[design, "MulDLTop"];
bottom ← PW.Get[design, "MulDLBottom"];
left ← PW.Get[design, "MulDLLeft"];
sb ← PWRoute.AbutSbRoute[bottom, right, top, left, horizontal, routerParams];
row ← PW.AbutListX[LIST[left, sb, right]];
test ← PW.CreateEmptyCell[];
dx1 ← IRSize[left].x;
dy1 ← IRSize[bottom].y;
dy2 ← IRSize[row].y;
[] ← PW.IncludeInCell[test, bottom, [dx1, 0]];
[] ← PW.IncludeInCell[test, row, [0 , dy1]];
[] ← PW.IncludeInCell[test, top, [dx1, dy1 + dy2]];
PW.RepositionCell[test];
RETURN[test];
END;
TestSbRouterV:
PW.UserProc =
BEGIN
left, right, top, bottom, sb, row, test: PW.Object;
dx1, dy1, dy2: INT;
left ← PW.Get[design, "SbYleft"];
right ← PW.Get[design, "SbYright"];
top ← PW.Get[design, "SbYtop"];
bottom ← PW.Get[design, "SbYbottom"];
sb ← PWRoute.AbutSbRoute[bottom, right, top, left, vertical];
row ← PW.AbutListX[LIST[left, sb, right]];
test ← PW.CreateEmptyCell[];
dy1 ← IRSize[bottom].y;
dy2 ← IRSize[row].y;
dx1 ← IRSize[left].x;
[] ← PW.IncludeInCell[test, bottom, [dx1, 0]];
[] ← PW.IncludeInCell[test, row, [0 , dy1]];
[] ← PW.IncludeInCell[test, top, [dx1, dy1 + dy2]];
PW.RepositionCell[test];
RETURN[test];
END;
TestSbMMRouterV:
PW.UserProc =
BEGIN
routerParams: PWRoute.RouterParams ← NEW[PWRoute.RouterParamsRec ← ["metal2", "metal", design.technology.key]];
leftOrig: PW.Object ← PW.Get[design, "SbMMleft"];
leftXfer: PW.Object ← PWRoute.XferPins[routerParams.technologyKey, leftOrig, right, 50, "metal"];
left: PW.Object ← PW.AbutX[leftOrig, leftXfer];
rightOrig: PW.Object ← PW.Get[design, "SbMMright"];
rightXfer: PW.Object ← PWRoute.XferPins[routerParams.technologyKey, rightOrig, left, 50, "metal"];
right: PW.Object ← PW.AbutX[rightXfer, rightOrig];
topOrig: PW.Object ← PW.Get[design, "SbMMtop"];
topXfer: PW.Object ← PWRoute.XferPins[routerParams.technologyKey, topOrig, bottom, 50, "metal2"];
top: PW.Object ← PW.AbutY[topXfer, topOrig];
bottomOrig: PW.Object ← PW.Get[design, "SbMMbottom"];
bottomXfer: PW.Object ← PWRoute.XferPins[routerParams.technologyKey, bottomOrig, top, 50, "metal2"];
bottom: PW.Object ← PW.AbutY[bottomOrig, bottomXfer];
sb: PW.Object ← PWRoute.AbutSbRoute[bottom, right, top, left, vertical, routerParams];
row: PW.Object ← PW.AbutListX[LIST[left, sb, right]];
test: PW.Object ← PW.CreateEmptyCell[];
dy1: INT ← IRSize[bottom].y;
dy2: INT ← IRSize[row].y;
dx1: INT ← IRSize[left].x;
[] ← PW.IncludeInCell[test, bottom, [dx1, 0]];
[] ← PW.IncludeInCell[test, row, [0 , dy1]];
[] ← PW.IncludeInCell[test, top, [dx1, dy1 + dy2]];
PW.RepositionCell[test];
RETURN[test];
END;
TestSb2Sides:
PW.UserProc =
BEGIN
leftOrig: PW.Object ← PW.Get[design, "Sb2left"];
leftXfer: PW.Object ← PWRoute.XferPins[design.technology.key, leftOrig, right, 0, "poly"];
left: PW.Object ← PW.AbutX[leftOrig, leftXfer];
bottomOrig: PW.Object ← PW.Get[design, "Sb2bottom"];
bottomXfer: PW.Object ← PWRoute.XferPins[design.technology.key, bottomOrig, top, 50, "metal"];
bottom: PW.Object ← PW.AbutY[bottomOrig, bottomXfer];
sb: PW.Object ← PWRoute.AbutSbRoute[bottom, NIL, NIL, left, vertical];
row: PW.Object ← PW.AbutListX[LIST[left, sb]];
test: PW.Object ← PW.CreateEmptyCell[];
dy: INT ← IRSize[bottom].y;
dx: INT ← IRSize[left].x;
[] ← PW.IncludeInCell[test, bottom, [dx, 0]];
[] ← PW.IncludeInCell[test, row, [0 , dy]];
PW.RepositionCell[test];
RETURN[test];
END;
PW.Register[TestChRouterX, "TestChRouterX"];
PW.Register[TestChRouterY, "TestChRouterY"];
PW.Register[TestSbRouterH, "TestSbRouterH"];
PW.Register[TestSbSmlRouterH, "TestSbSmlRouterH"];
PW.Register[TestSbRouterV, "TestSbRouterV"];
PW.Register[TestSb2Sides, "TestSb2Sides"];
PW.Register[TestSbMMRouterV, "TestSbMMRouterV"];
PW.Register[TestPinsH, "TestPinsH"];
PW.Register[TestMulDL, "TestMulDL"];
PW.Register[TestVias, "TestVias"];
END.