DIRECTORY
CD,
Core,
D2Basic,
Rope,
Route,
RTSets,
RTBasic,
RTCoreUtil,
SC;

SCPrivate: CEDAR DEFINITIONS =

BEGIN
Position: TYPE = D2Basic.Pos;
PQPos: TYPE = RTBasic.PQPos;
CompClass: TYPE = {other, logic, io, ft};	
DegreeOfConnection: TYPE = {full, min, none};
UpperLowerConnection: TYPE = RECORD [
lower, upper: DegreeOfConnection _ none];
RouteTopology: TYPE = ARRAY MaxChanSr OF UpperLowerConnection;
LRSide: TYPE = RTBasic.LRSide;
TBSide: TYPE = RTBasic.TBSide;
LRSideSet: TYPE = RTSets.RTSmSet -- OF LRSide -- ;
SideSet: TYPE = RTSets.RTSmSet -- OF ValidSide -- ;
RowSet: TYPE = RTSets.RTMdSet -- OF MaxRowSr -- ;
ChanSet: TYPE = RTSets.RTMdSet -- OF MaxChanSr -- ;

StructureData: TYPE = REF StructureDataRec;
StructureDataRec: TYPE = RECORD [
objects: Objects _ NIL,
instances: Instances _ NIL,
nets: Nets _ NIL];

LayoutData: TYPE = REF LayoutDataRec;
LayoutDataRec: TYPE = RECORD [
totWidth, totHeight: SC.Number _ 0,
bpRows: BpRows _ NIL,
lgRows: LgRows _ NIL,
sideChans: SideChans _ [NIL, NIL],
rowChans: RowChans _ NIL,
powerBuses: PowerBuses _ [NIL, NIL],
layoutParms: LayoutParms,
placeDat: REF ANY _ NIL,
globalRoute: REF ANY _ NIL];

Parms: TYPE = REF ParmsRec;
ParmsRec: TYPE = RECORD [
libName: Rope.ROPE _ NIL,
libDesign: CD.Design _ NIL,
ftObject, portObject, vddObject, gndObject: Object _ NIL];

LayoutParms: TYPE = REF LayoutParmsRec;
LayoutParmsRec: TYPE = RECORD [
whichFom: FomType _ wlFom,
useInteriorChanExits: BOOLEAN _ TRUE,
numRows: NAT _ 0,
rowDirection: SC.Direction _ horizontal,
unitsPerLam: SC.Number _ 2,
powerName: ARRAY LRSide OF Rope.ROPE];

maxObjects: NAT = 100;
maxPinsOnObject: NAT = 100;
MaxObjectsSr: TYPE = NAT[1 .. maxObjects];  -- Object definitions
ZMaxObjectsSr: TYPE = NAT[0 .. maxObjects];  -- Object definitions
Objects: TYPE = REF ObjectsRec; 
ObjectsRec: TYPE = RECORD [
count: ZMaxObjectsSr _ 0,
ob: ARRAY MaxObjectsSr OF Object _ ALL[NIL]]; 
Object: TYPE = REF ObjectRec;
ObjectRec: TYPE = RECORD [
name: Rope.ROPE _ NIL, 
objectNum: MaxObjectsSr,
size, orgin: RTBasic.PQPos _ [0, 0], 
numPins: NAT _ 0,
pins: ObjectPins _ NIL, 
typeClass: CompClass _ other,
numTimesUsed: NAT _ 0,
cdOb: CD.Object _ NIL];

ObjectPin: TYPE = REF ObjectPinRec;
ObjectPins: TYPE = REF ObjectPinsRec;
ObjectPinsRec: TYPE = RECORD [
p: SEQUENCE size: NAT OF ObjectPin];
ObjectPinRec: TYPE = RECORD [
name: Rope.ROPE _ NIL, 
pinPos: PinPos,
cdPin: CD.Instance _ NIL, 
rect: SC.Rect _ [0, 0, 0, 0],
layer: SC.Layer, 
equivClass: Rope.ROPE _ NIL];
PinPos: TYPE = RECORD [
side: SC.SideOrNone _ none, 
depth, location: SC.Number _ 0];

