<> <> <> DIRECTORY CD, CDBasics, CDCleanUp, CDDirectory, CDInstances, CDIO, CDOps, CDProperties, CDRects, CDSimpleRules, CDTexts, CDValue, Core, CoreClasses, CoreIO, CoreOps, CoreProperties, HashTable, IO, LayoutCheckpoint, PW, PWCore, Sinix; LayoutCheckpointImpl: CEDAR PROGRAM IMPORTS CD, CDBasics, CDCleanUp, CDDirectory, CDInstances, CDIO, CDOps, CDProperties, CDRects, CDSimpleRules, CDTexts, CDValue, CoreClasses, CoreIO, CoreOps, CoreProperties, HashTable, IO, PW, PWCore, Sinix EXPORTS LayoutCheckpoint SHARES CDRects, PWCore = BEGIN OPEN LayoutCheckpoint; <> Store: PUBLIC PROC [cellType: CellType, withCuteFonts: BOOL _ FALSE] = { props: LIST OF ATOM; classes: LIST OF Core.CellClass; name: ROPE _ CoreOps.GetCellTypeName[cellType]; PW.WriteF["Saving the Core for cell %g ...\n", IO.rope[name]]; [props, classes] _ CoreIO.ReportSaveCellType[cellType]; PW.WriteF["... core stored in %g.core ...\n", IO.rope[name]]; Checkpoint[cellType, withCuteFonts]; }; <<>> Retrieve: PUBLIC PROC [name: ROPE] RETURNS [cellType: CellType] = { PW.WriteF["Retrieving the Core for cell %g ...\n", IO.rope[name]]; cellType _ CoreIO.RestoreCellType[name]; PW.WriteF["... core retrieved in %g.core ...\n", IO.rope[name]]; SetFromCheckpoint[cellType]; }; <> Checkpoint: PUBLIC PROC [cellType: CellType, withCuteFonts: BOOL _ FALSE] = { font: CDTexts.CDFont _ CDTexts.MakeFont["Xerox/TiogaFonts/Helvetica8", 4]; fontTable: HashTable.Table _ HashTable.Create[equal: HashTable.RopeEqual, hash: HashTable.HashRope]; CreateText: PROC [name: ROPE] RETURNS [obj: CD.Object] = { obj _ NARROW [HashTable.Fetch[fontTable, name].value]; IF obj#NIL THEN RETURN; obj _ CDTexts.CreateText[name, font]; [] _ HashTable.Store[fontTable, name, obj]; }; EachWirePin: PWCore.EachWirePinProc = { minW: INT _ CDSimpleRules.MinWidth[layer]; wireName: ROPE _ CoreOps.GetFullWireName[cellType.public, wire]; pos: CD.Position _ SELECT side FROM left => [0, min], right => [iSize.x-minW, min], top => [min, iSize.y-minW], bottom => [min, 0], ENDCASE => ERROR; inst: CD.Instance _ PW.IncludeInCell[shell, CDSimpleRules.Rect[IF side=left OR side=right THEN [minW, max-min] ELSE [max-min, minW], layer], pos]; inst.properties _ CDProperties.DCopyProps[instance.properties]; CDProperties.PutInstanceProp[inst, $InstanceName, wireName]; IF withCuteFonts THEN [] _ PW.IncludeInCell[ shell, CreateText[wireName], SELECT side FROM left => [pos.x-300, pos.y], right => [pos.x+minW+10, pos.y], top => [pos.x, pos.y+minW+10], bottom => [pos.x, pos.y-300], ENDCASE => ERROR, SELECT side FROM left, right => 0, top, bottom => 2, ENDCASE => ERROR ]; }; sourceObj: CD.Object _ PWCore.Layout[cellType]; iSize: CD.Position _ CD.InterestSize[sourceObj]; name: ROPE _ CoreOps.GetCellTypeName[cellType]; layoutFileName: ROPE _ IO.PutFR["%gLayout", IO.rope[name]]; shellFileName: ROPE _ IO.PutFR["%gShell", IO.rope[name]]; layoutDesign: CD.Design _ CDOps.CreateDesign[CD.FetchTechnology[$cmosB]]; shellDesign: CD.Design _ CDOps.CreateDesign[CD.FetchTechnology[$cmosB]]; shell: CD.Object _ PW.CreateEmptyCell[]; PW.WriteF["Making shell for cell %g ...\n", IO.rope[name]]; [] _ PWCore.EnumerateWirePins[cellType, EachWirePin]; PW.SetInterestRect[shell, iSize]; PW.RepositionCell[shell]; layoutDesign.name _ layoutFileName; shellDesign.name _ shellFileName; [] _ CDDirectory.Include[layoutDesign, sourceObj, name]; [] _ CDDirectory.Include[shellDesign, shell, name]; CDOps.IncludeObjectI[layoutDesign, sourceObj]; CDOps.IncludeObjectI[shellDesign, shell]; CDValue.Store[layoutDesign, $KeepObjects, $KeepObjects]; -- to avoid finalization!!! Have you ever seen objects of class: GCollected?? CDValue.Store[shellDesign, $KeepObjects, $KeepObjects]; -- to avoid finalization!!! Have you ever seen objects of class: GCollected?? CDCleanUp.CleanUp[layoutDesign]; CDCleanUp.CleanUp[shellDesign]; <> <> [] _ CDIO.WriteDesign[layoutDesign, layoutFileName]; [] _ CDIO.WriteDesign[shellDesign, shellFileName]; FlushLayoutProperties[cellType]; PW.FlushSharedCache[]; SetFromCheckpoint[cellType]; PW.WriteF["... layout checkpoint stored in %gLayout.dale and %gShell.dale\n", IO.rope[name], IO.rope[name]]; }; <<>> <> <> <