CDFrame.mesa
Copyright c 1985 by Xerox Corporation. All rights resersed.
Last Edited by: Curry, January 23, 1986 7:43:06 am PST
DIRECTORY CD, CMosB, PWPins, PWRoute, IO, Rope;
CDFrame is a simple tree representation scheme to be used to structure the pieces of large devices as they are actually glued together. The idea is that hard to describe size and routing 'adjustments' can be made using measurements from other parts of the device while it is represented in this form. CDFrame defines a simple shell for CD.Object's which just contains the side, size, location and layer of all the external pins. CDFrame knows how to extract this shell from and object, write it to a file, read back the file and use the representation as a representation for the object itself.
CDFrame: CEDAR DEFINITIONS =
BEGIN
Frame:  TYPE = REF FrameSeq;
FrameSeq: TYPE = RECORD[
shell:   REF ShellRec   ← NIL,
data:   REF     ← NIL,
father:  Frame     ← NIL,
xory:   XorY,
unordered: BOOLFALSE,
orient:  CD.Orientation  ← CD.original,
seq:   SEQUENCE seqSize: CARDINAL OF Frame ];
ShellRec: TYPE = RECORD[
name:   IO.ROPE,
size:   Size   ← TameSize[],
pos:   CD.Position ← [0,0],
pins:   ARRAY Side OF REF PinSeq ];
PinSeq:  TYPE = RECORD[
locInfo:  LocInfo ← unk,
seq:   SEQUENCE seqSize: CARDINAL OF REF PinRec ];
XorY:   TYPE = {x,y};
LocInfo:  TYPE = {unk, implied, floating, sequencial, fixed};
PinRec: TYPE = RECORD [
name:   IO.ROPE,
side:   Side,
pos:   CD.Position,
size:   CD.Position,
layer:   CD.Layer ];
Side5:   TYPE = PWPins.Side;
Side:   TYPE = Side5[bottom..none);
SideRope:  ARRAY Side OF IO.ROPE;
Size:   TYPE = RECORD[x, y: INT, xfree, yfree: Freedom];
Freedom:  TYPE = {fixed, tame, wild};
minSize:  CD.Position = [14*CMosB.lambda, 16*CMosB.lambda];
TameSize:  PROC[pair: CD.Position ← minSize] RETURNS[size:Size] = INLINE
{RETURN[[pair.x, pair.y, tame, tame]]};
WildSize:  PROC[pair: CD.Position ← minSize] RETURNS[size:Size] = INLINE
{RETURN[[pair.x, pair.y, wild, wild]]};
FixedSize:  PROC[pair: CD.Position ← minSize] RETURNS[size:Size] = INLINE
{RETURN[[pair.x, pair.y, fixed, fixed]]};
FlipSize:  PROC[size: Size] RETURNS[Size] = INLINE
{RETURN[[size.y, size.x, size.yfree, size.xfree]]};
GlueSpec:   TYPE = RECORD[
tDir:   PWRoute.HorV,
params:  PWRoute.RouterParams ← NIL,
class:   GlueClass ← fill,
type:   ARRAY Side OF GlueSideType,
obj:   ARRAY Side OF CD.Object ← ALL[NIL] ];
GlueSideType: TYPE = {cap, conn, pwr, ext, chan, sum, diff};
GlueClass:  TYPE = {fill, ext, xlt, chan, pwr, sb, bad};
SetGlueClass: PROC[glue: REF GlueSpec];
NewFrame: PROC[size: INT, xory: XorY, name: IO.ROPE, data: REFNIL, unord: BOOLFALSE]
RETURNS [new: Frame];
NewExpandFrame: PROC[name: IO.ROPE, proc: ExpandProc]
RETURNS [frame: Frame];
NewObjectFrame:  PROC[cell: CD.Object]
RETURNS[frame: Frame];
NewShellFileFrame:  PROC[name: IO.ROPE]
RETURNS [frame: Frame];
Glue: PROC[
name:      IO.ROPE   ← NIL,
l,r,b,t:      GlueSideType ← cap,  -- cap conn ext chan sum diff
bObj,rObj,tObj,lObj:  CD.Object   ← NIL,
tDir:      PWRoute.HorV ← horizontal, -- vertical horizontal
tLayer:     IO.ROPE   ← NIL,  -- metal metal2 poly
bLayer:     IO.ROPE   ← NIL,
xlate:      BOOL    ← FALSE ] -- metal2 poly metal
RETURNS [new: Frame];
ID: PROC[name: IO.ROPE] RETURNS[unique: IO.ROPE];
FullFrameName: PROC[frame: Frame] RETURNS[name: IO.ROPE];
FlattenOnce:  PROC[frame: Frame] RETURNS[new: Frame];
TestMergeProc: TYPE = PROC[frame: Frame] RETURNS[merge: BOOL];
TestMergeNodes: PROC[frame: Frame, testProc: TestMergeProc ← NIL -- TRUE -- ]
RETURNS[new: Frame];
NextSide:   PROC[side: Side]      RETURNS [next: Side];
PrevSide:   PROC[side: Side]      RETURNS [prev: Side];
OppSide:   PROC[side: Side]      RETURNS [opp: Side];
GetSidePos:   PROC[pin: REF PinRec]    RETURNS [INT];
SetSidePos:   PROC[pin: REF PinRec, pos: INT];
ShellFromDesign: PROC[design:  REF]   RETURNS [shell: REF ShellRec];
ShellFromObject: PROC[cell:  CD.Object] RETURNS [shell: REF ShellRec];
ShellFromFile:  PROC[shellName: IO.ROPE] RETURNS [shell: REF ShellRec];
ShellToFile:  PROC[shell: REF ShellRec];
ShellToBlock:  PROC[design: CD.Design, shell: REF ShellRec] RETURNS [obj: CD.Object];
ShellToObject:  PROC[design: CD.Design, shell: REF ShellRec, detailed: BOOLTRUE]
RETURNS[cell: CD.Object];
FrameToObject: PROC[frame: Frame, design: CD.Design, detailed: BOOLTRUE]
RETURNS [obj: CD.Object];
BlankCell:   PROC[design: CD.Design, size: CD.Position]
RETURNS[cell: CD.Object];
ExpandProc:    TYPE = PROC[frame: Frame, design: CD.Design ← NIL]
RETURNS [new: Frame];
SpecificFrameProc:   TYPE =
PROC[frame: Frame, name: IO.ROPE, design: CD.Design ← NIL]
RETURNS [new: Frame, done: BOOL];
ExpandFrame:    ExpandProc;
DeleteZeroFrames:  PROC[frame: Frame] RETURNS[new: Frame];
ReadShellFrame:    SpecificFrameProc;
WriteShellFrame:   SpecificFrameProc;
ReOrient: PROC[frame: Frame, design: CD.Design, orient: CD.Orientation ← CD.original];
EnumProc:   TYPE = PROC[frame: Frame];
EnumFrameTopFirst: PROC[frame: Frame, proc: EnumProc];
EnumFrameBotFirst:  PROC[frame: Frame, proc: EnumProc];
EnumFrameBotOnly:  PROC[frame: Frame, proc: EnumProc];
TellKidsAboutDad:   PROC [dad: Frame];
Neighbor:     PROC [leaf: Frame, side: Side]
RETURNS[neighbor: Frame, ok: BOOL]; 
ListFrame:     PROC[frame: Frame, limit: INT ← -1] RETURNS[listing: IO.ROPE];
LogFrame:     PROC[frame: Frame, limit: INT ← -1, out: IO.STREAMNIL];
SizeCode:      PROC[a: INT] RETURNS[INT];
SizePos:      PROC[size: CD.Position] RETURNS[CD.Position];
ObjSize: PROC[ob: CD.Object] RETURNS[size: CD.Position];
GetSize:      PROC[frame: Frame];
PutSize:      PROC[frame: Frame];
PutPos:      PROC[frame: Frame, new: CD.Position];
GetPins:      PROC[frame: Frame];
FixOneSize:    PROC[frame: Frame] RETURNS[fixed1: BOOLFALSE];
ScaledText:   PROC[design: CD.Design, text: IO.ROPE, box: CD.Position, layer: CD.Layer]
RETURNS[cell: CD.Object];
GetLog: PROC RETURNS[IO.STREAM];
END.