<> <> <> <> DIRECTORY CD, CDCells, CDDirectory, CDInstances, CDIO, CDOps, CDProperties, CDSymbolicObjects, CDTexts, Core, CoreIO, CoreOps, CoreGeometry, IO, LayoutCheckpoint, PW, PWCore, PWObjects, Rope, TerminalIO; LayoutCheckpointImpl: CEDAR PROGRAM IMPORTS CD, CDCells, CDDirectory, CDInstances, CDIO, CDOps, CDProperties, CDSymbolicObjects, CDTexts, CoreIO, CoreOps, CoreGeometry, IO, PW, PWCore, PWObjects, Rope, TerminalIO EXPORTS LayoutCheckpoint SHARES PWCore = BEGIN OPEN LayoutCheckpoint; <> Store: PUBLIC PROC [cellType: CellType, withCuteFonts: BOOL _ FALSE] = { name: ROPE _ CoreOps.GetCellTypeName[cellType]; layout: CD.Object _ PWCore.Layout[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]]; shell: CD.Object; <> TerminalIO.PutF["Saving the Core for cell %g ...\n", IO.rope[name]]; [] _ CoreIO.ReportSaveCellType[cellType]; <> <> CDProperties.PutDesignProp[shellDesign, $BBOXX1, NEW [INT _ layout.bbox.x1]]; CDProperties.PutDesignProp[shellDesign, $BBOXX2, NEW [INT _ layout.bbox.x2]]; CDProperties.PutDesignProp[shellDesign, $BBOXY1, NEW [INT _ layout.bbox.y1]]; CDProperties.PutDesignProp[shellDesign, $BBOXY2, NEW [INT _ layout.bbox.y2]]; TerminalIO.PutF["Making shell for cell %g ...\n", IO.rope[name]]; shell _ CoreGeometry.CreateShell[PWCore.extractMode.decoration, cellType, withCuteFonts]; shellDesign.name _ shellFileName; [] _ CDDirectory.Include[shellDesign, shell, name]; CDOps.IncludeObjectI[shellDesign, shell]; TerminalIO.PutF["Storing Shell for cell %g ...\n", IO.rope[name]]; [] _ CDIO.WriteDesign[shellDesign, shellFileName]; <> layoutDesign.name _ layoutFileName; layout _ PWObjects.CreateCell[LIST [CDInstances.NewInst[layout]], CD.InterestRect[layout], name]; [] _ CDDirectory.Include[layoutDesign, layout, name]; CDOps.IncludeObjectI[layoutDesign, layout]; TerminalIO.PutF["Storing Layout for cell %g ...\n", IO.rope[name]]; [] _ CDIO.WriteDesign[layoutDesign, layoutFileName]; TerminalIO.PutF["... layout checkpoint stored in %g.core, %gLayout.dale and %gShell.dale\n", IO.rope[name], IO.rope[name], IO.rope[name]]; }; <> Retrieve: PUBLIC PROC [name: ROPE] RETURNS [cellType: CellType] = { TerminalIO.PutF["Retrieving the Core for cell %g ...\n", IO.rope[name]]; cellType _ CoreIO.RestoreCellType[name]; TerminalIO.PutF["... core retrieved in %g.core ...\n", IO.rope[name]]; [] _ CoreOps.SetCellTypeName[cellType, name]; -- just to make sure PWCore.SetLayout[cellType, $RetrieveLayout]; }; RetrieveLayout: PWCore.LayoutProc = { name: ROPE _ CoreOps.GetCellTypeName[cellType]; shellFileName: ROPE _ Rope.Cat[name, "Shell"]; shellDesign: CD.Design _ PW.OpenDesign[shellFileName]; bbox: CD.Rect _ [ x1: NARROW [CDProperties.GetDesignProp[shellDesign, $BBOXX1], REF INT]^, x2: NARROW [CDProperties.GetDesignProp[shellDesign, $BBOXX2], REF INT]^, y1: NARROW [CDProperties.GetDesignProp[shellDesign, $BBOXY1], REF INT]^, y2: NARROW [CDProperties.GetDesignProp[shellDesign, $BBOXY2], REF INT]^ ]; shell: CD.Object _ PW.Get[shellDesign, name]; DecorateInst: CDCells.InstEnumerator = { IF CDTexts.IsText[inst.ob] THEN RETURN; BEGIN wireName: ROPE _ NARROW [CDProperties.GetInstanceProp[inst, $InstanceName]]; wire: Wire _ CoreOps.FindWire[cellType.public, wireName]; instance: CoreGeometry.Instance _ [ IF CDSymbolicObjects.IsSymbolicOb[inst.ob] THEN CoreGeometry.CDPinToCoreGeometryPin[inst.ob, inst.properties] ELSE inst.ob, inst.trans]; IF wireName=NIL OR wire=NIL THEN ERROR; CoreGeometry.PutPins[PWCore.extractMode.decoration, wire, CONS [instance, CoreGeometry.GetPins[PWCore.extractMode.decoration, wire]]]; END; }; [] _ CDCells.EnumerateInstances[shell, DecorateInst]; obj _ PWObjects.CreateLazy[info: NEW [InfoRec _ [name]], createProc: LazyReadLayout, bbox: bbox, ir: CD.InterestRect[shell]]; }; Info: TYPE = REF InfoRec; InfoRec: TYPE = RECORD [ name: ROPE, obj: CD.Object _ NIL -- treated as a cache ]; LazyReadLayout: PWObjects.CreateProc = { data: Info = NARROW [info]; obj _ data.obj; IF obj=NIL THEN data.obj _ obj _ PW.Get[PW.OpenDesign[Rope.Cat[data.name, "Layout"]], data.name]; }; <> [] _ PWCore.RegisterLayoutAtom[$RetrieveLayout, RetrieveLayout, NIL]; END.