maxInstance: NAT = 9000;
MaxInstanceSr: TYPE = NAT[1 .. maxInstance];
ZMaxInstanceSr: TYPE = NAT[0 .. maxInstance];
Instance: TYPE = REF InstanceRec;
InstanceList: TYPE = LIST OF Instance;
Instances: TYPE = REF InstancesRec; 
InstancesRec: TYPE = RECORD [
count, numIOs, numLogics, numFts: ZMaxInstanceSr _ 0,
inst: Insts _ NIL]; 
Insts: TYPE = REF InstsOb;
InstsOb: TYPE = ARRAY MaxInstanceSr OF Instance _ ALL[NIL];
InstanceRec: TYPE = RECORD [
name: Rope.ROPE,
num: MaxInstanceSr,
object: Object _ NIL,
pinNets: PinNets _ NIL,
prePos, curPos, initPos, fnlPos: ZMaxPosSr _ 0,
preOrien, curOrien, initOrien, fnlOrien: OrientationOrNone _ 0,
offset: SC.Number _ 0,
whichClass: CompClass,
ftNet: Net _ NIL,
equivPortClass: Rope.ROPE _ NIL,
instDat: REF ANY _ NIL,
compClassSel: SELECT OVERLAID CompClass FROM
ft, logic => [
preRow, curRow, initRow, fnlRow: ZMaxRowSr _ 0],
io => [
preSide, curSide, initSide, fnlSide: SC.SideOrNone _ none],
ENDCASE];

OrientationOrNone: TYPE = NAT[0 .. maxOrien];
Orientation: TYPE = OrientationOrNone[1 .. maxOrien];
maxOrien: NAT = 8;

PinNets: TYPE = REF PinNetsRec;
PinNetsRec: TYPE = RECORD[n: SEQUENCE size: NAT OF PinNet];
PinNet: TYPE = RECORD [
pin: ObjectPin _ NIL,
net: Net _ NIL];

PinType: TYPE = {compPin, externalPin, ftPin};
maxNets: NAT = 5000;
MaxNetsSr: TYPE = NAT[1 .. maxNets];
ZMaxNetsSr: TYPE = NAT[0 .. maxNets];
Net: TYPE = REF NetRec;
NetList: TYPE = LIST OF Net;
Nets: TYPE = REF NetsRec; 
NetsRec: TYPE = RECORD [
count: ZMaxNetsSr _ 0,
nets: NetArrayRef]; 
NetArray: TYPE = ARRAY MaxNetsSr OF Net _ ALL[NIL];
NetArrayRef: TYPE = REF NetArray;
NetRec: TYPE = RECORD [
name: Rope.ROPE _ NIL,
wire: Core.Wire _ NIL,				-- Core wire corresponding to this net
num: MaxNetsSr,
trunkWidth, branchWidth: SC.Number _ 0,
score, oldScore: REAL _ 0.0,		-- current and previous placement score
updatedOnTrial: INT _ 0,			-- placement trial last updated
externNet: ExtNet _ internalNet, 
ftsOnRow: RowSet, 					-- rows which have ft's on this net
chanExits: ARRAY LRSide OF ChanSet,
routeTopology: RouteTopology,	-- global routing
netDat: REF ANY _ NIL,
pins: NetPinSeq _ NIL				-- sequence of instance/pins on net
];
ExtNet: TYPE = {externalNet, internalNet};

NetPinSeq: TYPE = REF NetPinSeqRec;
NetPinSeqRec: TYPE = RECORD [
np: SEQUENCE size: NAT OF NetPin];
NetPin: TYPE = REF NetPinRec;
NetPinRec: TYPE = RECORD [
pinClass: PinType _ compPin,
instance: Instance _ NIL, 
pin: ObjectPin _ NIL
];

maxPos: NAT = 1000;
MaxPosSr: TYPE = NAT[1 .. maxPos];
ZMaxPosSr: TYPE = NAT[0 .. maxPos];

BpRow: TYPE = REF BpRowRec;
BpRows: TYPE = REF BpRowsRec; 
BpRowsRec: TYPE = ARRAY SC.Side OF BpRow _ ALL[NIL]; 
BpRowRec: TYPE = RECORD [
bpSpacing: INT _ 0, 
size, sideOrg: RTBasic.PQPos _ [0, 0], 
dimInvalid: BOOLEAN _ TRUE, 
initMaxBpsOnSide, maxBpsOnSide, nBpsOnSide: ZMaxPosSr _ 0, 
bpsOnSide: ARRAY MaxPosSr OF Instance _ ALL[NIL], 
fnlBpFxd, initBpFxd: BOOLEAN _ FALSE];

