<> <> <> <> <> <<>> DIRECTORY CD, CDBasics, CDCells, CDCommandOps, CDLayers, CDOps, CDProperties, CDRects, CDRoutingObjects, CDSequencer, CDSymbolicObjects, CDTexts, CMosB, CoreGeometry, CoreGeometryBackdoor, ExtractOps, PW, Rope, Sinix, SinixOps; SinixCMosB: CEDAR PROGRAM IMPORTS CD, CDBasics, CDCells, CDCommandOps, CDLayers, CDOps, CDProperties, CDRects, CDRoutingObjects, CDSymbolicObjects, CDTexts, CMosB, CoreGeometry, CoreGeometryBackdoor, ExtractOps, PW, Sinix, SinixOps SHARES CDCells, CDLayers, CDRects, CDSymbolicObjects, CDTexts = BEGIN <> mode: Sinix.Mode _ NEW [Sinix.ModeRec _ [ extractProcProp: PW.RegisterProp[$CMosBExtractProc, TRUE], decoration: CoreGeometry.CreateDecoration["CMosB"], instanceEqualProc: Sinix.CompareProperties, objectEqualProc: Sinix.AlwaysTrue, nbOfLayers: nbOfInterestingLayers, instanceLayer: InstanceLayer, touchProc: Touch, nameProc: Sinix.DefaultName ]]; IsRect: PROC [instance: CoreGeometry.Instance, layer: CD.Layer] RETURNS [BOOL] = { RETURN [instance.obj.class=CDRects.bareRectClass AND instance.obj.layer=layer]; }; ChangeRect: PROC [instance: CoreGeometry.Instance, layer: CD.Layer] RETURNS [CoreGeometry.Instance] = { RETURN [[obj: CDRects.CreateRect[CD.InterestSize[instance.obj], layer], trans: instance.trans]]; }; <> Touch: CoreGeometry.TouchProc = { IF IsRect[instance1, CMosB.pwellCont] THEN RETURN [ touch[touch, ChangeRect[instance1, CMosB.pwell], instance2] OR touch[touch, ChangeRect[instance1, CMosB.pdif], instance2] ]; IF IsRect[instance1, CMosB.nwellCont] THEN RETURN [ touch[touch, ChangeRect[instance1, CMosB.nwell], instance2] OR touch[touch, ChangeRect[instance1, CMosB.ndif], instance2] ]; IF IsRect[instance2, CMosB.pwellCont] THEN RETURN [ touch[touch, ChangeRect[instance2, CMosB.pwell], instance1] OR touch[touch, ChangeRect[instance2, CMosB.pdif], instance1] ]; IF IsRect[instance2, CMosB.nwellCont] THEN RETURN [ touch[touch, ChangeRect[instance2, CMosB.nwell], instance1] OR touch[touch, ChangeRect[instance2, CMosB.ndif], instance1] ]; IF IsRect[instance1, CMosB.met2] AND IsRect[instance2, CMosB.ovg] THEN RETURN [ CDBasics.Inside[CoreGeometry.BBox[instance2], CoreGeometry.BBox[instance1]] ]; IF IsRect[instance1, CMosB.ovg] AND IsRect[instance2, CMosB.met2] THEN RETURN [ CDBasics.Inside[CoreGeometry.BBox[instance1], CoreGeometry.BBox[instance2]] ]; RETURN CoreGeometry.Touch[touch, instance1, instance2]; }; nbOfInterestingLayers: NAT = 10; defaultLayerRange: Sinix.LayerRange = [min: 0, max: nbOfInterestingLayers-1]; InterestingLayersArray: TYPE = PACKED ARRAY CD.Layer OF Sinix.LayerRange _ ALL [defaultLayerRange]; interestingLayers: REF InterestingLayersArray; InstanceLayer: PROC [inst: CoreGeometry.Instance] RETURNS [layerRange: Sinix.LayerRange] = { EachInstance: CoreGeometry.EachInstanceProc = { thisLayerRange: Sinix.LayerRange _ InstanceLayer[instance]; layerRange _ [min: MIN [thisLayerRange.min, layerRange.min], max: MAX [thisLayerRange.max, layerRange.max]]; IF layerRange=defaultLayerRange THEN quit _ TRUE; }; SELECT TRUE FROM inst.obj.class=CDRects.bareRectClass => layerRange _ interestingLayers[CDLayers.AbstractToPaint[inst.obj.layer]]; CDSymbolicObjects.IsSymbolicOb[inst.obj] => layerRange _ interestingLayers[CDLayers.AbstractToPaint[CDSymbolicObjects.GetLayer[CoreGeometry.CoreGeometryPinToCDPin[inst]]]]; ENDCASE => { layerRange _ [nbOfInterestingLayers-1, 0]; [] _ CoreGeometry.FlattenInstance[inst, EachInstance]; IF layerRange.min>layerRange.max THEN layerRange _ defaultLayerRange; }; }; <> ExtractWellRect: Sinix.ExtractProc = { RETURN (IF obj.layer=CMosB.wpwellCont OR obj.layer=CMosB.wnwellCont THEN Sinix.ExtractAtomic ELSE Sinix.ExtractWellAtomic)[obj, mode, properties, userData]; }; <> Set: PROC [ref: REF, extractAtom: ATOM] = INLINE { WITH ref SELECT FROM class: CD.ObjectClass => CDProperties.PutProp[class, mode.extractProcProp, extractAtom]; className: ATOM => CDProperties.PutProp[CD.FetchObjectClass[className, CMosB.cmosB], mode.extractProcProp, extractAtom]; ENDCASE => ERROR; }; MakeCMosBShell: PROC [comm: CDSequencer.Command] = { inst: CD.Instance = CDOps.TheInstance[comm.design]; IF inst=NIL THEN RETURN; [] _ CDOps.IncludeObjectI[comm.design, CoreGeometry.CreateShell[ decoration: mode.decoration, cellType: ExtractOps.ExtractCDInstanceCellTypeAndReport[inst, comm.design, mode], withCuteFonts: TRUE], comm.pos]; }; <> <> interestingLayers _ NEW [InterestingLayersArray]; interestingLayers[CMosB.met2] _ [0, 0]; interestingLayers[CMosB.met] _ [1, 1]; interestingLayers[CMosB.pol] _ [2, 2]; interestingLayers[CMosB.pdif] _ [3, 3]; interestingLayers[CMosB.ndif] _ [4, 4]; interestingLayers[CMosB.pwell] _ [5, 5]; interestingLayers[CMosB.nwell] _ [6, 6]; interestingLayers[CMosB.ovg] _ [0, 7]; interestingLayers[CMosB.pwellCont] _ [8, 8]; interestingLayers[CMosB.nwellCont] _ [9, 9]; interestingLayers[CMosB.cut2] _ [0, 1]; interestingLayers[CMosB.cut] _ [1, 4]; <> CDCommandOps.RegisterWithMenu[$Debug, "Make CMosB shell", "Make a shell from the extracted object", $MakeCMosBShell, MakeCMosBShell, doQueue]; <> CDProperties.PutLayerProp[CMosB.ndif, $RoutingLayer, $RoutingLayer]; CDProperties.PutLayerProp[CMosB.pdif, $RoutingLayer, $RoutingLayer]; CDProperties.PutLayerProp[CMosB.pol, $RoutingLayer, $RoutingLayer]; CDProperties.PutLayerProp[CMosB.met, $RoutingLayer, $RoutingLayer]; CDProperties.PutLayerProp[CMosB.met2, $RoutingLayer, $RoutingLayer]; CDProperties.PutLayerProp[CMosB.ovg, $RoutingLayer, $RoutingLayer]; <> SinixOps.RegisterDefaultLayoutMode[mode, CMosB.cmosB]; <> <> Sinix.RegisterExtractProc[$CMosBExtractWellRect, ExtractWellRect]; <<>> <> Set[ CDCells.pCellClass, $ExtractCell]; Set[ PW.indirectClass, $ExtractIndirect]; Set[ PW.abutXClass, $ExtractAbut]; Set[ PW.abutYClass, $ExtractAbut]; Set[ PW.rotationClass, $ExtractRotation]; Set[ PW.tilingClass, $ExtractTiling]; Set[ CDRoutingObjects.routingClass, $ExtractRouting]; <> Set[ CDSymbolicObjects.pinClass, $ExtractPin]; Set[ CDSymbolicObjects.segmentClass, $ExtractPin]; Set[ CDSymbolicObjects.markClass, $ExtractPin]; <> Set[ CDRects.bareRectClass, $ExtractRect]; Set[ CDRects.wellRectClass, $CMosBExtractWellRect]; <> Set[ $C2SimpleCon, $ExtractAtomic]; Set[ $C2WellSimpleCon, $CMosBExtractWellRect]; Set[ $C2LargeSimpleCon, $ExtractAtomic]; Set[ $C2LargeWellSimpleCon, $CMosBExtractWellRect]; Set[ $C2DifShortCon, $ExtractAtomic]; Set[ $C2DiffShortCon, $ExtractAtomic]; Set[ $C2WellDifShortCon, $CMosBExtractWellRect]; Set[ $C2Via, $ExtractAtomic]; Set[ $C2LargeVia, $ExtractAtomic]; <> Set[ $C2Trans, $ExtractTransistor]; Set[ $C2WellTrans, $ExtractTransistor]; <> Set[ $C2LTrans, $ExtractTransistor]; Set[ $C2LWellTrans, $ExtractTransistor]; <> Set[ CDTexts.rigidTextClass, $ExtractNull]; Set[ CDTexts.flipTextClass, $ExtractNull]; CoreGeometryBackdoor.RegisterDecorationIO[mode.decoration]; END.