CMosImpl.mesa
Copyright © 1983, 1987 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, August 11, 1983 3:56 pm
Last Edited by: Christian Jacobi, February 25, 1987 3:24:16 pm PST
DIRECTORY
CD,
CDColors,
CDCommandOps,
CDEnvironment,
CDEvents,
CDLayers,
CDPanel,
CDPrivate,
CDRects,
CDSequencer,
CMos,
ImagerColor,
Rope,
TerminalIO,
TokenIO;
CMosImpl:
CEDAR
PROGRAM
IMPORTS CD, CDCommandOps, CDColors, CDEnvironment, CDEvents, CDLayers, CDPanel, CDPrivate, CDRects, CDSequencer, ImagerColor, TerminalIO, TokenIO
EXPORTS CMos
SHARES CDLayers, CDRects =
BEGIN
cmos: PUBLIC CD.Technology ← CD.RegisterTechnology[$CMosA, "CMosA", 2];
lambda: CD.Number = CMos.lambda;
ndif: PUBLIC CD.Layer;
pdif: PUBLIC CD.Layer;
wndif: PUBLIC CD.Layer;
wpdif: PUBLIC CD.Layer;
pwell: PUBLIC CD.Layer;
nwell: PUBLIC CD.Layer;
pwellCont: PUBLIC CD.Layer;
nwellCont: PUBLIC CD.Layer;
pol: PUBLIC CD.Layer;
met: PUBLIC CD.Layer;
met2: PUBLIC CD.Layer;
imp: PUBLIC CD.Layer;
bur: PUBLIC CD.Layer;
ovg: PUBLIC CD.Layer;
cut: PUBLIC CD.Layer;
cut2: PUBLIC CD.Layer;
wpdifClass:
CD.ObjectClass =
CD.RegisterObjectClass[$CMosPDifRect, [
internalRead: CDRects.wellRectClass.internalRead,
technology: cmos
]];
wndifClass:
CD.ObjectClass =
CD.RegisterObjectClass[$CMosNDifRect, [
internalRead: CDRects.wellRectClass.internalRead,
technology: cmos
]];
CurrentDiffusion:
PUBLIC
PROC [design:
CD.Design]
RETURNS [
CD.Layer] =
BEGIN
lev: CD.Layer ← CDLayers.CurrentLayer[design];
IF lev=wpdif THEN RETURN [pdif];
IF lev=wndif THEN RETURN [ndif];
IF lev=ndif OR lev=pdif OR lev=pwellCont OR lev=nwellCont THEN RETURN [lev] ELSE RETURN [CD.undefLayer]
END;
SetLayerNWell:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.PutRope["NWell for default\n"];
CDLayers.SetCurrentLayer[comm.design, nwell]
END;
SetLayerPWell:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.PutRope["PWell for default\n"];
CDLayers.SetCurrentLayer[comm.design, pwell];
END;
SetLayerDif:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.PutRope["diffusion for default\n"];
CDLayers.SetCurrentLayer[comm.design, ndif]
END;
SetLayerPol:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.PutRope["poly for default\n"];
CDLayers.SetCurrentLayer[comm.design, pol]
END;
SetLayerMet2:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.PutRope["metal-2 for default\n"];
CDLayers.SetCurrentLayer[comm.design, met2]
END;
SetLayerMet:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.PutRope["metal for default\n"];
CDLayers.SetCurrentLayer[comm.design, met]
END;
SetLayerPDif:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.PutRope["p-diff for default\n"];
CDLayers.SetCurrentLayer[comm.design, wpdif]
END;
SetLayerNWCnt:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.PutRope["N-Well Cnt for default\n"];
CDLayers.SetCurrentLayer[comm.design, nwellCont]
END;
SetLayerPWCnt:
PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.PutRope["P-Well Cnt for default\n"];
CDLayers.SetCurrentLayer[comm.design, pwellCont]
END;
DiffToPWorld:
PROC [comm: CDSequencer.Command] =
BEGIN
layer: CD.Layer = CDLayers.CurrentLayer[comm.design];
TerminalIO.PutRope["Switch diffusion to P type"];
SELECT layer
FROM
ndif => CDLayers.SetCurrentLayer[comm.design, wpdif];
pwellCont => CDLayers.SetCurrentLayer[comm.design, nwellCont];
ENDCASE => TerminalIO.PutRope[" not done"];
TerminalIO.PutRope["\n"];
END;
DiffToNWorld:
PROC [comm: CDSequencer.Command] =
BEGIN
layer: CD.Layer = CDLayers.CurrentLayer[comm.design];
TerminalIO.PutRope["Switch diffusion to N type"];
SELECT layer
FROM
pdif => CDLayers.SetCurrentLayer[comm.design, ndif];
wpdif => CDLayers.SetCurrentLayer[comm.design, ndif];
nwellCont => CDLayers.SetCurrentLayer[comm.design, pwellCont];
ENDCASE => TerminalIO.PutRope[" not done"];
TerminalIO.PutRope["\n"];
END;
RegisterObjectClass:
PUBLIC
PROC [a:
ATOM]
RETURNS [
CD.ObjectClass] =
BEGIN
RETURN [ CD.RegisterObjectClass[a, [technology: cmos]] ];
END;
WriteTechnologyKey: CDEvents.EventProc = {
h: TokenIO.Handle ← NARROW[x];
TokenIO.WriteAtom[h, $CMos];
TokenIO.WriteInt[h, 1];
ReadTechnologyKey: CDEvents.EventProc = {
h: TokenIO.Handle ← NARROW[x];
dont ← TRUE;
IF TokenIO.ReadAtom[h]=$CMos
THEN {
version: INT = TokenIO.ReadInt[h];
IF version=1 THEN dont←FALSE
ELSE
IF version=0
THEN {
TerminalIO.PutRope["***********************\n"];
TerminalIO.PutRope["WARNING: objects using p-diffusion\n"];
TerminalIO.PutRope["may be displaced; chat with Christian\n"];
TerminalIO.PutRope["***********************\n"];
dont←FALSE
};
};
IF dont THEN TerminalIO.PutRope["CMos version miss-match\n"];
};
InitBricks:
PROC [] =
BEGIN
--8bit colors--
nDiffColor: CARDINAL = 1;
pDiffColor: CARDINAL = 2;
met1Color: CARDINAL = 4;
met2Color: CARDINAL = 8;
polyColor: CARDINAL = 16;
nWellColor: CARDINAL = 32;
pWellColor: CARDINAL = 64;
black: CARDINAL = 127;
Checker8:
PROC[col1, col2:
CARDINAL]
RETURNS[
REF CDColors.Brick] = {
RETURN[NEW[CDColors.Brick ← [col1*256+col2, col2*256+col1, col1*256+col2, col2*256+col1]]]
};
DefineDimmer8:
PROC[lev:
CD.Layer, color:
CARDINAL] = {
CDColors.DefineColor[lev, Checker8[color, 0], bit8, pushedOut];
};
Full8:
PROC[color:
CARDINAL]
RETURNS [b:
REF CDColors.Brick] = {
RETURN[Checker8[color, color]]
};
s1: CARDINAL = 1;
s2: CARDINAL = 16;
s3: CARDINAL = 16*16;
s4: CARDINAL = 16*16*16;
ss: CARDINAL = s1+s2+s3+s4;
--4bit colors--
green: CARDINAL = 1;
blue: CARDINAL = 2;
red: CARDINAL = 4;
yellow: CARDINAL = 14;
CDColors.DefineColor[cut, NEW[CDColors.Brick←[7*ss, 11*ss, 7*ss, 11*ss]], bit4];
CDColors.DefineColor[cut, NEW[CDColors.Brick←[7*ss, 11*ss, 7*ss, 11*ss]], bw];
CDColors.DefineColor[ndif, NEW[CDColors.Brick←[green*ss, green*ss, green*ss, green*ss]], bit4];
CDColors.DefineColor[ndif, NEW[CDColors.Brick←[4*ss, ss, 4*ss, ss]], bw];
CDColors.DefineColor[pdif, NEW[CDColors.Brick←[1*ss, 3*ss, 1*ss, 1*ss]], bit4];
CDColors.DefineColor[pdif, NEW[CDColors.Brick←[5*ss, ss, 4*ss, ss]], bw];
CDColors.DefineColor[pwellCont, NEW[CDColors.Brick←[1*ss, 1*ss, 0*ss, 1*ss]], bit4];
CDColors.DefineColor[pwellCont, NEW[CDColors.Brick←[0*ss, ss, 4*ss, ss]], bw];
CDColors.DefineColor[nwellCont, NEW[CDColors.Brick←[1*ss, 1*ss, 2*ss, 1*ss]], bit4];
CDColors.DefineColor[nwellCont, NEW[CDColors.Brick←[2*ss, ss, 4*ss, ss]], bw];
CDColors.DefineColor[pol, NEW[CDColors.Brick←[red*ss, red*ss, red*ss, red*ss]], bit4];
CDColors.DefineColor[pol, NEW[CDColors.Brick←[8*ss, 4*ss, 2*ss, 1*ss]], bw];
CDColors.DefineColor[met, NEW[CDColors.Brick←[blue*ss, blue*ss, blue*ss, blue*ss]], bit4];
CDColors.DefineColor[met, NEW[CDColors.Brick←[8*ss, 2*ss, 0, 0]], bw];
CDColors.DefineColor[imp, NEW[CDColors.Brick←[yellow*ss, yellow*ss, yellow*ss, yellow*ss]], bit4];
CDColors.DefineColor[imp, NEW[CDColors.Brick←[2*ss, 0, 2*ss, 0]], bw];
CDColors.DefineColor[met2, NEW[CDColors.Brick←[2*(s1+s2+s3), 2*ss, 2*(s1+s2+s3)+15*s4, 2*ss]], bit4];
CDColors.DefineColor[met2, NEW[CDColors.Brick←[8*ss, 8*ss, 2*ss, 2*ss]], bw];
CDColors.DefineColor[nwell, NEW[CDColors.Brick←[8*s1, 0, 0, 0]], bit4];
CDColors.DefineColor[nwell, NEW[CDColors.Brick←[4*ss, 0, 0, 0]], bw];
CDColors.DefineColor[pwell, NEW[CDColors.Brick←[4*s1, 0, 0, 0]], bit4];
CDColors.DefineColor[pwell, NEW[CDColors.Brick←[2*ss, 0, 0, 0]], bw];
CDColors.DefineColor[bur, NEW[CDColors.Brick←[11*ss, 11*ss, 11*ss, 11*ss]], bit4];
CDColors.DefineColor[bur, NEW[CDColors.Brick←[4*ss, 14*ss, 4*ss, 0*ss]], bw];
CDColors.DefineColor[ovg, NEW[CDColors.Brick←[8*ss, 8*ss, 8*ss, 8*ss]], bit4];
CDColors.DefineColor[ovg, NEW[CDColors.Brick←[4*ss, 14*ss, 4*ss, 0*ss]], bw];
CDColors.DefineColor[cut2, NEW[CDColors.Brick←[3*ss, 14*ss, 3*ss, 14*ss]], bit4];
CDColors.DefineColor[cut2, NEW[CDColors.Brick←[3*ss, 14*ss, 3*ss, 14*ss]], bw];
--wpdif should never be drawn
CDColors.DefineColor[wpdif, NEW[CDColors.Brick←[3*ss, 14*ss, 3*ss, 14*ss]], bit4];
CDColors.DefineColor[wpdif, NEW[CDColors.Brick←[3*ss, 14*ss, 3*ss, 14*ss]], bw];
CDColors.DefineColor[ndif, Full8[nDiffColor], bit8];
CDColors.DefineColor[pdif, Full8[pDiffColor], bit8];
CDColors.DefineColor[met, Full8[met1Color], bit8];
CDColors.DefineColor[met2, Full8[met2Color], bit8];
CDColors.DefineColor[pol, Full8[polyColor], bit8];
CDColors.DefineColor[nwell, Full8[nWellColor], bit8];
CDColors.DefineColor[pwell, Full8[pWellColor], bit8];
CDColors.DefineColor[cut, Full8[black], bit8];
CDColors.DefineColor[cut2, Checker8[black, met1Color], bit8];
CDColors.DefineColor[bur, Checker8[black, 0], bit8];
CDColors.DefineColor[nwellCont, Checker8[pDiffColor, met1Color], bit8];
CDColors.DefineColor[pwellCont, Checker8[nDiffColor, met1Color], bit8];
CDColors.DefineColor[ovg, Checker8[met1Color, met2Color], bit8];
CDColors.DefineColor[imp, NEW[CDColors.Brick←[14, 14, 0, 0]], bit8];
CDColors.DefineColor[CD.backgroundLayer, NEW[CDColors.Brick ← [8, 0, 256*8, 0]], bit8];
CDColors.DefineColor[CD.errorLayer, NEW[CDColors.Brick ← [255, 0, 0, 0]], bit8];
CDColors.DefineColor[CD.shadeLayer, NEW[CDColors.Brick←[0, 255,0 , 255]], bit8];
DefineDimmer8[ndif, nDiffColor];
DefineDimmer8[pdif, pDiffColor];
DefineDimmer8[met, met1Color];
DefineDimmer8[met2, met2Color];
DefineDimmer8[pol, polyColor];
DefineDimmer8[nwell, nWellColor];
DefineDimmer8[cut, black];
DefineDimmer8[cut2, black];
-- no change for bur, nwelCont, pwelCont, and ovgc for this background
CDColors.DefineIColor[ndif, ImagerColor.ColorFromRGB[[0, 1, 0]], bit8];
CDColors.DefineIColor[pdif, ImagerColor.ColorFromRGB[[0, 1, 0]], bit8];
CDColors.DefineIColor[nwell, ImagerColor.ColorFromRGB[[0.8, 0.8, 0.5]], bit8];
CDColors.DefineIColor[pwellCont, ImagerColor.ColorFromRGB[[0, 1, 0]], bit8];
CDColors.DefineIColor[nwellCont, ImagerColor.ColorFromRGB[[0, 1, 0]], bit8];
CDColors.DefineIColor[pol, ImagerColor.ColorFromRGB[[1, 0, 0]], bit8];
CDColors.DefineIColor[met, ImagerColor.ColorFromRGB[[0, 0, 1]], bit8];
CDColors.DefineIColor[met2, ImagerColor.ColorFromRGB[[0.7, 0.4, 0.7]], bit8];
CDColors.DefineIColor[ovg, ImagerColor.ColorFromRGB[[0.5, 0.5, 0.5]], bit8];
CDColors.DefineIColor[cut, ImagerColor.ColorFromRGB[[0, 0, 0.1]], bit8];
CDColors.DefineIColor[cut2, ImagerColor.ColorFromRGB[[0, 0.1, 0]], bit8];
CDColors.DefineIColor[bur, ImagerColor.ColorFromRGB[[0.1, 0.1, 0]], bit8];
CDColors.DefineIColor[imp, ImagerColor.ColorFromRGB[[1, 1, 0]], bit8];
END;
Init:
PROC [] =
BEGIN
CDPrivate.ConvertTechnologyKey[cmos, $cmos];
ndif ← CD.NewLayer[cmos, $ndif];
pdif ← CD.NewLayer[cmos, $pdif];
wndif ← CD.NewLayer[cmos, $wndif];
wpdif ← CD.NewLayer[cmos, $wpdif];
pwell ← CD.NewLayer[cmos, $pwel];
nwell ← CD.NewLayer[cmos, $nwel];
pwellCont ← CD.NewLayer[cmos, $pwelCont];
nwellCont ← CD.NewLayer[cmos, $nwelCont];
pol ← CD.NewLayer[cmos, $pol];
met ← CD.NewLayer[cmos, $met];
met2 ← CD.NewLayer[cmos, $met2];
imp ← CD.NewLayer[cmos, $imp];
bur ← CD.NewLayer[cmos, $bur];
ovg ← CD.NewLayer[cmos, $ovg];
cut ← CD.NewLayer[cmos, $cut];
cut2 ← CD.NewLayer[cmos, $cut2];
CDLayers.MakeAbstract[abstract: wpdif, paint: pdif, well: nwell, wSurr: CMos.wellSurround];
CDLayers.MakeAbstract[abstract: wndif, paint: ndif, well: pwell, wSurr: CMos.wellSurround];
CDLayers.MakeSuppressIR[nwell];
CDLayers.MakeSuppressIR[pwell];
InitBricks[];
CDPanel.Layer[ndif, "ndif", 0, 2*lambda, 1, cmos];
CDPanel.Layer[wpdif, "wpdif", 0, 2*lambda, 1, cmos];
CDPanel.Layer[pol, "pol", 0, 2*lambda, 1, cmos];
CDPanel.Layer[met, "met", 0, 3*lambda, 1, cmos];
CDPanel.Layer[pwellCont, "p-wCnt", 0, 2*lambda, 1, cmos];
CDPanel.Layer[nwellCont, "n-wCnt", 0, 2*lambda, 1, cmos];
CDPanel.Layer[nwell, "nwell", 0, 0, 1, cmos];
CDPanel.Layer[met2, "met2", 0, 4*lambda, 1, cmos];
CDPanel.Layer[cut, "cut", 0, 0, 2, cmos];
CDPanel.Layer[cut2, "cut2", 0, 0, 2, cmos];
CDPanel.Layer[ovg, "ovg", 0, 0, 2, cmos];
CDPanel.Layer[bur, "bur", 0, 0, 2, cmos];
CDPanel.Layer[pwell, "(pwell)", 0, 0, 2, cmos];
CDPanel.Layer[pdif, "(pdif)", 0, 2*lambda, 2, cmos];
CDPanel.Layer[wndif, "(wndif)", 0, 2*lambda, 2, cmos];
CDPanel.Layer[CD.commentLayer, " black ", 0, lambda, 0, cmos];
CDPanel.Number[number: [cdValueKey: $CDxStepValue], tech: cmos, button: [text: "step move dist:"], min: 0, default: 0, lambda: lambda];
CDPanel.Number[number: [cdValueKey: $CDxSelectNewMode], tech: cmos, button: [text: "select new mode:", xpos: 180], min: 0, max: 1, default: 1, lambda: 1];
CDPanel.Line[cmos];
CDSequencer.ImplementCommand[$SetLayerNWell, SetLayerNWell, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerNDif, SetLayerDif, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerPol, SetLayerPol, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerMet, SetLayerMet, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerMet2, SetLayerMet2, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerPDif, SetLayerPDif, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerNWCnt, SetLayerNWCnt, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerPWCnt, SetLayerPWCnt, cmos, doQueue];
CDSequencer.ImplementCommand[$TestDifFlipToPWorld, DiffToPWorld, cmos, doQueue];
CDSequencer.ImplementCommand[$TestDifFlipToNWorld, DiffToNWorld, cmos, doQueue];
CDSequencer.ImplementCommand[$DiffToPWorld, DiffToPWorld, cmos, doQueue];
CDSequencer.ImplementCommand[$DiffToNWorld, DiffToNWorld, cmos, doQueue];
CDEvents.RegisterEventProc[$WriteTechnologyPrivate, WriteTechnologyKey, cmos];
CDEvents.RegisterEventProc[$ReadTechnologyPrivate, ReadTechnologyKey, cmos];
CDEnvironment.SetIcon[cmos, "Chipndale.icons", 3];
CDEnvironment.SetPanelIcon[cmos, "Chipndale.icons", 4];
CDEnvironment.SetTipTable[cmos, "Standard"];
CDCommandOps.RegisterCommanderNewDesign[cmos];
TerminalIO.PutRope["cmos-A impl\n"];
END;
Init[];
END.