DIRECTORY Convert, Rope, SC, SCInstUtil, SCInitialPlace, SCPlaceUtil, SCPrivate, SCRowUtil, TerminalIO; SCInitialPlaceImpl: CEDAR PROGRAM IMPORTS Convert, Rope, SC, SCInstUtil, SCPlaceUtil, SCRowUtil, TerminalIO EXPORTS SCInitialPlace SHARES SC = { PosInitBp: PROCEDURE[handle: SC.Handle, side: SC.Side] = { PreAssign: SCRowUtil.EachInstProc = { Check: SCRowUtil.EachInstProc = { IF firstInst.fnlPos = instance.fnlPos THEN { TerminalIO.PutRope[Rope.Cat[" Two instances have same position: ", firstInst.name, " and ", instance.name]]; TerminalIO.PutRope[Rope.Cat["\n pos = ", Convert.RopeFromInt[instance.fnlPos], "\n"]]}}; firstInst: SCPrivate.Instance _ instance; IF firstInst.fnlPos > 0 THEN [] _ SCRowUtil.EnumerateInstsOnSide[handle, side, pos +1, bpRow.nBpsOnSide, Check]}; Sort: SCRowUtil.EachInstProc = { InnerSort: SCRowUtil.EachInstProc = { IF bpRow.bpsOnSide[pos].fnlPos < bpRow.bpsOnSide[firstPos].fnlPos THEN { bpRow.bpsOnSide[pos] _ bpRow.bpsOnSide[firstPos]; bpRow.bpsOnSide[firstPos] _ instance}}; firstInst: SCPrivate.Instance _ instance; firstPos: INT _ pos; [] _ SCRowUtil.EnumerateInstsOnSide[handle, side, pos +1, bpRow.nBpsOnSide, InnerSort]}; FixUp: SCRowUtil.EachInstProc = { instance _ bpRow.bpsOnSide[pos]; instance.curPos _ pos}; layoutData: SCPrivate.LayoutData _ NARROW[handle.layoutData]; bpRow: SCPrivate.BpRow _ layoutData.bpRows[side]; IF bpRow.fnlBpFxd OR bpRow.initBpFxd THEN { [] _ SCRowUtil.EnumerateAllInstsOnSide[handle, side, PreAssign]; [] _ SCRowUtil.EnumerateAllInstsOnSide[handle, side, Sort]; [] _ SCRowUtil.EnumerateAllInstsOnSide[handle, side, FixUp]} ELSE {-- positions on side were not specified assign positions [] _ SCRowUtil.EnumerateAllInstsOnSide[handle, side, FixUp]}; SCInstUtil.BpOffsets[handle, side, 0, SCPrivate.maxPos]}; PosInitLg: PROCEDURE[handle: SC.Handle, row: SCPrivate.MaxRowSr] = { PreAssign: SCRowUtil.EachInstProc = { Check: SCRowUtil.EachInstProc = { IF firstInst.fnlPos = instance.fnlPos THEN { TerminalIO.PutRope[Rope.Cat[" Two instances have same position: ", firstInst.name, " and ", instance.name]]; TerminalIO.PutRope[Rope.Cat["\n pos = ", Convert.RopeFromInt[instance.fnlPos], "\n"]]}}; firstInst: SCPrivate.Instance _ instance; IF firstInst.fnlPos > 0 THEN [] _ SCRowUtil.EnumerateInstsOnRow[handle, row, pos +1, lgRow.nLgsOnRow, Check]}; Sort: SCRowUtil.EachInstProc = { InnerSort: SCRowUtil.EachInstProc = { IF lgRow.lgsOnRow[pos].fnlPos < lgRow.lgsOnRow[firstPos].fnlPos THEN { lgRow.lgsOnRow[pos] _ lgRow.lgsOnRow[firstPos]; lgRow.lgsOnRow[firstPos] _ instance}}; firstInst: SCPrivate.Instance _ instance; firstPos: INT _ pos; [] _ SCRowUtil.EnumerateInstsOnRow[handle, row, pos +1, lgRow.nLgsOnRow, InnerSort]}; FixUp: SCRowUtil.EachInstProc = { instance _ lgRow.lgsOnRow[pos]; instance.curPos _ pos}; layoutData: SCPrivate.LayoutData _ NARROW[handle.layoutData]; lgRow: SCPrivate.LgRow _ layoutData.lgRows.rows[row]; IF lgRow.fnlLgFxd OR lgRow.initLgFxd THEN { [] _ SCRowUtil.EnumerateAllInstsOnRow[handle, row, PreAssign]; [] _ SCRowUtil.EnumerateAllInstsOnRow[handle, row, Sort]; [] _ SCRowUtil.EnumerateAllInstsOnRow[handle, row, FixUp]} ELSE { -- positions on row were not specified assign positions [] _ SCRowUtil.EnumerateAllInstsOnRow[handle, row, FixUp]}; SCInstUtil.LgOffsets[handle, row, 0, SCPrivate.maxPos]}; PosInit: PUBLIC PROCEDURE [handle: SC.Handle] = { DoRow: SCRowUtil.EachRowProc = { PosInitLg[handle, row]}; [] _ SCRowUtil.EnumerateRows[handle, DoRow]; PosInitBp[handle, bottom]; PosInitBp[handle, top]}; RowInit: PUBLIC PROCEDURE [handle: SC.Handle] = { NextUnplaced: PROCEDURE [handle: SC.Handle] RETURNS [inst: SCPrivate.Instance _ NIL] = { EachInstance: SCInstUtil.EachInstanceProc = { SELECT instance.whichClass FROM logic => IF instance.curRow = 0 THEN inst _ instance; io => IF instance.curSide = none THEN inst _ instance; ENDCASE; quit _ inst = instance}; [] _ SCInstUtil.EnumerateAllInstances[handle, EachInstance]}; RowPlacInit: PROCEDURE [handle: SC.Handle, instance: SCPrivate.Instance] = { PutRow: SCRowUtil.EachRowProc = { IF lgRow.size.p <= minRowLength THEN IF ~lgRow.fnlLgFxd THEN {minRow _ row; minRowLength _ lgRow.size.p; useRow _ row}}; minRow, useRow: SCPrivate.ZMaxRowSr _ 0; minRowLength: SC.Number _ LAST[INT]; [] _ SCRowUtil.EnumerateRows[handle, PutRow]; IF useRow = 0 THEN {SC.Signal[callingError, Rope.Cat["no valid row to place instance: ", instance.name, "\n"]]; useRow _ 1}; SCPlaceUtil.PutLgRow[handle, instance, useRow]}; SidePlacInit: PROCEDURE [handle: SC.Handle, instance: SCPrivate.Instance] = { PutSide: SCRowUtil.EachSideProc = { IF bpRow.nBpsOnSide <= minSideLength THEN IF ~bpRow.fnlBpFxd AND bpRow.nBpsOnSide < bpRow.maxBpsOnSide THEN {minSide _ side; minSideLength _ bpRow.nBpsOnSide; useSide _ side}}; minSide, useSide: SC.SideOrNone _ none; minSideLength: SC.Number _ LAST[INT]; [] _ SCRowUtil.EnumerateSides[handle, PutSide]; IF useSide = none THEN {SC.Signal[callingError, Rope.Cat["no valid side to place instance: ", instance.name, "\n"]]; useSide _ left}; SCPlaceUtil.PutBpSide[handle, instance, useSide]}; FOR instance: SCPrivate.Instance _ NextUnplaced[handle], NextUnplaced[handle] WHILE instance # NIL DO IF instance.whichClass = logic THEN RowPlacInit[handle, instance] ELSE IF instance.whichClass = io THEN SidePlacInit[handle, instance]; ENDLOOP; PosInitBp[handle, left]; PosInitBp[handle, right]}; }. Xfile: SCInitialPlaceImpl.mesa Last Edited by: Preas, December 21, 1986 3:46:20 pm PST position instances on specified side check to see if two bondingpads have been preassigned to the same slot PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; sort the bondingpads by preassigned slot PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; assign sequential slots to the bondingpads PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; see if positions have been pre assigned check if pre-assignments are valid now sort based on fnlPos now fix up curbppos, they might not be sequential this should be replaced with a more sophisticated version position instances on specified row sort the logics by preassigned slot PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; sort the logics by preassigned slot PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; assign sequential slots to the logics PROC [pos: NAT, instance: SCPrivate.Instance] RETURNS [quit: BOOL _ FALSE]; see if positions have been pre assigned check if pre-assignments are valid now sort based on fnllgpos now fix up curlgpos, they might not be sequential this should be replaced with a more sophisticated version assign the logic row positions now the top and bottom bp sides the left and right side bp positions were assigned in rowinit RowInit place instances that were not preplaced preplace the left and right sides, the top and bottom sides are placed in PosInit Κ@˜šœ™Jšœ4Οk™7J™—š ˜ JšœœL˜]J˜—šΟnœœ˜!Jšœœ0˜IJšœ˜Jšœœ˜ J˜Jšœ%™%šž œ œ œœ ˜:J˜JšœF™Fšž œ˜%JšœK™Kšžœ˜!JšœK™Kšœ$œ˜,Jšœm˜mJšœX˜X—J˜—Jšœ)˜)šœœ˜JšœT˜T—J˜—Jšœ(™(šžœ˜ JšœK™Kšž œ˜%JšœK™Kšœ@œ˜HJšœ1˜1Jšœ'˜'—J˜—Jšœ)˜)Jšœ œ˜JšœX˜XJ˜—Jšœ*™*šžœ˜!JšœK™KJšœ ˜ Jšœ˜J˜—Jšœ#œ˜=J˜1J˜Jšœ(™(šœœœ˜+Jšœ#™#Jšœ@˜@J™Jšœ™Jšœ;˜;J˜Jšœ2™2Jšœ<˜<—J˜šœΟc9˜?J™Jšœ9™9Jšœ=˜=—J˜Jšœ9˜9—J˜Jšœ$™$šž œ œ œ%˜DJ˜Jšœ#™#šž œ˜%JšœK™Kšžœ˜!JšœK™Kšœ$œ˜,Jšœm˜mJšœX˜X—J˜—Jšœ)˜)šœœ˜JšœQ˜Q—J˜—Jšœ#™#šžœ˜ JšœK™Kšž œ˜%JšœK™Kšœ>œ˜FJšœ/˜/Jšœ&˜&——J˜Jšœ)˜)Jšœ œ˜JšœU˜UJ˜—Jšœ%™%šžœ˜!JšœK™KJšœ˜Jšœ˜J˜—Jšœ#œ˜=Jšœ5˜5J˜Jšœ(™(Jšœœœ˜+˜Jšœ#™#Jšœ>˜>J˜Jšœ™Jšœ9˜9J™Jšœ2™2Jšœ:˜:—J˜šœŸ7˜>J™Jšœ9™9Jšœ;˜;—J˜Jšœ8˜8—J˜šžœœ œ œ ˜1J˜Jšœ™šžœ˜ Jšœ˜J˜—Jšœ,˜,J˜Jšœ™Jšœ>™>Jšœ˜Jšœ˜—J˜šžœœ œ œ ˜2J˜J˜š ž œ œ œ œœ˜Xšž œ!˜-codešœ˜Kšœ œœ˜5Kšœœœ˜6Kšœ˜—K˜—Jšœ=˜=J˜—J˜šž œ œ œ*˜LJ˜šžœ˜!šœ˜$šœ˜Jšœ+˜+Jšœ˜——J˜—Jšœ(˜(Jšœœ œœ˜$J˜Jšœ-˜-J˜šœ ˜JšœœY˜\Jšœ ˜ —Jšœ0˜0—J˜šž œ œ œ*˜MJ˜šžœ˜#šœ#˜)šœœ'˜AJšœ2˜2Jšœ˜——J˜—Jšœœ˜'Jšœœ œœ˜%J˜Jšœ/˜/J˜šœ˜šœœC˜FJšœ˜—Jšœ˜—šœ2˜2J˜——Jšœ™Jšœ'™'šœKœ œ˜eJšœœ˜AJšœœœ ˜EJšœ˜—J˜JšœQ™QJ˜Jšœ˜—Jšœ˜J˜——…—,"Δ