DIRECTORY CD, CDBasics, CDDirectory, CDInstances, CDIO, CDOps, CDProperties, CDTexts, CDValue, Core, CoreIO, CoreOps, CoreGeometry, IO, LayoutCheckpoint, PW, PWCore, Rope; LayoutCheckpointImpl: CEDAR PROGRAM IMPORTS CD, CDBasics, CDDirectory, CDInstances, CDIO, CDOps, CDProperties, CDTexts, CDValue, CoreIO, CoreOps, CoreGeometry, IO, PW, PWCore, Rope EXPORTS LayoutCheckpoint SHARES 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]]; [] _ CoreOps.SetCellTypeName[cellType, name]; SetFromCheckpoint[cellType]; }; Checkpoint: PUBLIC PROC [cellType: CellType, withCuteFonts: BOOL _ FALSE] = { font: CDTexts.CDFont _ CDTexts.MakeFont["Xerox/TiogaFonts/Helvetica8", 4]; sourceObj: CD.Object _ PWCore.Layout[cellType]; ir: CD.Rect _ PWCore.InterestRect[cellType]; iSize: CD.Position _ CD.InterestSize[sourceObj]; name: ROPE _ CoreOps.GetCellTypeName[cellType]; layoutFileName: ROPE _ Rope.Cat[name, "Layout"]; shellFileName: ROPE _ Rope.Cat[name, "Shell"]; layoutDesign: CD.Design _ CDOps.CreateDesign[CD.FetchTechnology[$cmosB]]; shellDesign: CD.Design _ CDOps.CreateDesign[CD.FetchTechnology[$cmosB]]; layout: CD.Object _ PW.CreateEmptyCell[]; shell: CD.Object _ PW.CreateEmptyCell[]; PW.WriteF["Making shell for cell %g ...\n", IO.rope[name]]; [] _ PW.IncludeInCell[layout, sourceObj]; PW.SetInterestRect[layout, iSize]; PW.RepositionCell[layout]; shell _ CoreGeometry.CreateShell[PWCore.extractMode.decoration, cellType, withCuteFonts]; layoutDesign.name _ layoutFileName; shellDesign.name _ shellFileName; [] _ CDDirectory.Include[layoutDesign, layout, 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?? CDProperties.PutDesignProp[shellDesign, $IRX1, NEW [INT _ ir.x1]]; CDProperties.PutDesignProp[shellDesign, $IRX2, NEW [INT _ ir.x2]]; CDProperties.PutDesignProp[shellDesign, $IRY1, NEW [INT _ ir.y1]]; CDProperties.PutDesignProp[shellDesign, $IRY2, NEW [INT _ ir.y2]]; PW.WriteF["Storing Layout for cell %g ...\n", IO.rope[name]]; [] _ CDIO.WriteDesign[layoutDesign, layoutFileName]; PW.WriteF["Storing Shell for cell %g ...\n", IO.rope[name]]; [] _ CDIO.WriteDesign[shellDesign, shellFileName]; PW.WriteF["... layout checkpoint stored in %gLayout.dale and %gShell.dale\n", IO.rope[name], IO.rope[name]]; }; SetFromCheckpoint: PUBLIC PROC [cellType: CellType] = { RetrieveDecorate[cellType, NIL]; PWCore.SetLayout[cellType, $RetrieveLayout]; }; RetrieveLayout: PWCore.LayoutProc = { name: ROPE _ CoreOps.GetCellTypeName[cellType]; layoutFileName: ROPE _ Rope.Cat[name, "Layout"]; layoutDesign: CD.Design _ PW.OpenDesign[layoutFileName]; obj _ PW.Get[layoutDesign, name]; IF CD.InterestRect[obj]#PWCore.InterestRect[cellType] THEN ERROR; }; RetrieveDecorate: PWCore.DecorateProc = { name: ROPE _ CoreOps.GetCellTypeName[cellType]; layoutFileName: ROPE _ Rope.Cat[name, "Layout"]; shellFileName: ROPE _ Rope.Cat[name, "Shell"]; shellDesign: CD.Design _ PW.OpenDesign[shellFileName]; ir: CD.Rect _ [ x1: NARROW [CDProperties.GetDesignProp[shellDesign, $IRX1], REF INT]^, x2: NARROW [CDProperties.GetDesignProp[shellDesign, $IRX2], REF INT]^, y1: NARROW [CDProperties.GetDesignProp[shellDesign, $IRY1], REF INT]^, y2: NARROW [CDProperties.GetDesignProp[shellDesign, $IRY2], REF INT]^ ]; shell: CD.Object _ PW.Get[shellDesign, name]; cellPtr: CD.CellPtr _ NARROW [shell.specificRef]; offset: CD.Position _ CDBasics.SubPoints[CDBasics.BaseOfRect[ir], CDBasics.BaseOfRect[CD.InterestRect[shell]]]; IF CD.InterestSize[shell]#CDBasics.SizeOfRect[ir] THEN ERROR; CoreGeometry.PutIR[PWCore.extractMode.decoration, cellType, ir]; FOR list: LIST OF CD.Instance _ cellPtr.contents, list.rest WHILE list#NIL DO wireName: ROPE _ NARROW [CDProperties.GetInstanceProp[list.first, $InstanceName]]; wire: Wire; instance: CD.Instance; IF CDTexts.IsText[list.first.ob] THEN LOOP; instance _ CDInstances.Copy[list.first]; CDProperties.PutInstanceProp[instance, $InstanceName, NIL]; -- save some memory wire _ CoreOps.FindWire[cellType.public, wireName]; IF wireName=NIL OR wire=NIL THEN ERROR; CDInstances.Translate[instance, offset]; CoreGeometry.PutPins[PWCore.extractMode.decoration, wire, CONS [instance, CoreGeometry.GetPins[PWCore.extractMode.decoration, wire]]]; ENDLOOP; }; [] _ PWCore.RegisterLayoutAtom[$RetrieveLayout, RetrieveLayout, RetrieveDecorate]; END. *LayoutCheckpointImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reversed. Bertrand Serlet December 1, 1986 11:26:51 pm PST Curry, July 30, 1986 3:46:29 pm PDT Storing and retrieving entire Core + Layout Storing and retrieving layout We wan to store the irProp of the CellType somewhere. Not on the Core, because we want to avoid reading the whole file to get the real properties, not on the Layout, because we want to avoid reading the whole layout file, so we store them on the Shell. we hack a lit bit to be lazy Initialization Κ{˜– "Cedar" stylešœ™Jšœ Οmœ1™Jšœ7˜7Kšžœ,žœ ˜=Jšœ$˜$J˜J™—š  œžœžœžœžœ˜CJšžœ1žœ ˜BJšœ(˜(Kšžœ/žœ ˜@Kšœ-˜-Jšœ˜J˜——™š   œžœžœ%žœžœ˜MJšœJ˜JKšœ žœ"˜/Kšœžœ&˜,Kšœžœ žœ˜0Jšœžœ%˜/Jšœžœ˜0Jšœžœ˜.Jšœžœžœ˜IJšœ žœžœ˜HJšœžœ žœ˜)Jšœžœ žœ˜(Jšžœ*žœ ˜;Kšœžœ"˜)Jšžœ ˜"Jšžœ˜JšœY˜YKšœ#˜#Kšœ!˜!Kšœ5˜5Kšœ3˜3Kšœ.˜.Kšœ)˜)Jšœ9ΟcM˜†Jšœ8‘M˜…J™ύJšœ/žœžœ ˜BJšœ/žœžœ ˜BJšœ/žœžœ ˜BJšœ/žœžœ ˜BJšžœ,žœ ˜=Kšœžœ+˜4Jšžœ+žœ ˜