RouteUtil.mesa
Copyright Ó 1985, 1987, 1988 by Xerox Corporation. All rights reserved.
by Bryan Preas July 10, 1985 6:57:00 pm PDT
Christian Le Cocq March 21, 1988 1:07:10 pm PST
last edited by Bryan Preas April 19, 1987 1:39:21 pm PDT
DIRECTORY
Basics, CD, DABasics, Real, RealFns, RefTab, Rope, Route, RoutePrivate, RTBasic;
RouteUtil: CEDAR DEFINITIONS
IMPORTS Real, RealFns
= BEGIN
LayerToRoutingLayer: PROC [rules: Route.DesignRules, layer: CD.Layer] RETURNS [routingLayer: RoutePrivate.RoutingLayerOrNone] ~ INLINE {
RETURN[SELECT layer FROM
rules.trunkLayer  => trunk,
rules.branchLayer  => branch,
ENDCASE  => none];
};
RoutingLayerToLayer: PROC [rules: Route.DesignRules, routingLayer: RoutePrivate.RoutingLayer] RETURNS [layer: CD.Layer] ~ INLINE {
RETURN[SELECT routingLayer FROM
trunk  => rules.trunkLayer,
branch  => rules.branchLayer,
ENDCASE => CD.undefLayer];
};
RoutingLayerName: ARRAY RoutePrivate.RoutingLayerOrNone OF Rope.ROPE;
Length: PROC [pos1, pos2: DABasics.Position] RETURNS [DABasics.Number] = INLINE {
RETURN[Real.Round[RealFns.SqRt[1.0*(pos1.x-pos2.x)*(pos1.x-pos2.x)+1.0*(pos1.y-pos2.y)*(pos1.y-pos2.y)]]]
};
return lenth of line segment from pos1 to pos2.
XYToPQ: PROC [rules: Route.DesignRules, pos: DABasics.Position] RETURNS [pqPos: RTBasic.PQPos] ~ INLINE {
RETURN[SELECT rules.trunkDirection FROM
horizontal  => [pos.x, pos.y],
vertical  => [pos.y, pos.x],
ENDCASE => [-1, -1]];
};
convert a position from x-y to p-q space.
PQToXY: PROC [rules: Route.DesignRules, pqPos: RTBasic.PQPos] RETURNS [pos: DABasics.Position] ~ INLINE {
RETURN[SELECT rules.trunkDirection FROM
horizontal  => [pqPos.p, pqPos.q],
vertical  => [pqPos.q, pqPos.p],
ENDCASE => [-1, -1]];
};
convert a position from p-q to x-y space.
CompareResult: PROCEDURE [result1, result2: Route.ResultData]
RETURNS [result: Basics.Comparison];
CreateCDPin: PROC [name: Rope.ROPE, rect: DABasics.Rect, lev: CD.Layer←CD.undefLayer] RETURNS [cdPin: CD.Instance];
Create a ChipNDale pin. Calls CDPinObjects.CreatePinInstance but normalizes the rectangle first.
GetWidthWithContact: PROC [rules: Route.DesignRules, branch: NAT] RETURNS [width: NAT] = INLINE {RETURN[MAX[rules.contactSize, branch]]};
Find the width of a pin when contact is included.
Include: PROC [cell: CD.Object←NIL, ob: CD.Object,
position: DABasics.Position←[0, 0], orientation: CD.Orientation←original] RETURNS [application: CD.Instance];
include an object in a cell
GetVia: PROC [size: DABasics.Position, layer1, layer2: CD.Layer, cdLambda: DABasics.Number] RETURNS [cell: CD.Object];
StitchVias: PROC [size: DABasics.Position, layer1, layer2: CD.Layer, cdLambda: DABasics.Number, viaTable: RefTab.Ref] RETURNS [obj: CD.Object];
LineToRect: PROC [pos1, pos2: DABasics.Position, width: DABasics.Number] RETURNS [position: DABasics.Position, size: DABasics.Position];
convert a line and a width to a rectangle and an orgin
END.