DIRECTORY CD, CDEvents, CDOps, CDPanel, CDProperties, CDSequencer, CDTechnology, CDViewer, Commander USING [CommandProc, Register], IO, FS, GraphicsColor, NMos, Rope, SafeStorage, TerminalIO, TokenIO, UserProfile, ViewerOps; NMosImpl: CEDAR PROGRAM IMPORTS CD, CDEvents, CDOps, CDPanel, CDProperties, CDSequencer, CDTechnology, CDViewer, Commander, IO, FS, Rope, SafeStorage, TerminalIO, TokenIO, UserProfile, ViewerOps EXPORTS NMos = BEGIN 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; green: CARDINAL = 1; blue: CARDINAL = 2; red: CARDINAL = 4; yellow: CARDINAL = 14; cut: PUBLIC CD.Level; pol: PUBLIC CD.Level; dif: PUBLIC CD.Level; met: PUBLIC CD.Level; imp: PUBLIC CD.Level; imp0: PUBLIC CD.Level; impWeak: PUBLIC CD.Level; ovg: PUBLIC CD.Level; bur: PUBLIC CD.Level; snerd: PUBLIC CD.Level; nwel: PUBLIC CD.Level; nwelCont: PUBLIC CD.Level; NOcOL: PUBLIC CD.Level; met2: PUBLIC CD.Level; cut2: PUBLIC CD.Level; zone: PUBLIC ZONE _ SafeStorage.GetSystemZone[]; RegisterObjectType: PUBLIC PROC [a: ATOM] RETURNS [REF CD.ObjectProcs] = BEGIN RETURN [ CD.RegisterObjectType[a, nmos] ]; END; NewNWorld: Commander.CommandProc = BEGIN design: CD.Design _ CDOps.CreateDesign[nmos]; [] _ CDViewer.CreateViewer[design]; END; nmos: PUBLIC CD.Technology; CifName: PROC [lev: CD.Level, name: Rope.ROPE] = BEGIN CDProperties.PutPropOnLevel[onto: lev, prop: $CDxCIFName, val: name] END; Init4BitBricks: PROC [] = BEGIN CDTechnology.TeachColor[cut, 4, [7*ss, 11*ss, 7*ss, 11*ss]]; CDTechnology.TeachColor[dif, 4, CDTechnology.Brick4[green]]; CDTechnology.TeachColor[nwelCont, 4, [1*ss, 1*ss, 2*ss, 1*ss]]; CDTechnology.TeachColor[pol, 4, CDTechnology.Brick4[red]]; CDTechnology.TeachColor[met, 4, CDTechnology.Brick4[blue]]; CDTechnology.TeachColor[imp, 4, [14, 14, 0, 0]]; CDTechnology.TeachColor[imp0, 4, [14, 14, 0, 1]]; CDTechnology.TeachColor[impWeak, 4, [14, 14, 0, 2]]; CDTechnology.TeachColor[met2, 4, [2*(s1+s2+s3), 2*ss, 2*(s1+s2+s3)+15*s4, 2*ss]]; CDTechnology.TeachColor[nwel, 4, [8*s1, 0, 0, 0]]; CDTechnology.TeachColor[bur, 4, [11*ss, 11*ss, 11*ss, 11*ss]]; CDTechnology.TeachColor[ovg, 4, [8*ss, 8*ss, 8*ss, 8*ss]]; CDTechnology.TeachColor[snerd, 4, [12345, 7865, 543, 0]]; CDTechnology.TeachColor[cut2, 4, [3*ss, 14*ss, 3*ss, 14*ss]]; END; tipTable: Rope.ROPE _ NIL; NoteProfileChange: UserProfile.ProfileChangedProc = BEGIN newTipTable: Rope.ROPE _ UserProfile.Token[ key: "Chipndale.NMos.TIPTable", default: "ChipndaleNMos.TIP" ]; IF ~Rope.Equal[tipTable, newTipTable] THEN { CDTechnology.SetTipTable[nmos, newTipTable]; tipTable _ newTipTable } END; Init: PROC [] = BEGIN TerminalIO.WriteRope["nmos impl\n"]; nmos _ CD.RegisterTechnology[$nmos, "nmos"]; IF nmos=NIL THEN ERROR; cut _ CD.NewLevel[nmos, $cut]; pol _ CD.NewLevel[nmos, $pol]; dif _ CD.NewLevel[nmos, $dif]; met _ CD.NewLevel[nmos, $met]; imp _ CD.NewLevel[nmos, $imp]; imp0 _ CD.NewLevel[nmos, $imp0]; impWeak _ CD.NewLevel[nmos, $impWeak]; ovg _ CD.NewLevel[nmos, $ovg]; bur _ CD.NewLevel[nmos, $bur]; snerd _ CD.NewLevel[nmos, $snerd]; nwel _ CD.NewLevel[nmos, $nwel]; nwelCont _ CD.NewLevel[nmos, $nwelCont]; NOcOL _ CD.NewLevel[nmos, $NOcOL]; met2 _ CD.NewLevel[nmos, $met2]; cut2 _ CD.NewLevel[nmos, $cut2]; UserProfile.CallWhenProfileChanges[NoteProfileChange]; CDTechnology.TeachColor[cut, 1, [7*ss, 11*ss, 7*ss, 11*ss]]; CDTechnology.TeachColor[cut, 8, [7*sf, 11*sf, 7*sf, 11*sf]]; CDTechnology.TeachColor[cut2, 1, [3*ss, 14*ss, 3*ss, 14*ss]]; CDTechnology.TeachColor[cut2, 8, [3*ss, 14*ss, 3*ss, 14*ss]]; CDTechnology.TeachColor[dif, 1, [4*ss, ss, 4*ss, ss]]; CDTechnology.TeachColor[dif, 8, [1*sf, 1*sf, 1*sf, 1*sf]]; CDTechnology.TeachColor[pol, 1, [8*ss, 4*ss, 2*ss, 1*ss]]; CDTechnology.TeachColor[pol, 8, [4*sf, 4*sf, 4*sf, 4*sf]]; CDTechnology.TeachColor[met, 1, [8*ss, 2*ss, 0, 0]]; CDTechnology.TeachColor[met, 8, [2*sf, 2*sf, 2*sf, 2*sf]]; CDTechnology.TeachColor[imp, 1, [2*ss, 0, 2*ss, 0]]; CDTechnology.TeachColor[imp, 8, [14, 14, 0, 0]]; CDTechnology.TeachColor[imp0, 1, [2*ss, 0, 2*ss, 1]]; CDTechnology.TeachColor[imp0, 8, [14, 14, 0, 1]]; CDTechnology.TeachColor[impWeak, 1, [2*ss, 0, 2*ss, 2]]; CDTechnology.TeachColor[impWeak, 8, [14, 14, 0, 2]]; CDTechnology.TeachColor[met2, 1, [8*ss, 8*ss, 2*ss, 2*ss]]; CDTechnology.TeachColor[met2, 8, [2*sf, 29*sf, 2*sf, 37*sf]]; CDTechnology.TeachColor[nwel, 1, [4*ss, 0, 0, 0]]; CDTechnology.TeachColor[nwel, 8, [8*s1, 0, 0, 0]]; CDTechnology.TeachColor[ovg, 1, [4*ss, 14*ss, 4*ss, 0*ss]]; CDTechnology.TeachColor[ovg, 8, [8*sf, 8*sf, 8*sf, 8*sf]]; CifName[cut, "$NC"]; CifName[dif, "$N"]; CifName[pol, "$NP"]; CifName[met, "$NM"]; CifName[imp, "$NI"]; CifName[imp0, "$ERROR"]; CifName[impWeak, "$ERROR"]; CifName[nwel, "$Y"]; CifName[ovg, "$NG"]; CifName[bur, "$NB"]; CifName[snerd, "$U"]; CifName[nwelCont, "$W"]; CifName[NOcOL, "$X"]; CifName[met2, "$NM2"]; CifName[cut2, "$NC2"]; CDPanel.DefineLevelEntry[nmos, dif, "dif", 0, 2*CD.lambda]; CDPanel.DefineLevelEntry[nmos, pol, "pol", 0, 2*CD.lambda]; CDPanel.DefineLevelEntry[nmos, met, "met", 0, 3*CD.lambda]; CDPanel.DefineLevelEntry[nmos, met2, "met2", 0, 4*CD.lambda]; CDPanel.DefineLevelEntry[nmos, cut, "cut", 0, 0]; CDPanel.DefineLevelEntry[nmos, cut2, "cut2", 0, 0]; CDPanel.DefineLevelEntry[nmos, ovg, "ovg", 0, 0]; CDPanel.DefineIntEntry[cdValueKey: $CDxSelectNewMode, tech: nmos, text: "select new:", min: 0, max: 1, default: 1]; CDPanel.DefineNewLine[nmos]; CDPanel.DefineIntEntry[cdValueKey: $CDxStepValue, tech: nmos, text: "step moves size:", min: 1, default: 1]; CDPanel.DefineIntEntry[cdValueKey: $CDxStretchyMove, tech: nmos, text: "stretchy:", min: 0, max: 1, default: 0]; CDPanel.DefineNewLine[nmos]; BEGIN patNo: INT = UserProfile.Number[key: "Chipndale.NMos.ChipmonkColorPatternNum", default: 0]; IF patNo#0 THEN {ReadCMPatterns[]; SetChipmonkPatterns[patNo]} END; CDEvents.RegisterEventProc[$WriteTechnologyPrivate, WriteTechnologyKey, nmos]; CDEvents.RegisterEventProc[$ReadTechnologyPrivate, ReadTechnologyKey, nmos]; --oldy--CDSequencer.ImplementCommand[$SetLayerDif, SetLevelDif, nmos]; CDSequencer.ImplementCommand[$SetLayerNDif, SetLevelDif, nmos]; CDSequencer.ImplementCommand[$SetLayerPol, SetLevelPol, nmos]; CDSequencer.ImplementCommand[$SetLayerMet, SetLevelMet, nmos]; CDSequencer.ImplementCommand[$SetLayerMet2, SetLevelMet2, nmos]; Commander.Register[ key: "CDNewNmos", proc: NewNWorld, doc: "Creates new nmos design" ]; Commander.Register[ key: "CDNMosPatterns", proc: CMPatterns, doc: "Read chipndale color patterns" ]; END; SetLevelDif: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["diffusion for default\n"]; CDPanel.StoreDefaultLevel[comm.design, dif] END; SetLevelPol: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["poly for default\n"]; CDPanel.StoreDefaultLevel[comm.design, pol] END; SetLevelMet: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["metal for default\n"]; CDPanel.StoreDefaultLevel[comm.design, met] END; SetLevelMet2: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["metal-2 for default\n"]; CDPanel.StoreDefaultLevel[comm.design, met2] END; WriteTechnologyKey: CDEvents.EventProc = BEGIN TokenIO.WriteAtom[$Version]; TokenIO.WriteInt[0]; END; ReadTechnologyKey: CDEvents.EventProc = BEGIN dont_TRUE; IF TokenIO.ReadAtom[]=$Version THEN IF TokenIO.ReadInt[]=0 THEN dont_FALSE; IF dont THEN TerminalIO.WriteRope["NMos version miss-match\n"]; END; --xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx level: TYPE = [0..15]; colPatNum: CARDINAL=8; colPatRead: CARDINAL_0; colPatternTabs: ARRAY [0..colPatNum) OF ARRAY level OF CARDINAL; colPatternBits: ARRAY [0..colPatNum) OF CARDINAL; orLTab: ARRAY level OF CARDINAL _ [11B, 1, 4, 2, 76B, 8, 33B, 10, 9, 1, 10, 62B, 10, 8, 10, 10]; SetChipmonkPatterns: PROC [i: INT] = BEGIN fileLevel: ARRAY level OF CD.Level = [ cut, dif, pol, met, imp, ovg, bur, snerd, cut2, NOcOL, NOcOL, met2, NOcOL, nwel, nwelCont, NOcOL]; IF i<0 THEN { FOR j: NAT IN [0..colPatRead) DO IF colPatternBits[j]=(-i) THEN {i_j; EXIT} ENDLOOP }; IF i>=2 AND i "]; n _ TerminalIO.RequestInt["" ! TerminalIO.UserAbort => GOTO UserAbort]; SetChipmonkPatterns[n] EXITS UserAbort => {NULL}; END; ReadCMPatterns: PROC[fileName: Rope.ROPE _ NIL] = BEGIN binfile: IO.STREAM; k, i, lv: CARDINAL; GetByte: PROC [] RETURNS[c: [0..255]] = INLINE { c _ LOOPHOLE[IO.GetChar[binfile], [0..255]]; }; Get2Bytes: PROC [] RETURNS [c: CARDINAL] = INLINE { h: [0..255] = GetByte[]; c _ h*256+GetByte[]; }; IF fileName=NIL THEN fileName _ UserProfile.Token[ key: "Chipndale.ChipmonkColorPatterns", default: "default.CDColorPatterns" ]; binfile _ FS.StreamOpen[fileName ! FS.Error => IF error.group # bug THEN { TerminalIO.WriteRope[fileName]; TerminalIO.WriteRope[" not opened: "]; TerminalIO.WriteRope[error.explanation]; TerminalIO.WriteLn[]; GOTO FileName }]; k _ MIN[colPatNum, Get2Bytes[]]; colPatRead _ 0; FOR i IN [0..k) DO colPatternBits[i]_Get2Bytes[]; FOR lv IN level DO colPatternTabs[i][lv]_Get2Bytes[]; ENDLOOP; ENDLOOP; colPatRead_k; IO.Close[binfile]; EXITS FileName => {NULL}; END; --xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Init[]; END. œNMosImpl.mesa by Ch. Jacobi August 11, 1983 3:56 pm last edited Christian Jacobi November 23, 1983 10:07 am --4bit colors-- -- PROC [reason: ProfileChangeReason] CDPanel.DefineLevelEntry[nmos, imp, "imp", 0, 0];q CDPanel.DefineLevelEntry[nmos, imp0, "imp0", 0, 0]; CDPanel.DefineLevelEntry[nmos, impWeak, "impWeak", 0, 0]; backgroundGray _ GetColorGray[background]; whiteGray _ GetColorGray[white]; Κ ˜Jšœ ™ J˜Jšœ'™'Jšœ9™9J˜šΟk ˜ Jšœ˜J˜ J˜J˜J˜ J˜ J˜ J˜ Jšœ œ˜(J˜J˜J˜J˜J˜J˜ J˜ Jšœ˜Jšœ ˜ Jšœ ˜ J˜—šΟbœœ˜Jšœœ‘˜«Jšœ˜—Jš˜˜Jšœœ˜Jšœœ˜Jšœœ ˜Jšœœ ˜Jšœœ˜Jšœœ ˜J˜Jšœ™Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜J˜Jšœœœ˜Jšœœœ˜Jšœœœ˜Jšœœœ˜Jšœœœ˜Jšœœœ˜Jšœ œœ˜Jšœœœ˜Jšœœœ˜Jšœœœ˜Jšœœœ˜Jšœ œœ˜Jšœœœ˜Jšœœœ˜Jšœœœ˜J˜Jšœœœ˜0J˜—š Οnœœœœœœ˜HJš˜Jšœœ˜*Jšœ˜J˜J˜—šŸ œ˜#Jš˜Jšœœ#˜-J˜#Jšœ˜J˜—Jšœœœ ˜J˜šŸœœ#˜0Jš˜JšœD˜DJšœ˜—J˜šŸœœ˜Jš˜Jšœ<˜˜>Jšœ:˜:Jšœ9˜9Jšœ=˜=Jšœ˜—J˜Jšœœœ˜J˜šžœ"˜3Jšœœ™%Jš˜šœœ˜+Jšœ ˜ Jšœ˜Jšœ˜—šœ$œ˜,Jšœ,˜,Jšœ˜Jšœ˜—Jšœ˜—J˜šŸœœ˜Jš˜J˜$Jšœœ#˜,Jšœœœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜ Jšœ œ˜&Jšœœ˜Jšœœ˜Jšœœ˜"Jšœœ˜ Jšœ œ˜(Jšœœ˜"Jšœœ˜ Jšœœ˜ J˜Jšœ6˜6J˜Jšœ<˜Jšœ˜J˜JšœN˜NJšœL˜LJ˜J˜FJ˜?J˜>J˜>J˜@J˜˜J˜J˜J˜J˜J˜—šœ˜J˜Jšœ˜J˜$Jšœ˜——˜Jšœ˜J˜—šŸ œœ˜/Jš˜J˜0J˜+Jšœ˜J˜—šŸ œœ˜/Jš˜J˜+J˜+Jšœ˜J˜—šŸ œœ˜/Jš˜J˜,J˜+Jšœ˜J˜—šŸ œœ˜0Jš˜J˜.J˜,Jšœ˜J˜—šžœ˜(Jš˜Jšœ˜Jšœ˜šœ˜J˜——šžœ˜'Jš˜Jšœœ˜ šœœ˜$Jšœœœ˜(—Jšœœ3˜?Jšœ˜—J˜Jšœ:˜:˜J™*J™!Jšœœ ˜Jšœ œ˜Jšœ œ˜Jš œœœœœœ˜@Jšœœœœ˜1JšœœœœA˜`J˜—šŸœœœ˜$Jš˜šœ œœœ ˜&Icodešœ˜Kšœ˜Kšœ˜Kšœ˜—šœœ˜ šœœœ˜ Kšœœœ˜*Kš˜—K˜—šœœ˜šœ œ ˜šœœ˜Jšœ=˜=Jšœ?˜?Jšœ˜—JšœD˜DJš˜——šœœ˜šœ œ ˜šœœ˜Jšœ0˜0Jšœ2˜2Jšœ˜—Jšœ8˜8Jš˜——Jšœœœ˜!Jšœ/œ˜;šœ;œœ˜LJšœœ'˜CJšœ˜—Jšœ˜—J˜šž œ˜#Jš˜Jšœœ˜Jšœœ˜&Jšœ(˜(Jšœ"˜"Jšœ˜Jšœ7œ ˜GJšœ˜š˜Jšœœ˜—Jšœ˜—J˜šΠbnœœœœ˜1Jš˜Jšœ œœ˜Jšœ œ˜šŸœœœœ˜0Jšœœœ˜,Jšœ˜—š Ÿ œœœœœ˜3Jšœ˜Jšœ˜J˜—šœ œœ˜šœ˜Jšœ(˜(Jšœ"˜"Jšœ˜——šœ œœ ˜/šœœ˜Jšœ˜Jšœ&˜&Jšœ)˜)Jšœ˜Jšœ ˜Jšœ˜——Jšœœ˜ Jšœ˜šœœ˜Jšœ˜šœœ˜Jšœ"˜"Jšœ˜—Jšœ˜—Jšœ ˜ Jšœ˜š˜Jšœ œ˜—Jšœ˜—J˜Jšœ:˜:J˜J˜Jšœ˜—…—'π5”