maxLgRows: NAT = 50;
MaxRowSr: TYPE = NAT[1 .. maxLgRows];
ZMaxRowSr: TYPE = NAT[0 .. maxLgRows];
LgRow: TYPE = REF LgRowRec;
LgRows: TYPE = REF LgRowsRec;
LgRowsRec: TYPE = RECORD [
horzRowOrg, maxRowWidth: SC.Number _ 0,
numMaxRows: NAT _ 0,
count: ZMaxRowSr _ 0,
rows: ARRAY MaxRowSr OF LgRow _ ALL[NIL]]; 
LgRowRec: TYPE = RECORD [
size, rowOrg: RTBasic.PQPos _ [0, 0], 
dimInvalid: BOOLEAN _ TRUE,
rowNum: NAT, 
nLgsOnRow, nFtsOnRow: ZMaxPosSr _ 0, 
lgsOnRow: ARRAY MaxPosSr OF Instance _ ALL[NIL], 
fnlLgFxd, initLgFxd: BOOLEAN _ FALSE,
cdOb: CD.Object _ NIL];

maxChans: NAT = maxLgRows + 1;
MaxChanSr: TYPE = NAT[1 .. maxChans];
ZMaxChanSr: TYPE = NAT[0 .. maxChans];

RowChan: TYPE = REF RowChanRec;
RowChans: TYPE = REF RowChansRec;
RowChansRec: TYPE = RECORD [
count: ZMaxChanSr _ 0,
chans: ARRAY MaxChanSr OF RowChan _ ALL[NIL]]; 
RowChanRec: TYPE = RECORD [
chanNum: NAT,
initChanWidth, chanWidth, minChanWidth, chanResult, chanPos, wireLength: SC.Number _ 0,
numTracks: NAT _ 0,
numExits: ARRAY LRSide OF ZMaxExitsSr _ [0, 0], 
exits: ExitArray _ NIL,
exitCells: ARRAY LRSide OF CD.Object _ ALL[NIL],
routing: Route.RoutingResult _ NIL
];
ExitArrayOb: TYPE = ARRAY LRSide OF ARRAY MaxExitsSr OF Exit;
ExitArray: TYPE = REF ExitArrayOb;
maxExits: NAT = 100;
MaxExitsSr: TYPE = NAT[1 .. maxExits];
ZMaxExitsSr: TYPE = NAT[0 .. maxExits];
Exit: TYPE = RECORD [
net: Net _ NIL,
pos: SC.Number _ 0, -- track number
layer: SC.Layer];

SideChan: TYPE = REF SideChanRec;
SideChans: TYPE = ARRAY LRSide OF SideChan;
SideChanRec: TYPE = RECORD [
side: SC.Side,
initSideChanWidth, sideChanWidth, minSideChanWidth, sideChanResult, sideChanPos, wireLength: SC.Number _ 0,
sideChanTracks: NAT _ 0];

PowerBuses: TYPE = ARRAY LRSide OF PowerBus;
PowerBus: TYPE = REF PowerBusRec;
PowerBusRec: TYPE = RECORD [
name: Rope.ROPE _ NIL,
net: Net _ NIL,
onSide: LRSide,
fromTB: TBSide _ top,
width: SC.Number _ 0];

FomType: TYPE = {areaFom, wlFom};

GetStructure: PROC [handle: SC.Handle, cellType: Core.CellType,
flattenCellType: RTCoreUtil.FlattenCellTypeProc]
RETURNS [done: BOOLEAN];

DestroyStructure: PROC [handle: SC.Handle];

SetUpLayout: PROC [handle: SC.Handle, cellType: Core.CellType]
RETURNS [done: BOOLEAN];

DestroyLayout: PROC [handle: SC.Handle];

DetailRoute: PROC [handle: SC.Handle] RETURNS [result: SC.Result];

PosImprove: PROC [handle: SC.Handle, whichFom: FomType, maxCycles: INT];
-- improve positions of cells on a row

OrientImprove: PROC [handle: SC.Handle, whichFom: FomType, maxCycles: INT];

SAInitialPlace: PROC [handle: SC.Handle, seed: INT] RETURNS [initialResult: SC.SAInitialResult];

