-- File: IPTop.mesa
-- Last Edited by: CSChow, February 1, 1985 8:40:33 am PST
-- This is the top leve interface.
DIRECTORY
Graphics USING [Context],
IPCTG USING[Ref, Channel, ChType],
Misc USING [Rect],
Rope USING [ROPE],
IPConstants USING [White],
IPParams USING [ChDefaultWidth, ChDefaultPositionX, ChDefaultPositionY],
RefStack USING [Ref],
IPCoTab USING[Ref],
IPTypeTab,
IPNetTab,
IPPortTab,
IPChipRose;
IPTop: CEDAR DEFINITIONS
IMPORTS IPParams = BEGIN
Ref: TYPE = REF Rep;
Rep: TYPE = RECORD[
coTab: IPCoTab.Ref, --Tables of components/instances
ports: IPPortTab.Ref, --Tables of ports
ctg: IPCTG.Ref, -- of Channels
types: IPTypeTab.Ref, --Tables of types
nets: IPNetTab.Ref, --Tables of nets
undoStack, redoStack, horOldChs, verOldChs: RefStack.Ref, -- supports undo/redo
initialized: BOOLFALSE, -- false implies need to call InitTop. Handled internally
southMost, eastMost, northMost, westMost: IPCTG.Channel ← NIL -- bounding chanels
];
CyclicConstraint: ERROR[negCh, posCh: IPCTG.Channel];
ComponentsOverlapped: ERROR[overlaps: LIST OF Misc.Rect];
Create: PROC[chipRose: IPChipRose.Ref] RETURNS[Ref];
-- Create top from chipRose
Create1: PROC[defaultDir, descFile: Rope.ROPE] RETURNS [Ref];
--Create from desc file. See Impl
DestroySelf: PROC [top: Ref];
--Clean up circular garbage
ReDefineChs: PROC[top: Ref, chWidth: NAT ← IPParams.ChDefaultWidth, yPrimary, maxChWidth: BOOLFALSE] RETURNS [Ref];
--! Raise ComponentsOverlap. This construct the ChannelIPTopologyGraph based on
-- the shape and positions of the components in the coTab. chWidth is the
-- default channel width. If maxChWidth is true then the width of the each
-- constructed channel will be set to the maximum possible without moving
-- the components else all channels will be set to chWidth (In any case all channels
-- will be at least chWidth wide.) If yPrimary is true then the resultant channels
-- will tend to give long vertical channels else it will tend to give long horizontal
-- channels. IPTop is the same instance, only top.ctg is changed--
ClearChannels: PROC[top: Ref];
--Destroy (and only) top.ctg (the channels) in the system.
-- So after ClearChannels[top], NoTopology[top] is always TRUE
DescribeSelf: PROC[top: Ref, file: Rope.ROPE];
--Create a recoverable textual description of self. Used for creating checkpoint--
PaintSelf: PROC[top: Ref, context: Graphics.Context, xOffset, yOffset: REAL ← 0.0, scaleFactor: REAL ← 1.0, compStipple: CARDINAL ← IPConstants.White, showChNames, showCompNames, showPinNames: BOOLTRUE];
--compStipple is stipple used to paint components
--showChNames => channel names will be shown
-- showCompNames => component names will be shown
ReconstructSelf: PROC[file: Rope.ROPE] RETURNS [top: Ref];
-- Create the top based on the textual description in file. The reconstruction is `perfect'
-- except for some statistical info. and ref's are are longer the same.
CheckSelf: PROC[top: Ref];
-- Used for debugging. No longer maintained
ConstraintChannels: PROC[top: Ref, negCh, posCh: IPCTG.Channel, wt: INT];
--Set a (directed) external constraint between negCh and posCh, will
-- ERROR CyclicConstraint if resultant constraint is cyclic.
ClearConstraints: PROC[top: Ref, negCh: IPCTG.Channel, posCh: IPCTG.Channel ← NIL];
--Clear the constraint from negCh to posCh, if posCh = NIL then clear ALL
-- constraints from negCh
ClearAllConstraints: PROC[top: Ref];
-- Removes all external constraints
NoTopology: PROC[top: Ref] RETURNS [BOOL];
--Check if top has channels or not
Geometrize: PROC [top: Ref, xPosition: INT ← IPParams.ChDefaultPositionX, yPosition: INT ← IPParams.ChDefaultPositionY, horPosSense, verPosSense: BOOLTRUE];
-- Compute/update the Geomterical information (eg. coordinates and slacks of channels.)
-- If horPosSense is true then the horizontal channels will be computed from bottom
-- upward else they will be computed from top to down. Similarly for verPosSense.
-- xPosition and yPosition specifies the starting coordinates for the leftmost and
-- bottommost channels respectively
XDim: PROC[top: Ref] RETURNS [INT];
YDim: PROC[top: Ref] RETURNS [INT];
Area: PROC[top: Ref] RETURNS [INT];
CreateChannel: PROC[top: Ref, type: IPCTG.ChType, width: NAT ← IPParams.ChDefaultWidth, coord: INT ← 0] RETURNS[ch: IPCTG.Channel];
DestroyChannel: PROC[top:Ref, ch: IPCTG.Channel];
ReActivateChannel: PROC[top: Ref, ch: IPCTG.Channel]; --put the ch back--
DeActivateChannel: PROC[top: Ref, ch: IPCTG.Channel]; --remove ch.
END.