<> <> <> <> <<>> DIRECTORY BasicTime, CD, CDOrient, CDBasics, Core, CoreBlock, CoreFrame, CoreGlue, CoreName, CoreOps, CoreProperties, FS, IO, PWCLayoutCheckpoint, PWC, Rope, TypeScript, ViewerIO, WatchStats; CoreFrameImpl: CEDAR PROGRAM IMPORTS BasicTime, CDOrient, CDBasics, CoreBlock, CoreFrame, CoreGlue, CoreName, CoreOps, CoreProperties, FS, IO, PWCLayoutCheckpoint, PWC, Rope, TypeScript, ViewerIO, WatchStats EXPORTS CoreFrame = BEGIN OPEN CoreFrame; Signal: SIGNAL = CODE; frameCellClass: PUBLIC Core.CellClass _ CoreOps.SetClassPrintProc[ class: NEW[ Core.CellClassRec _ [name: "Frame", recast: RecastFrameSoft]], proc: ClassPrintProc]; ClassPrintProc: CoreOps.PrintClassProc = { frame: Frame _ NARROW [data]; LogFrameData[frame, 0, TRUE, out]; FOR ii: INT IN [0..frame.seq.size) DO LogFCT[frame.seq[ii], 1, 21, out] ENDLOOP}; FreeRope: ARRAY Freedom OF ROPE _ ["fixed", "tame", "wild"]; SideRope: PUBLIC ARRAY Side OF ROPE _ ["BOTTOM", "RIGHT", "TOP", "LEFT"]; <<>> LogFCT: PUBLIC PROC[frameCT: CT, indent: INT, lim: INT, out: IO.STREAM _ NIL] = { name: ROPE _ CoreName.CellNm[frameCT].n; gap: INT _ MAX[42 - 2*indent - name.Length[], 2]; frame: Frame; IF out=NIL THEN out _ GetLog[]; IF frameCT.class#frameCellClass THEN {CoreOps.PrintCellType[frameCT]; RETURN}; frame _ FCT[frameCT]; CoreOps.PrintIndent[indent, out]; out.PutRope[name]; FOR ii: INT IN [0..gap) DO out.PutChar[IO.SP] ENDLOOP; LogFrameData[frame, 0, FALSE, out]; IF indent> <> <> <> <> <> <> CellCached: PUBLIC PROC[name: ROPE] RETURNS[cached: BOOL _ TRUE] = { ENABLE FS.Error => {cached _ FALSE; CONTINUE}; file: FS.OpenFile _ FS.Open[ name.Cat["Shell", ".dale"] ]; IF cached THEN FS.Close[file] ELSE log.PutF["\n%g is not cached", IO.rope[name]]}; ReadFrameCache: PUBLIC PROC[name: ROPE] RETURNS[frameCT: CT] = { count: INT _ 0; Period: TYPE = {begin, mid, end}; time: ARRAY Period OF BasicTime.GMT; vm: ARRAY Period OF INT; cell: CT; cached: BOOL _ TRUE; time[begin] _ BasicTime.Now[]; vm[begin] _ WatchStats.GetWatchStats[].vmFree; IF NOT CellCached[name] THEN RETURN[NIL]; cell _ RetrieveAndDecorate[name]; frameCT _ NewFrameCell[size: 0, name: name, rec: [cell: cell] ]; []_CoreName.CellNm[frameCT, CoreName.CellNm[cell].n]; <> <> time[mid] _ BasicTime.Now[]; vm[mid] _ WatchStats.GetWatchStats[].vmFree; count _ PWC.CountTransistors[cell]; time[end] _ BasicTime.Now[]; vm[end] _ WatchStats.GetWatchStats[].vmFree; log.PutF["\nReadFrameCache: %g %g", IO.rope[name], IO.time[]]; log.PutF["\n Begin: vm: %6g %g", IO.int[vm[begin]], IO.time[time[begin]]]; log.PutF["\n Core: vm: %6g %g", IO.int[vm[mid]], IO.time[time[mid]]]; log.PutF["\n Dale: vm: %6g %g", IO.int[vm[end]], IO.time[time[end]]]; log.PutF["\n Cost: vm: %6g", IO.int[ vm[begin]-vm[end] ] ]; log.PutF["\n Xstrs: %g", IO.int[ count ] ]}; WriteFrameCache: PUBLIC PROC[frameCT: CT] = { Period: TYPE = {begin, mid, end}; time: ARRAY Period OF BasicTime.GMT; vm: ARRAY Period OF INT; count: INT; name: ROPE _ CoreName.CellNm[frameCT].n; IF name.Length[]=0 THEN Signal[]; time[begin] _ BasicTime.Now[]; vm[begin] _ WatchStats.GetWatchStats[].vmFree; [ ] _ Expand[hard, frameCT]; [ ] _ CoreGlue.RouteHard[frameCT]; [ ] _ CoreName.CellNm[FCT[frameCT].cell, name]; <> <> PWCLayoutCheckpoint.Store[FCT[frameCT].cell]; FCT[frameCT].cell _ RetrieveAndDecorate[name]; count _ PWC.CountTransistors[FCT[frameCT].cell]; FCT[frameCT].seq _ NEW[FrameSeq[0]]; time[mid] _ BasicTime.Now[]; vm[mid] _ WatchStats.GetWatchStats[].vmFree; <> time[end] _ BasicTime.Now[]; vm[end] _ WatchStats.GetWatchStats[].vmFree; log.PutF["\nWriteFrameCache: %g %g", IO.rope[name], IO.time[]]; log.PutF["\n Start: vm: %6g %g", IO.int[vm[begin]], IO.time[time[begin]]]; log.PutF["\n Built: vm: %6g %g", IO.int[vm[mid]], IO.time[time[mid]]]; log.PutF["\n Cached: vm: %6g %g", IO.int[vm[end]], IO.time[time[end]]]; log.PutF["\n Cost: vm: %6g", IO.int[ vm[begin]-vm[end] ] ]; log.PutF["\n Xstrs: %g", IO.int[ count ] ]}; RetrieveAndDecorate: PUBLIC PROC[name: ROPE] RETURNS[cell: CT] = { cell _ PWCLayoutCheckpoint.Retrieve[name]; CoreBlock.MarkSides[cell]}; <> <> <> <> <> <> <> SetFrameExpandProc: PUBLIC PROC[type: ExpandType, on: REF, proc: REF ExpandProc] = { expandProc: ATOM _ IF type=soft THEN frameExpandSoftProc ELSE frameExpandHardProc; WITH on SELECT FROM cell: Core.CellType => {cell.properties _ CoreProperties.PutProp[cell.properties, expandProc, proc]}; class: Core.CellClass => {class.properties _ CoreProperties.PutProp[class.properties, expandProc, proc]}; ENDCASE => Signal[]}; GetFrameExpandProc: PUBLIC PROC[type: ExpandType, on: REF] RETURNS[proc: REF ExpandProc] = { expandProc: ATOM _ IF type=soft THEN frameExpandSoftProc ELSE frameExpandHardProc; WITH on SELECT FROM cell: Core.CellType => {proc _ NARROW[ CoreProperties.GetCellTypeProp[cell, expandProc].value]}; class: Core.CellClass => {proc _ NARROW[ CoreProperties.GetCellClassProp[class, expandProc].value]}; ENDCASE => Signal[]}; RecastFrameSoft: PUBLIC Core.RecastProc = {Signal[]}; <> RecastFrameHard: PUBLIC Core.RecastProc = { frame: Frame _ FCT[me]; name: ROPE _ CoreName.CellNm[me].n; cells: LIST OF CT; ReOrderFrame[me]; IF frame.cell=NIL THEN { IF frame.seq.size=0 THEN {Signal[]; RETURN[new]}; -- NIL FOR i: INT DECREASING IN [0..frame.seq.size) DO cells _ CONS[RecastFrameHard[frame.seq[i]], cells] ENDLOOP; frame.cell _ CoreBlock.AbutCellList [name: name, first: SideSides[frame.first], cellTypes: cells]}; RETURN[frame.cell]}; <<>> RecastWithLayout: PUBLIC Core.RecastProc = { Signal[] }; <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> < new _ MakeNew[ cell, $Rot90, CDOrient.rotate90];>> <> < new _ MakeNew[ cell, $Rot180, CDOrient.rotate180];>> <> < new _ MakeNew[ cell, $Rot270, CDOrient.rotate270];>> < new _ cell;>> <> <> < {new _ PWC.RotateCellType[new, $Rot90]};>> <> < {new _ PWC.RotateCellType[new, $Rot180]};>> <> < {new _ PWC.RotateCellType[new, $Rot270]}; ENDCASE;>> <