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??
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.
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]];
};
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;
};