CabbageImpl.mesa 
Copyright Ó 1986, 1987 by Xerox Corporation. All rights reversed.
Created by Bryan Preas, April 2, 1987 11:10:28 am PST
Bertrand Serlet April 27, 1987 0:24:58 am PDT
Bryan Preas August 21, 1987 10:59:09 am PDT
DIRECTORY
DABasics, Cabbage, CabbagePrivate, Connections, CD, Rope;
CabbageImpl: CEDAR PROGRAM
IMPORTS CabbagePrivate
EXPORTS Cabbage =
BEGIN OPEN Cabbage;
Signals
Error: PUBLIC ERROR[errorType: ErrorType ← callingError, explanation: Rope.ROPENIL] = CODE;
Signal: PUBLIC SIGNAL[errorType: ErrorType ← callingError, explanation: Rope.ROPENIL] = CODE;
Utilities
defaultPadRingParams: PUBLIC PadRingParams ← NEW[PadRingParamsRec ← ["metal", "metal2"]];
Returns the innerPos needed for centering the inner in the pad frame. This is usually what is desired. However the position of the inner cell can be positioned other than in the center.
Center: PUBLIC PROC [inner, bottomLeft, bottom, bottomRight, right, topRight, top, topLeft, left: CD.Object, parms: PadRingParams] RETURNS [innerPos: DABasics.Position] = {
handle: CabbagePrivate.Handle ← CabbagePrivate.CreateHandle[inner, bottomLeft, bottom, bottomRight, right, topRight, top, topLeft, left, NIL, parms, NIL, normal];
lowerY: INT ← handle.bottom.origin.y + handle.bottom.size.y;
upperY: INT ← handle.top.origin.y - handle.inner.size.y;
lowerX: INT ← handle.left.origin.x + handle.left.size.x;
upperX: INT ← handle.right.origin.x - handle.inner.size.x;
innerPos ← [(lowerX + upperX)/2, (lowerY + upperY)/2]};
Route the chip
PadRoute: PUBLIC PROC [inner, bottomLeft, bottom, bottomRight, right, topRight, top, topLeft, left: CD.Object, innerPos: DABasics.Position, connections: Connections.Table, parms: PadRingParams ← defaultPadRingParams, name: Rope.ROPE] RETURNS [chip: CD.Object] = {
handle: CabbagePrivate.Handle ← CabbagePrivate.CreateHandle[inner, bottomLeft, bottom, bottomRight, right, topRight, top, topLeft, left, connections, parms, name, normal];
CabbagePrivate.CheckInnerPos[handle, innerPos];
CabbagePrivate.DistributePower[handle];
CabbagePrivate.GlobalRoute[handle];
CabbagePrivate.DetailedRoute[handle];
chip ← CabbagePrivate.MakeChip[handle]};
Route a pad limited chip
PadLimitedRoute: PUBLIC PROC [inner, bottomLeft, bottom, bottomRight, right, topRight, top, topLeft, left: CD.Object, innerPos: DABasics.Position, connections: Connections.Table, parms: PadRingParams ← defaultPadRingParams, name: Rope.ROPE] RETURNS [chip: CD.Object] = {
handle: CabbagePrivate.Handle ← CabbagePrivate.CreateHandle[inner, bottomLeft, bottom, bottomRight, right, topRight, top, topLeft, left, connections, parms, name, padLimited];
CabbagePrivate.CheckInnerPos[handle, innerPos];
CabbagePrivate.DistributePower[handle];
CabbagePrivate.GlobalRoute[handle];
CabbagePrivate.DetailedRoute[handle];
chip ← CabbagePrivate.MakeChip[handle]};
END.