SAGetParms: PROC [handle: SC.Handle, initialResult: SC.SAInitialResult, cellType: Core.CellType] RETURNS [saParms: SC.SAParms];
SAPlaceImprove: PROC [handle: SC.Handle, saParms: SC.SAParms, seed: INT];

SCRandomTest: PUBLIC PROCEDURE [handle: SC.Handle, trials, seed: INT];

END.



��&��SCPrivate.mesa
Copyright c 1985, 1986 by Xerox Corporation.  All rights reserved.
by Bryan Preas, July 10, 1985 11:48:30 am PDT 
last edited by Bryan Preas, July 22, 1986 3:18:02 pm PDT
Frank Bowers May 21, 1986 5:35:15 pm PDT

bonding pad and logic component types 
ftNet: Net _ NIL],
equivPortClass: Rope.ROPE _ NIL],
interconnection net types 
bonding pad side and logic row types 
Initialize for simulated annealing improvement.
determine parameters for simulated placement.

Improve the placement for the instances by simulated annealing.
Ê
Ò��˜�šœ™Jšœ
Ïmœ7™BJšœ.™.Jšœ8™8Icode™(—J™�šÏk	˜	Jšžœ˜J˜J˜J˜Jšœ˜Jšœ˜J˜J˜Jšžœ˜J˜�—šÏn	œžœžœ˜J˜�Jšž˜Jšœ
žœ˜Jšœžœ˜Jšœžœ˜*Jšœžœ˜-šœžœžœ˜%Jšœ)˜)—Jšœžœžœžœ˜>Jšœžœ˜Jšœžœ˜JšœžœÏcœ˜2Jšœ	žœ œ˜3Jšœžœ œ˜1Jšœ	žœ œ˜3J˜�Jšœžœžœ˜+šœžœžœ˜!Jšœžœ˜Jšœžœ˜Jšœ
žœ˜J˜�—Jšœžœžœ˜%šœžœžœ˜Jšœžœ˜#Jšœžœ˜Jšœžœ˜Jšœžœžœ˜"Jšœžœ˜Jšœžœžœ˜$Jšœ˜Jšœ
žœžœžœ˜Jšœ
žœžœžœ˜J˜�—Jšœžœžœ
˜šœ
žœžœ˜Jšœžœžœ˜Jšœžœ
žœ˜Jšœ5žœ˜:—J˜�Jšœ
žœžœ˜'šœžœžœ˜Jšœ˜Jšœžœžœ˜%Jšœ	žœ˜Jšœžœ˜(Jšœ
žœ˜Jšœžœžœžœ˜&J˜�—Jšœžœ˜Jšœžœ˜Jšœžœžœ ˜AJšœžœžœ ˜BJšœ	žœžœ
˜ šœžœžœ˜Jšœ˜Jš	œžœžœ
žœžœ˜.—Jšœžœžœ˜šœžœžœ˜Jšœžœžœ˜Jšœ˜Jšœ%˜%Jšœ	žœ˜Jšœžœ˜Jšœ˜Jšœžœ˜Jšœžœ
žœ˜—J˜�Jšœžœžœ˜#Jšœžœžœ˜%šœžœžœ˜Jšœžœžœžœ˜$—šœžœžœ˜Jšœžœžœ˜Jšœ˜Jšœžœžœ˜Jšœžœ˜Jšœžœ˜Jšœžœžœ˜—šœžœžœ˜Jšœžœ˜Jšœžœ
˜ J˜�—Jšœ&™&Jšœ
žœ˜Jšœžœžœ˜,Jšœžœžœ˜-Jšœ
žœžœ
˜!Jšœžœžœžœ
˜&Jšœžœžœ˜$šœžœžœ˜Jšœ5˜5Jšœžœ˜—Jšœžœžœ	˜Jšœ	žœžœžœžœžœ˜;šœ
žœžœ˜Jšœžœ˜Jšœ˜Jšœžœ˜Jšœžœ˜Jšœ/˜/Jšœ?˜?Jšœžœ˜Jšœ˜Jšœ
žœ˜Jšœžœžœ˜ Jšœ	žœžœžœ˜šœžœžœž˜,šœ˜Jšœ0˜0Jšœ™—šœ˜Jšœ%žœ˜;Jšœ!™!—Jšžœ˜	J˜�——Jšœžœžœ˜-Jšœ
žœ$˜5šœ
žœ˜J˜�—Jšœ	žœžœ˜Jšœžœžœžœžœžœ	˜;šœžœžœ˜Jšœžœ˜Jšœžœ˜J˜�—Jšœ™Jšœ	žœ!˜.Jšœ	žœ˜Jšœžœžœ˜$Jšœžœžœ˜%Jšœžœžœ˜Jšœ	žœžœžœ˜Jšœžœžœ
˜šœ	žœžœ˜Jšœ˜Jšœ˜—Jšœ
žœžœžœžœžœ˜3Jšœ
žœžœ
˜!šœžœžœ˜Jšœžœžœ˜Jšœžœ &˜@Jšœ˜Jšœžœ˜'Jšœžœ	 '˜EJšœžœ ˜:Jšœ!˜!Jšœ #˜:Jšœžœžœ	˜#Jšœ ˜/Jšœžœžœžœ˜Jšœžœ #˜<Jšœ˜—Jšœžœ˜*J˜�Jšœžœžœ˜#šœžœžœ˜Jšœžœžœžœ	˜"—Jšœžœžœ˜šœžœžœ˜Jšœ˜Jšœžœ˜Jšœž˜šœ˜J˜�——Jšœžœ˜Jšœ
žœžœ˜"Jšœžœžœ˜#J˜�Jšœ%™%Jšœžœžœ
˜Jšœžœžœ˜Jš
œžœžœžœžœ	žœžœ˜5šœ
žœžœ˜Jšœžœ˜Jšœ'˜'Jšœžœžœ˜Jšœ;˜;Jš	œžœ
žœžœžœ˜2Jšœžœžœ˜&—J˜�Jšœžœ˜Jšœ
žœžœ˜%Jšœžœžœ˜&Jšœžœžœ
˜Jšœžœžœ˜šœžœžœ˜Jšœžœ˜'Jšœžœ˜Jšœ˜Jš	œžœ
žœ	žœžœ˜+—šœ
žœžœ˜Jšœ&˜&Jšœžœžœ˜Jšœžœ˜
Jšœ%˜%Jš	œ
žœ
žœžœžœ˜1Jšœžœžœ˜%Jšœžœ
žœ˜—J˜�Jšœ
žœ˜Jšœžœžœ˜%Jšœžœžœ˜&J˜�Jšœ	žœžœ˜Jšœ
žœžœ
˜!šœ
žœžœ˜Jšœ˜Jš	œžœžœžœžœ˜/—šœžœžœ˜Jšœ	žœ˜
JšœIžœ˜WJšœžœ˜Jšœ
žœžœ˜0Jšœžœ˜Jšœžœžœžœ
žœžœ˜0Jšœž˜"Jšœ˜—Jšœ
žœžœžœžœžœ˜=Jšœžœžœ
˜"Jšœ
žœ˜Jšœžœžœ˜&Jšœ
žœžœ˜'šœžœžœ˜Jšœžœ˜Jšœžœ
 ˜#Jšœžœ˜—J˜�Jšœ
