SinixCMosB.mesa
Copyright Ó 1985, 1987 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet January 20, 1986 6:24:09 pm PST
Bertrand Serlet September 15, 1987 7:33:20 pm PDT
Jean-Marc Frailong January 17, 1988 5:47:02 pm PST
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
Properties and extraction of common objects
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
]];
The standard Touch is hacked both for well and ovg rectangles.
Touch: CoreGeometry.TouchProc = {
IsRect: PROC [instance: CoreGeometry.Instance, layer: CD.Layer] RETURNS [BOOL] = INLINE {
RETURN [instance.obj.class=CDRects.bareRectClass AND instance.obj.layer=layer];
};
ChangeRect: PROC [instance: CoreGeometry.Instance, layer: CD.Layer] RETURNS [CoreGeometry.Instance] = INLINE {
RETURN [[obj: CDRects.CreateRect[CD.InterestSize[instance.obj], layer], trans: instance.trans]];
};
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;
};
};
Hack for WellRect
ExtractWellRect: Sinix.ExtractProc = {
RETURN (IF obj.layer=CMosB.wpwellCont OR obj.layer=CMosB.wnwellCont THEN Sinix.ExtractAtomic ELSE Sinix.ExtractWellAtomic)[obj, mode, properties, userData];
};
Initialization
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];
};
FilterMask: SinixOps.FilterProc = {RETURN [Rope.Match["*.mask", name]]};
Layers
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];
Command to see the shell
CDCommandOps.RegisterWithMenu[$Debug, "Make CMosB shell", "Make a shell from the extracted object", $MakeCMosBShell, MakeCMosBShell, doQueue];
Layer properties
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];
Highlight and background extraction for this technology
SinixOps.RegisterDefaultLayoutMode[mode, CMosB.cmosB];
SinixOps.RegisterBackgroundExtractionCommand[CMosB.cmosB, mode, "CMosB background extraction", $CMosBBackgroundExtract, FilterMask];
Extraction Procs
Sinix.RegisterExtractProc[$CMosBExtractWellRect, ExtractWellRect];
Cells, Abuts, Rotations, RoutingClass, Tiling
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];
Pins
Set[ CDSymbolicObjects.pinClass,  $ExtractPin];
Set[ CDSymbolicObjects.segmentClass,  $ExtractPin];
Set[ CDSymbolicObjects.markClass,  $ExtractPin];
Rectangles
Set[ CDRects.bareRectClass,   $ExtractRect];
Set[ CDRects.wellRectClass,   $CMosBExtractWellRect];
Contacts
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];
Transistors
Set[ $C2Trans,    $ExtractTransistor];
Set[ $C2WellTrans,   $ExtractTransistor];
Angle Transistors
Set[ $C2LTrans,    $ExtractTransistor];
Set[ $C2LWellTrans,   $ExtractTransistor];
Texts
Set[ CDTexts.rigidTextClass,   $ExtractNull];
Set[ CDTexts.flipTextClass,   $ExtractNull];
CoreGeometryBackdoor.RegisterDecorationIO[mode.decoration];
END.