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 = { otherPos: SCPrivate.ZMaxPosSr _ instance.fnlPos; IF curPos = otherPos THEN { TerminalIO.WriteRope[Rope.Cat[" Two instances have same position: ", firstInst.name, " and ", instance.name]]; TerminalIO.WriteRope[Rope.Cat["\n pos = ", Convert.RopeFromInt[firstPos], "\n"]]}}; firstInst: SCPrivate.Instance _ instance; firstPos: SCPrivate.ZMaxPosSr _ pos; curPos: SCPrivate.ZMaxPosSr _ firstInst.fnlPos; IF curPos > 0 THEN [] _ SCRowUtil.EnumerateInstsOnSide[handle, side, firstPos +1, bpRow.nBpsOnSide, Check]}; Sort: SCRowUtil.EachInstProc = { InnerSort: SCRowUtil.EachInstProc = { IF instance.fnlPos < firstInst.fnlPos THEN { bpRow.bpsOnSide[firstPos] _ instance; bpRow.bpsOnSide[pos] _ firstInst}}; firstInst: SCPrivate.Instance _ instance; firstPos: SCPrivate.ZMaxPosSr _ pos; [] _ SCRowUtil.EnumerateInstsOnSide[handle, side, firstPos +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, 0]}; PosInitLg: PROCEDURE[handle: SC.Handle, row: SCPrivate.MaxRowSr] = { PreAssign: SCRowUtil.EachInstProc = { Check: SCRowUtil.EachInstProc = { otherPos: SCPrivate.ZMaxPosSr _ instance.fnlPos; IF curPos = otherPos THEN { TerminalIO.WriteRope[Rope.Cat[" Two instances have same position: ", firstInst.name, " and ", instance.name]]; TerminalIO.WriteRope[Rope.Cat["\n pos = ", Convert.RopeFromInt[curPos], "\n"]]}}; firstInst: SCPrivate.Instance _ instance; firstPos: SCPrivate.ZMaxPosSr _ pos; curPos: SCPrivate.ZMaxPosSr _ firstInst.fnlPos; IF curPos > 0 THEN [] _ SCRowUtil.EnumerateInstsOnRow[handle, row, firstPos +1, lgRow.nLgsOnRow, Check]}; Sort: SCRowUtil.EachInstProc = { InnerSort: SCRowUtil.EachInstProc = { IF instance.fnlPos < firstInst.fnlPos THEN { lgRow.lgsOnRow[firstPos] _ instance; lgRow.lgsOnRow[pos] _ firstInst}}; firstInst: SCPrivate.Instance _ instance; firstPos: SCPrivate.ZMaxPosSr _ pos; [] _ SCRowUtil.EnumerateInstsOnRow[handle, row, firstPos +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, 0]}; 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.EnumerateInstances[handle, EachInstance]}; RowPlacInit: PROCEDURE [handle: SC.Handle, instance: SCPrivate.Instance] = { PutRow: SCRowUtil.EachRowProc = { IF lgRow.size.p <= minRowLength THEN {minRow _ row; minRowLength _ lgRow.size.p; IF ~lgRow.fnlLgFxd THEN 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 {minSide _ side; minSideLength _ bpRow.nBpsOnSide; IF ~bpRow.fnlBpFxd AND bpRow.nBpsOnSide < bpRow.maxBpsOnSide THEN 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]}; }. bfile: ///StdCell/SCInitialPlaceImpl.mesa Last Edited by: Preas, September 6, 1985 7:20:47 pm PDT position instances on specified side 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 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™7J™—šΟk ˜ J˜Jšœ˜Jšœ˜Jšœ ˜ Jšœ˜J˜ J˜ Jšœ ˜ Jšœ ˜ J˜—šœœ˜!Jšœœ0˜IJšœ˜Jšœœ˜ J˜Jšœ%™%šΟn œ œ œœ ˜:J˜šœ%˜%šœ!˜!Jšœ0˜0šœœ˜Jšœo˜oJšœS˜S—J˜—Jšœ)˜)Jšœ$˜$Jšœ/˜/šœ œ˜JšœY˜Y—J˜—šœ ˜ šœ%˜%šœ$œ˜,Jšœ%˜%Jšœ#˜#—J˜—Jšœ)˜)Jšœ$˜$Jšœ]˜]J˜—šœ!˜!Jšœ ˜ Jšœ˜J˜—Jšœ#œ˜=J˜1J˜Jšœ(™(šœœœ˜+Jšœ#™#Jšœ@˜@J™Jšœ™Jšœ;˜;J˜Jšœ2™2Jšœ<˜<—J˜šœΟc9˜?J™Jšœ9™9Jšœ=˜=—J˜Jšœ*˜*—J˜Jšœ$™$šž œ œ œ%˜DJ˜šœ%˜%šœ!˜!Jšœ0˜0šœœ˜Jšœo˜oJšœQ˜Q—J˜—Jšœ)˜)Jšœ$˜$Jšœ/˜/šœ œ˜JšœV˜V—J˜—šœ ˜ šœ%˜%šœ$œ˜,Jšœ$˜$Jšœ"˜"——J˜Jšœ)˜)Jšœ$˜$JšœZ˜ZJ˜—šœ!˜!Jšœ˜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šœ)˜)—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šœ\˜\Jšœ ˜ —Jšœ0˜0—J˜šž œ œ œ*˜MJ˜˜#šœ#˜)Jšœ2˜2Jšœœ'œ˜S—J˜—Jšœœ˜'Jšœœ œœ˜%J˜Jšœ/˜/J˜šœ˜šœF˜FJšœ˜—Jšœ˜—šœ2˜2J˜——Jšœ™Jšœ'™'šœKœ œ˜eJšœœ˜AJšœœœ ˜EJš˜—J˜JšœQ™QJ˜Jšœ˜—Jšœ˜J˜——…—Έπ