CMosObsImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, March 22, 1985 11:09:09 am PST
Last edited by: Christian Jacobi, October 31, 1986 3:02:40 pm PST
DIRECTORY
CD,
CDAtomicObjects,
CDBasics,
CDOps,
CDStretchyBackdoor,
CMos,
Rope;
CMosObsImpl: CEDAR PROGRAM
IMPORTS CD, CDAtomicObjects, CDBasics, CDOps, CDStretchyBackdoor, CMos, Rope =
BEGIN
lambda: CD.Number = CMos.lambda;
wellSurround: CD.Number = CMos.wellSurround;
-- straight transistors -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
MatchTrans: PROC [me: CD.Object, r: CD.Rect, layer: CD.Layer, prim: BOOL, horz: BOOL] RETURNS [BOOL] = {
--poly, dif, welldif, via
-- Don't care about different diffusions and such
RETURN [layer=me.layer OR layer=CMos.pol]
};
wellTransClass: CD.ObjectClass;
transClass: CD.ObjectClass;
FillTransistor: PROC [ob: CD.Object] RETURNS [mustFail: BOOLFALSE] = {
dExt: CD.Number = 2*lambda;
pExt: CD.Number = 2*lambda;
dif: CD.Layer;
inr: CD.Rect ← ob.bbox;
inr.x2 ← MAX[inr.x2, 2*lambda+2*pExt];
inr.y2 ← MAX[inr.y2, 2*lambda+2*dExt];
IF ob.layer=CMos.wpdif OR ob.layer=CMos.wndif THEN {
ob.class ← wellTransClass;
IF ob.layer=CMos.wpdif THEN dif ← CMos.pdif ELSE dif ← CMos.ndif;
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1-wellSurround+pExt,
x2: inr.x2+wellSurround-pExt,
y1: inr.y1-wellSurround,
y2: inr.y2+wellSurround],
layer: (IF dif=CMos.pdif THEN CMos.nwell ELSE CMos.pwell),
inside: FALSE
];
}
ELSE {
IF ob.layer=CMos.pdif THEN dif ← CMos.pdif ELSE dif ← CMos.ndif;
};
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1+pExt,
x2: inr.x2-pExt,
y1: inr.y1,
y2: inr.y2],
layer: dif
];
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1,
x2: inr.x2,
y1: inr.y1+dExt,
y2: inr.y2-dExt],
layer: CMos.pol
];
};
DescribeT: CD.DescribeProc = {
dExt: CD.Number = 2*lambda;
pExt: CD.Number = 2*lambda;
sz: CD.Position = CD.InterestSize[ob];
RETURN [
Rope.Cat[
"transistor ",
CDOps.LayerRope[ob.layer],
Rope.Cat[" [",
CDOps.LambdaRope[sz.x-2*pExt, lambda],
CDOps.LambdaRope[sz.y-2*dExt, lambda],
"]"]
]
]
};
-- L transistors -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
wellLTransClass: CD.ObjectClass;
FillLTransistor: PROC [ob: CD.Object] RETURNS [mustFail: BOOLFALSE] = {
pExt: CD.Number = 2*lambda; --poly extends gate
dExt: CD.Number = 2*lambda; --diffusion extends gate
dW: CD.Number = 2*lambda; --witdth of diffusion in gate (not width of gate)
pW: CD.Number = 2*lambda; --witdth of poly in gate (not width of gate)
minSz: CD.Number = pExt+2*dExt+dW;
dif: CD.Layer;
inr: CD.Rect ← ob.bbox;
inr.x2 ← MAX[inr.x2, minSz];
inr.y2 ← MAX[inr.y2, minSz];
ob.bbox ← inr;
IF ob.layer=CMos.wpdif OR ob.layer=CMos.wndif THEN {
wR: CD.Rect;
ob.class ← wellLTransClass;
--horizontal piece of nwell
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1-wellSurround+pExt,
x2: inr.x2+wellSurround,
y1: inr.y1-wellSurround ,
y2: inr.y1+wellSurround+dW+2*dExt],
layer: (IF dif=CMos.wpdif THEN CMos.nwell ELSE CMos.pwell),
inside: FALSE
];
--vertical piece of nwell if ~empty
wR ← [x1: inr.x2-(dW+2*dExt)-wellSurround,
x2: inr.x2+wellSurround,
y1: inr.y1+wellSurround+dW+2*dExt,
y2: inr.y2+wellSurround-pExt];
IF CDBasics.NonEmpty[wR] THEN
CDAtomicObjects.Incorporate[ob: ob,
r: wR,
layer: (IF dif=CMos.pdif THEN CMos.nwell ELSE CMos.pwell),
inside: FALSE
];
IF ob.layer=CMos.wpdif THEN dif ← CMos.pdif ELSE dif ← CMos.ndif;
}
ELSE {
IF ob.layer=CMos.pdif THEN dif ← CMos.pdif ELSE dif ← CMos.ndif;
};
--horizontal piece of diff
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1+pExt,
x2: inr.x2,
y1: inr.y1,
y2: 2*dExt+dW],
layer: dif
];
--vertical piece of diff
IF 2*dExt+dW < inr.y2-pExt THEN
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x2-2*dExt-dW,
x2: inr.x2,
y1: 2*dExt+dW,
y2: inr.y2-pExt ],
layer: dif
];
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1,
x2: inr.x2-dExt,
y1: dExt,
y2: dExt+pW],
layer: CMos.pol
];
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x2-pW-dExt,
x2: inr.x2-dExt,
y1: inr.y1+pW+dExt,
y2: inr.y2],
layer: CMos.pol
];
};
-- simple contacts -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
simpleContactClass: CD.ObjectClass;
wellSimpleContactClass: CD.ObjectClass;
FillSimpleCon: PROC [ob: CD.Object] RETURNS [mustFail: BOOLFALSE] = {
rimW: CD.Number ~ lambda; -- therefore NOT large
dif: CD.Layer;
inr: CD.Rect ← [0, 0, 2*lambda+2*rimW, 2*lambda+2*rimW];
IF ob.layer=CMos.wpdif OR ob.layer=CMos.wndif THEN {
ob.class ← wellSimpleContactClass;
dif ← (IF ob.layer=CMos.wpdif THEN CMos.pdif ELSE CMos.ndif);
CDAtomicObjects.Incorporate[ob: ob,
r: CDBasics.Extend[inr, wellSurround],
layer: (IF dif=CMos.pdif THEN CMos.nwell ELSE CMos.pwell),
inside: FALSE
];
}
ELSE {
dif ← ob.layer
};
CDAtomicObjects.Incorporate[ob: ob, r: inr, layer: dif];
CDAtomicObjects.Incorporate[ob: ob, r: inr, layer: CMos.met];
CDAtomicObjects.Incorporate[ob: ob, r: CDBasics.Extend[inr, -rimW], layer: CMos.cut];
};
DescribeC: CD.DescribeProc = {
RETURN [Rope.Cat["contact ", CDOps.LayerRope[ob.layer]]]
};
-- DifShort -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
wellDifShortContactClass: CD.ObjectClass;
FillDifShortCon: PROC [ob: CD.Object] RETURNS [mustFail: BOOLFALSE] = {
dif: CD.Layer;
inr: CD.Rect;
innerW: CD.Number = 4*lambda;
innerH: CD.Number = 8*lambda;
h: CD.Number = innerH/2;
inr ← [x1: 0, y1: 0, x2: innerW, y2: innerH];
IF ob.layer=CMos.wpdif OR ob.layer=CMos.wndif THEN {
ob.class ← wellDifShortContactClass;
IF ob.layer=CMos.wpdif THEN dif ← CMos.pdif ELSE dif ← CMos.ndif;
CDAtomicObjects.Incorporate[ob: ob,
r: [-wellSurround, -wellSurround, innerW+wellSurround, innerH+wellSurround-h],
layer: (IF dif=CMos.pdif THEN CMos.nwell ELSE CMos.pwell),
inside: FALSE
];
}
ELSE {
IF ob.layer=CMos.pdif THEN dif ← CMos.pdif ELSE dif ← CMos.ndif;
};
CDAtomicObjects.Incorporate[ob: ob, r: inr, layer: CMos.met];
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1,
x2: inr.x2,
y1: inr.y1,
y2: inr.y1+h],
layer: dif
];
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1,
x2: inr.x2,
y1: inr.y1+h,
y2: inr.y2],
layer: (IF dif=CMos.pdif THEN CMos.nwellCont ELSE CMos.pwellCont)
];
CDAtomicObjects.Incorporate[ob: ob, r: CDBasics.Extend[inr, -lambda], layer: CMos.cut];
};
-- But -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
wellButContactClass: CD.ObjectClass;
MatchButCon: PROC [me: CD.Object, r: CD.Rect, layer: CD.Layer, prim: BOOL, horz: BOOL] RETURNS [BOOL] = {
-- Don't care about different diffusions and such
RETURN [layer=me.layer OR layer=CMos.met OR layer=CMos.pol]
};
FillButCon: PROC [ob: CD.Object] RETURNS [mustFail: BOOLFALSE] = {
polyH: CD.Number = 3*lambda;
diffOffsetY: CD.Number = polyH-lambda;
inr: CD.Rect ← [x1: 0, y1: 0, x2: 4*lambda, y2: diffOffsetY+4*lambda];
dif: CD.Layer;
IF ob.layer=CMos.wpdif OR ob.layer=CMos.wndif THEN {
ob.class ← wellButContactClass;
IF ob.layer=CMos.wpdif THEN dif ← CMos.pdif ELSE dif ← CMos.ndif;
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1-wellSurround, x2: inr.x2+wellSurround, y1: inr.x1-wellSurround+diffOffsetY, y2: inr.y2+wellSurround],
layer: (IF dif=CMos.pdif THEN CMos.nwell ELSE CMos.pwell),
inside: FALSE
];
}
ELSE {
IF ob.layer=CMos.pdif THEN dif ← CMos.pdif ELSE dif ← CMos.ndif;
};
CDAtomicObjects.Incorporate[ob: ob, r: inr, layer: CMos.met];
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1,
x2: inr.x2,
y1: inr.y1+diffOffsetY,
y2: inr.y2],
layer: dif
];
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: inr.x1,
x2: inr.x2,
y1: inr.y1,
y2: inr.y1+polyH],
layer: CMos.pol
];
CDAtomicObjects.Incorporate[ob: ob,
r: CDBasics.Extend[inr, -lambda],
layer: CMos.cut
];
};
--via -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
FillVia: PROC [ob: CD.Object] RETURNS [mustFail: BOOLFALSE] = {
viaRimWidth: CD.Number = lambda;
cut2min: CD.Number = 3*lambda;
ob.bbox ← [0, 0, cut2min+2*viaRimWidth, cut2min+2*viaRimWidth];
ob.layer ← CMos.met2;
CDAtomicObjects.Incorporate[ob: ob, r: ob.bbox, layer: CMos.met2];
CDAtomicObjects.Incorporate[ob: ob, r: ob.bbox, layer: CMos.met];
CDAtomicObjects.Incorporate[ob: ob,
r: [x1: viaRimWidth,
x2: cut2min+viaRimWidth,
y1: viaRimWidth,
y2: cut2min+viaRimWidth],
layer: CMos.cut2
];
};
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
MatchSimpleCon: PROC [me: CD.Object, r: CD.Rect, layer: CD.Layer, prim: BOOL, horz: BOOL] RETURNS [BOOL] = {
--poly, dif, welldif, via
-- Don't care about different diffusions and such
RETURN [layer=me.layer OR layer=CMos.met]
};
Init: PROC [] =
BEGIN
Register: PROC [key: ATOM, creator: CDAtomicObjects.FillObjectProc, desc: Rope.ROPE, match: CDStretchyBackdoor.MatchProc←NIL] RETURNS [p: CD.ObjectClass] = {
p ← CDAtomicObjects.RegisterAtomicObClass[key, creator, desc, CMos.cmos];
IF p=NIL THEN ERROR;
IF match=NIL THEN match ← MatchSimpleCon;
CDStretchyBackdoor.InstallMatchProc[p, match];
};
--transistors
transClass ← Register[$CTrans, FillTransistor, "transistor", MatchTrans];
transClass.describe ← DescribeT;
wellTransClass ← Register[$CWellTrans, FillTransistor, "transistor", MatchTrans];
wellTransClass.describe ← DescribeT;
[] ← Register[$CLTrans, FillLTransistor, "L-transistor", MatchTrans];
wellLTransClass ← Register[$CLWellTrans, FillLTransistor, "L-transistor", MatchTrans];
--contacts
simpleContactClass ← Register[$CSimpleCon, FillSimpleCon, "contact"];
simpleContactClass.describe ← DescribeC;
wellSimpleContactClass ← Register[$CWellSimpleCon, FillSimpleCon, "contact"];
wellSimpleContactClass.describe ← DescribeC;
[] ← Register[$CDifShortCon, FillDifShortCon, "dif short contact"];
wellDifShortContactClass ← Register[$CWellDifShortCon, FillDifShortCon, "dif short contact"];
[] ← Register[$CButtingCont, FillButCon, "butting contact", MatchButCon];
wellButContactClass ← Register[$CWellButtingCont, FillButCon, "butting contact", MatchButCon];
[] ← Register[$CVia, FillVia, "via"];
END;
Init[];
END.