žœžœ
˜!Jšœžœžœžœ
˜+šœ
žœžœ˜Jšœžœ˜Jšœ]žœ˜kJšœžœ˜—J˜�Jšœžœžœžœ
˜,Jšœ
žœžœ
˜!šœ
žœžœ˜Jšœžœžœ˜Jšœžœ˜Jšœ˜Jšœ˜Jšœžœ
˜—J˜�Jšœ	žœ˜!J˜�šŸœžœ
žœ!˜?Kšœ0˜0Kšžœžœ˜—J˜�šŸœžœ
žœ	˜+K˜�—šŸœžœ
žœ!˜>Kšžœžœ˜K˜�—šŸ
œžœ
žœ	˜(K˜�—Jš
Ÿœžœ
žœ	žœ
žœ	˜BJ˜�šŸ
œžœ
žœ'žœ˜HJ˜&—J˜�JšŸ
œžœ
žœ'žœ˜KJ˜�šŸœžœ
žœžœžœžœ˜`J™/J˜�—šŸ
œžœ
žœžœ+žœžœ
˜J™-J™�—š
Ÿœžœ
žœžœžœ˜IJ™?J˜�—Jš
Ÿœžœž	œ
žœžœ˜FJ˜�Jšžœ˜—J˜�J˜�J˜�—�…—���� Æ��0¾��