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];
CleanUp[layoutDesign];
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]];
};
RetrieveDecorate: PWCore.DecorateProc = {
name: ROPE ← CoreOps.GetCellTypeName[cellType];
shellFileName: ROPE ← IO.PutFR["%gShell", IO.rope[name]];
shellDesign: CD.Design ← PW.OpenDesign[shellFileName];
shell: CD.Object ← PW.Get[shellDesign, name];
cellPtr: CD.CellPtr ← NARROW [shell.specificRef];
offset: CD.Position ← CDBasics.SubPoints[CDBasics.BaseOfRect[CD.InterestRect[obj]], CDBasics.BaseOfRect[CD.InterestRect[shell]]];
IF CD.InterestSize[shell]#CD.InterestSize[obj] THEN ERROR;
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 ← CDInstances.Copy[list.first];
IF list.first.ob.class#CDRects.bareRectClass THEN LOOP;
wire ← CoreOps.FindWire[cellType.public, wireName];
IF wireName=NIL OR wire=NIL THEN ERROR;
CDInstances.Translate[instance, offset];
Sinix.AddPinsProp[PWCore.extractMode, wire, instance];
ENDLOOP;
};