CMosImpl.mesa
Copyright © 1983, 1984 by Xerox Corporation. All rights reserved.
by Ch. Jacobi August 11, 1983 3:56 pm
last edited Christian Jacobi October 24, 1984 3:46:59 pm PDT
DIRECTORY
CD,
CDEvents,
CDColors,
CDOps,
CDPanel,
CDProperties,
CDSequencer,
CDDefaults,
CDTipEtc,
CDViewer,
CMos,
Commander USING [CommandProc, Register],
GraphicsColor,
Rope,
TerminalIO,
TokenIO,
UserProfile;
CMosImpl: CEDAR PROGRAM
IMPORTS CD, CDColors, CDEvents, CDOps, CDPanel, CDProperties, CDSequencer, CDTipEtc, CDDefaults, CDViewer, Commander, Rope, TerminalIO, TokenIO, UserProfile
EXPORTS CMos =
BEGIN
cmos: PUBLIC CD.Technology;
cut: PUBLIC CD.Level;
pol: PUBLIC CD.Level;
ndif: PUBLIC CD.Level;
met: PUBLIC CD.Level;
imp: PUBLIC CD.Level;
ovg: PUBLIC CD.Level;
bur: PUBLIC CD.Level;
snerd: PUBLIC CD.Level;
pdif: PUBLIC CD.Level;
pwelCont: PUBLIC CD.Level;
met2: PUBLIC CD.Level;
pwel: PUBLIC CD.Level;
nwel: PUBLIC CD.Level;
nwelCont: PUBLIC CD.Level;
NOcOL: PUBLIC CD.Level;
cut2: PUBLIC CD.Level;
tipTable: Rope.ROPENIL;
defaultTipTable: Rope.ROPE ← "ChipndaleCMos.TIP";
CurrentDiffusion: PUBLIC PROC [design: CD.Design] RETURNS [CD.Level] =
BEGIN
lev: CD.Level ← CDPanel.FetchDefaultLevel[design];
IF lev=ndif OR lev=pdif OR lev=pwelCont OR lev=nwelCont THEN RETURN [lev] ELSE RETURN [CD.combined]
END;
CifName: PROC [lev: CD.Level, name: Rope.ROPE] =
BEGIN
CDProperties.PutPropOnLevel[onto: lev, prop: $CDxCIFName, val: name]
END;
SetLevelNWell: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["NWell for default\n"];
CDPanel.StoreDefaultLevel[comm.design, nwel]
END;
SetLevelDif: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["diffusion for default\n"];
CDPanel.StoreDefaultLevel[comm.design, ndif]
END;
SetLevelPol: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["poly for default\n"];
CDPanel.StoreDefaultLevel[comm.design, pol]
END;
SetLevelMet2: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["metal-2 for default\n"];
CDPanel.StoreDefaultLevel[comm.design, met2]
END;
SetLevelMet: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["metal for default\n"];
CDPanel.StoreDefaultLevel[comm.design, met]
END;
SetLevelPDif: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["p-diff for default\n"];
CDPanel.StoreDefaultLevel[comm.design, pdif]
END;
SetLevelNWCnt: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["N-Well Cnt for default\n"];
CDPanel.StoreDefaultLevel[comm.design, nwelCont]
END;
SetLevelPWCnt: PROC [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["P-Well Cnt for default\n"];
CDPanel.StoreDefaultLevel[comm.design, pwelCont]
END;
DiffToPWorld: PROC [comm: CDSequencer.Command] =
BEGIN
layer: CD.Level = CDDefaults.CurrentLevel[comm.design];
TerminalIO.WriteRope["Switch diffusion to P type"];
SELECT layer FROM
ndif => CDPanel.StoreDefaultLevel[comm.design, pdif];
pwelCont => CDPanel.StoreDefaultLevel[comm.design, nwelCont];
ENDCASE => TerminalIO.WriteRope[" not done"];
TerminalIO.WriteLn[];
END;
DiffToNWorld: PROC [comm: CDSequencer.Command] =
BEGIN
layer: CD.Level = CDDefaults.CurrentLevel[comm.design];
TerminalIO.WriteRope["Switch diffusion to N type"];
SELECT layer FROM
pdif => CDPanel.StoreDefaultLevel[comm.design, ndif];
nwelCont => CDPanel.StoreDefaultLevel[comm.design, pwelCont];
ENDCASE => TerminalIO.WriteRope[" not done"];
TerminalIO.WriteLn[];
END;
RegisterObjectType: PUBLIC PROC [a: ATOM] RETURNS [REF CD.ObjectProcs] =
BEGIN
RETURN [ CD.RegisterObjectType[a, cmos] ];
END;
NewCWorld: Commander.CommandProc =
BEGIN
design: CD.Design ← CDOps.CreateDesign[cmos];
[] ← CDViewer.CreateViewer[design];
END;
WriteTechnologyKey: CDEvents.EventProc =
BEGIN
TokenIO.WriteAtom[$CMos];
TokenIO.WriteInt[1];
END;
ReadTechnologyKey: CDEvents.EventProc =
BEGIN
dont←TRUE;
IF TokenIO.ReadAtom[]=$CMos THEN {
version: INT = TokenIO.ReadInt[];
IF version=1 THEN dont←FALSE
ELSE IF version=0 THEN {
TerminalIO.WriteRope["***********************\n"];
TerminalIO.WriteRope["WARNING: objects using p-diffusion\n"];
TerminalIO.WriteRope["may be displaced; chat with Christian\n"];
TerminalIO.WriteRope["***********************\n"];
dont←FALSE
};
};
IF dont THEN TerminalIO.WriteRope["CMos version miss-match\n"];
END;
NoteProfileChange: UserProfile.ProfileChangedProc =
-- PROC [reason: ProfileChangeReason]
BEGIN
newTipTable: Rope.ROPE ← UserProfile.Token[
key: "Chipndale.CMos.TIPTable",
default: defaultTipTable
];
IF ~Rope.Equal[tipTable, newTipTable] THEN {
CDTipEtc.SetTipTable[cmos, newTipTable];
tipTable ← newTipTable;
};
END;
InitBricks: PROC [] =
BEGIN
bit8: CDColors.DisplayType = CDColors.DisplayType[bit8];
bit4: CDColors.DisplayType = CDColors.DisplayType[bit4];
bw: CDColors.DisplayType = CDColors.DisplayType[bw];
s1: CARDINAL = 1;
s2: CARDINAL = 16;
s3: CARDINAL = 16*16;
s4: CARDINAL = 16*16*16;
ss: CARDINAL = s1+s2+s3+s4;
sf: CARDINAL = s1+s3;
--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[cut, NEW[CDColors.Brick←[7*sf, 11*sf, 7*sf, 11*sf]], bit8];
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[ndif, NEW[CDColors.Brick←[green*sf, green*sf, green*sf, green*sf]], bit8];
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[pdif, NEW[CDColors.Brick←[1*sf, 3*sf, 1*sf, 1*sf]], bit8];
CDColors.DefineColor[pwelCont, NEW[CDColors.Brick←[1*ss, 1*ss, 0*ss, 1*ss]], bit4];
CDColors.DefineColor[pwelCont, NEW[CDColors.Brick←[0*ss, ss, 4*ss, ss]], bw];
CDColors.DefineColor[pwelCont, NEW[CDColors.Brick←[1*sf, 1*sf, 0*sf, 1*sf]], bit8];
CDColors.DefineColor[nwelCont, NEW[CDColors.Brick←[1*ss, 1*ss, 2*ss, 1*ss]], bit4];
CDColors.DefineColor[nwelCont, NEW[CDColors.Brick←[2*ss, ss, 4*ss, ss]], bw];
CDColors.DefineColor[nwelCont, NEW[CDColors.Brick←[1*sf, 1*sf, 2*sf, 1*sf]], bit8];
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[pol, NEW[CDColors.Brick←[red*sf, red*sf, red*sf, red*sf]], bit8];
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[met, NEW[CDColors.Brick←[blue*sf, blue*sf, blue*sf, blue*sf]], bit8];
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[imp, NEW[CDColors.Brick←[14, 14, 0, 0]], bit8];
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[met2, NEW[CDColors.Brick←[2*sf, 29*sf, 2*sf, 37*sf]], bit8];
CDColors.DefineColor[nwel, NEW[CDColors.Brick←[8*s1, 0, 0, 0]], bit4];
CDColors.DefineColor[nwel, NEW[CDColors.Brick←[4*ss, 0, 0, 0]], bw];
CDColors.DefineColor[nwel, NEW[CDColors.Brick←[8*s1, 0, 0, 0]], bit8];
CDColors.DefineColor[pwel, NEW[CDColors.Brick←[4*s1, 0, 0, 0]], bit4];
CDColors.DefineColor[pwel, NEW[CDColors.Brick←[2*ss, 0, 0, 0]], bw];
CDColors.DefineColor[pwel, NEW[CDColors.Brick←[4*s1, 0, 0, 0]], bit8];
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[bur, NEW[CDColors.Brick←[11*sf, 11*sf, 11*sf, 11*sf]], bit8];
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[ovg, NEW[CDColors.Brick←[8*sf, 8*sf, 8*sf, 8*sf]], bit8];
CDColors.DefineColor[snerd, NEW[CDColors.Brick←[12345, 7865, 543, 0]], bit4];
CDColors.DefineColor[snerd, NEW[CDColors.Brick←[12345, 7865, 543, 0]], bw];
CDColors.DefineColor[snerd, NEW[CDColors.Brick←[12345, 7865, 543, 0]], bit8];
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];
CDColors.DefineColor[cut2, NEW[CDColors.Brick←[2*ss, 10*ss, 4*ss, 5*ss]], bit8];
END;
Init: PROC [] =
BEGIN
cmos ← CD.RegisterTechnology[$cmos, "cmos"];
IF cmos=NIL THEN ERROR;
cut ← CD.NewLevel[cmos, $cut];
pol ← CD.NewLevel[cmos, $pol];
ndif ← CD.NewLevel[cmos, $ndif];
met ← CD.NewLevel[cmos, $met];
imp ← CD.NewLevel[cmos, $imp];
ovg ← CD.NewLevel[cmos, $ovg];
bur ← CD.NewLevel[cmos, $bur];
snerd ← CD.NewLevel[cmos, $snerd];
pdif ← CD.NewLevel[cmos, $pdif];
pwelCont ← CD.NewLevel[cmos, $pwelCont];
met2 ← CD.NewLevel[cmos, $met2];
pwel ← CD.NewLevel[cmos, $pwel];
nwel ← CD.NewLevel[cmos, $nwel];
nwelCont ← CD.NewLevel[cmos, $nwelCont];
NOcOL ← CD.NewLevel[cmos, $NOcOL];
cut2 ← CD.NewLevel[cmos, $cut2];
UserProfile.CallWhenProfileChanges[NoteProfileChange];
InitBricks[];
CifName[cut, "CC"];
CifName[ndif, "CD"];
CifName[pol, "CP"];
CifName[met, "CM"];
CifName[imp, "CI"];
CifName[nwel, "CNW"];
CifName[ovg, "CG"];
CifName[bur, "CB"];
CifName[snerd, "CX"];
CifName[nwelCont, "CD"];
CifName[NOcOL, "CY"];
CifName[met2, "CM2"];
CifName[cut2, "CC2"];
CifName[pdif, "CPI"];
CifName[pwelCont, "CPI"];
CifName[pwel, "CPW"];
CDPanel.DefineLevelEntry[cmos, ndif, "ndif", 0, 2*CD.lambda];
CDPanel.DefineLevelEntry[cmos, pdif, "pdif", 0, 2*CD.lambda];
CDPanel.DefineLevelEntry[cmos, pol, "pol", 0, 2*CD.lambda];
CDPanel.DefineLevelEntry[cmos, met, "met", 0, 3*CD.lambda];
CDPanel.DefineLevelEntry[cmos, pwelCont, "p-wCnt", 0, 2*CD.lambda];
CDPanel.DefineLevelEntry[cmos, nwelCont, "n-wCnt", 0, 2*CD.lambda];
CDPanel.DefineLevelEntry[cmos, nwel, "nwel", 0, 0];
CDPanel.DefineLevelEntry[cmos, met2, "met2", 0, 4*CD.lambda];
CDPanel.DefineLevelEntry[cmos, cut, "cut", 0, 0];
CDPanel.DefineLevelEntry[cmos, cut2, "cut2", 0, 0];
CDPanel.DefineLevelEntry[cmos, ovg, "ovg", 0, 0];
CDPanel.DefineLevelEntry[cmos, bur, "bur", 0, 0];
CDPanel.DefineIntEntry[cdValueKey: $CDxSelectNewMode, tech: cmos,
text: "select new:", min: 0, max: 1, default: 1];
CDPanel.DefineNewLine[cmos];
CDPanel.DefineIntEntry[cdValueKey: $CDxStepValue, tech: cmos, text: "step moves size:", min: 1, default: 1];
CDPanel.DefineNewLine[cmos];
CDSequencer.ImplementCommand[$SetLayerNWell, SetLevelNWell, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerNDif, SetLevelDif, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerPol, SetLevelPol, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerMet, SetLevelMet, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerMet2, SetLevelMet2, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerPDif, SetLevelPDif, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerNWCnt, SetLevelNWCnt, cmos, doQueue];
CDSequencer.ImplementCommand[$SetLayerPWCnt, SetLevelPWCnt, cmos, doQueue];
CDSequencer.ImplementCommand[$TestDifFlipToPWorld, DiffToPWorld, cmos, doQueue];
CDSequencer.ImplementCommand[$TestDifFlipToNWorld, DiffToNWorld, cmos, doQueue];
CDEvents.RegisterEventProc[$WriteTechnologyPrivate, WriteTechnologyKey, cmos];
CDEvents.RegisterEventProc[$ReadTechnologyPrivate, ReadTechnologyKey, cmos];
CDTipEtc.SetIcon[cmos, "Chipndale.icons", 3];
CDTipEtc.SetPanelIcon[cmos, "Chipndale.icons", 4];
Commander.Register[
key: "CDNewCmos",
proc: NewCWorld,
doc: "Creates new cmos design"
];
TerminalIO.WriteRope["cmos impl\n"];
END;
Init[];
END.