PipalSinixCMosB.mesa
Copyright Ó 1985, 1987, 1988 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet January 20, 1986 6:24:09 pm PST
Bertrand Serlet March 17, 1988 2:48:01 pm PST
Jean-Marc Frailong January 17, 1988 5:47:02 pm PST
Properties and extraction of common objects
mode: PipalSinix.Mode ←
NEW [PipalSinix.ModeRec ← [
extractMethod: Pipal.RegisterMethod["CMosBExtraction"],
extractProcProp: $CMosBExtractProc,
decoration: PipalCore.CreateDecoration["CMosB"],
objectEqualProc: PipalSinix.AlwaysTrue,
nbOfLayers: nbOfInterestingLayers,
objectLayer: ObjectLayer,
touchProc: Touch,
nameProc: PipalSinix.DefaultName
]];
The standard Touch is hacked both for well and ovg rectangles.
Touch: PipalCore.TouchProc = {
IsRect:
PROC [object: Pipal.Object, layer: PipalMos.Layer]
RETURNS [
BOOL] =
INLINE {
IF NOT ISTYPE [object, PipalMos.Box] THEN RETURN [FALSE];
RETURN [NARROW [object, PipalMos.Box].layer=layer];
};
ChangeRect:
PROC [object: Pipal.Object, layer: PipalMos.Layer]
RETURNS [Pipal.Object] = {
box: PipalMos.Box = NARROW [object];
RETURN [PipalMos.CreateBox[box.size, layer]];
};
IF IsRect[object1, $PwellCont]
THEN
RETURN [
touch[touch, trans1, ChangeRect[object1, $Pwell], trans2, object2] OR
touch[touch, trans1, ChangeRect[object1, $Pdif], trans2, object2]
];
IF IsRect[object1, $NwellCont]
THEN
RETURN [
touch[touch, trans1, ChangeRect[object1, $Nwell], trans2, object2] OR
touch[touch, trans1, ChangeRect[object1, $Ndif], trans2, object2]
];
IF IsRect[object2, $PwellCont]
THEN
RETURN [
touch[touch, trans2, ChangeRect[object2, $Pwell], trans1, object1] OR
touch[touch, trans2, ChangeRect[object2, $Pdif], trans1, object1]
];
IF IsRect[object2, $NwellCont]
THEN
RETURN [
touch[touch, trans2, ChangeRect[object2, $Nwell], trans1, object1] OR
touch[touch, trans2, ChangeRect[object2, $Ndif], trans1, object1]
];
IF IsRect[object1, $Met2]
AND IsRect[object2, $Ovg]
THEN
RETURN [
PipalInt.IsInsideRectangle[PipalInt.BBox[object1, trans1], PipalInt.BBox[object2, trans2]]
];
IF IsRect[object1, $Ovg]
AND IsRect[object2, $Met2]
THEN
RETURN [
PipalInt.IsInsideRectangle[PipalInt.BBox[object2, trans2], PipalInt.BBox[object1, trans1]]
];
RETURN PipalCore.Touch[touch, trans1, object1, trans2, object2];
};
nbOfInterestingLayers: NAT = 10;
defaultLayerRange: PipalSinix.LayerRange = [min: 0, max: nbOfInterestingLayers-1];
interestingLayers: RefTab.Ref ← RefTab.Create[];
Maps [layer -> REF PipalSinix.LayerRange]
Interestinglayers:
PROC [layer: PipalMos.Layer]
RETURNS [PipalSinix.LayerRange] = {
refLayerRange: REF PipalSinix.LayerRange ← NARROW [RefTab.Fetch[interestingLayers, layer].val];
RETURN [IF refLayerRange=NIL THEN defaultLayerRange ELSE refLayerRange^];
};
SetInterestinglayers:
PROC [layer: PipalMos.Layer, range: PipalSinix.LayerRange] = {
[] ← RefTab.Store[interestingLayers, layer, NEW [PipalSinix.LayerRange ← range]];
};
ObjectLayer:
PROC [object: Pipal.Object]
RETURNS [layerRange: PipalSinix.LayerRange] = {
EachChild: PipalInt.EachChildProc = {
thisLayerRange: PipalSinix.LayerRange ←
WITH child
SELECT
FROM
box: PipalMos.Box => Interestinglayers[box.layer],
marker: PipalMos.Marker => Interestinglayers[marker.layer],
text: PipalMos.Text => [nbOfInterestingLayers-1, 0],
picture: PipalMos.Picture => [nbOfInterestingLayers-1, 0],
ENDCASE => ERROR;
layerRange ← [min: MIN [thisLayerRange.min, layerRange.min], max: MAX [thisLayerRange.max, layerRange.max]];
IF layerRange=defaultLayerRange THEN quit ← TRUE;
};
layerRange ← [nbOfInterestingLayers-1, 0];
[] ← PipalMos.EnumerateAtomic[object, EachChild];
IF layerRange.min>layerRange.max THEN layerRange ← defaultLayerRange;
};
Initialization
Set:
PROC [class: Pipal.Class, proc: PipalSinix.ExtractProc] =
INLINE {
Pipal.PutClassMethod[class, mode.extractMethod, NEW [PipalSinix.ExtractProc ← proc]];
};
MakeCMosBShell: PROC [comm: CDSequencer.Command] = {
inst: CD.Instance = CDOps.TheInstance[comm.design];
IF inst=NIL THEN RETURN;
[] ← CDOps.IncludeObjectI[comm.design,
PipalCore.CreateShell[
decoration: mode.decoration,
cellType: PipalExtractOps.ExtractCDInstanceCellTypeAndReport[inst, comm.design, mode],
withCuteFonts: TRUE],
comm.pos];
};
Layers
SetInterestinglayers[$Met2, [0, 0]];
SetInterestinglayers[$Met, [1, 1]];
SetInterestinglayers[$Pol, [2, 2]];
SetInterestinglayers[$Pdif, [3, 3]];
SetInterestinglayers[$Ndif, [4, 4]];
SetInterestinglayers[$Pwell, [5, 5]];
SetInterestinglayers[$Nwell, [6, 6]];
SetInterestinglayers[$Ovg, [0, 7]];
SetInterestinglayers[$PwellCont, [8, 8]];
SetInterestinglayers[$NwellCont, [9, 9]];
SetInterestinglayers[$Cut2, [0, 1]];
SetInterestinglayers[$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
PipalCore.RegisterRoutingLayer[$Ndif];
PipalCore.RegisterRoutingLayer[$Pdif];
PipalCore.RegisterRoutingLayer[$Pol];
PipalCore.RegisterRoutingLayer[$Met];
PipalCore.RegisterRoutingLayer[$Met2];
PipalCore.RegisterRoutingLayer[$Ovg];
Set[Pipal.overlayClass, PipalSinix.ExtractEnumerate];
Set[Pipal.annotationClass, PipalSinix.ExtractAnnotation];
Set[PipalInt.abutClass, PipalSinix.ExtractAbut];
Set[PipalInt.transformClass, PipalSinix.ExtractTransform];
Set[PipalInt.translationClass, PipalSinix.ExtractTransform];
Set[PipalInt.orientClass, PipalSinix.ExtractTransform];
Set[PipalMos.boxClass, PipalSinix.ExtractBox];
Set[PipalMos.starClass, PipalSinix.ExtractStar];
Set[PipalMos.routingClass, PipalSinix.ExtractRouting];
Set[PipalMos.tilingClass, PipalSinix.ExtractTiling];
Set[PipalMos.markerClass, PipalSinix.ExtractAtomic];
Set[PipalMos.textClass, PipalSinix.ExtractNull];
Set[PipalMos.pictureClass, PipalSinix.ExtractNull];
PipalSinix.layoutMode ← mode;
PipalCore.RegisterDecorationIO[mode.decoration];