more fix on Ec/Ev.
[gss-tcad.git] / lib / template / mosstr2.tcl
blobfefecc2b3b0d4241bf8714bc6fd038df44d72995
1 #-------------------
2 # mosstr1
3 #-------------------
4 # Template File for MOS Structures
6 puts "Generate GSS input file..."
8 #COMMENT Derived Quantities and Definitions
9 # WD = depletion width under the drain (microns)
10 # SUBDEP = substrate depth (microns)
11 # LMID = distance to middle
12 # of gate from source edge (microns)
13 # LMAX = width of device (microns)
14 # EPS = roundoff error
15 set WD [expr 3.6E7*sqrt((.8+abs($VDBMAX))/$NSUB)]
16 set SUBDEP [expr int(2*($SDJUNC+$WD+1.5))/2]
17 set LMID [expr $LSOURCE+$LGATE/2]
18 set LMAX [expr $LSOURCE+$LGATE+$LDRAIN]
19 set EPS [expr 0.0002]
21 #COMMENT Only consider LDD implants if LDDPEAK >= NSUB.
22 # LDT ==> LDD implant
23 # LDF ==> No LDD implant
24 if {$LDDPEAK>$NSUB} {
25 set LDT 1
26 set LDF 0
27 } else {
28 set LDT 0
29 set LDF 1
32 #COMMENT Transistor type.
33 if {$TRANTYPE == "PMOS"} {
34 set NMOS 0
35 set PMOS 1
36 } else {
37 set NMOS 1
38 set PMOS 0
41 #COMMENT Threshold implant impurity type.
42 if {$VTTYPE == "N"} {
43 set VTN 1
44 set VTP 0
45 } else {
46 set VTN 0
47 set VTP 1
51 #COMMENT More Derived Quantities
52 # SDDIF = source/drain out-diffusion distance (microns)
53 # LDDIF = lightly doped drain out-diffusion
54 # distance (microns)
56 set NSRF [expr $NSUB+$VTPEAK]
57 if {$NMOS && $VTN} { set NSRF [expr abs($NSUB-$VTPEAK)]}
58 if {$PMOS && $VTP} { set NSRF [expr abs($NSUB-$VTPEAK)]}
60 set NSDJ [expr $NSUB]
61 set TMP [expr $VTPEAK*exp(- pow($SDJUNC/$VTCHAR,2))]
62 if {$NMOS && $VTP} { set NSDJ [expr $NSUB+$TMP]}
63 if {$PMOS && $VTN} { set NSDJ [expr $NSUB+$TMP]}
64 set SDYC [expr $SDJUNC/sqrt(log($SDPEAK/$NSDJ))]
65 if {$LDT} {set NLDJ [expr $NSUB]}
66 if {$LDT} {set TMP [expr $VTPEAK*exp(- pow($LDDJUNC/$VTCHAR,2))]}
67 if {$LDT && $NMOS && $VTP} {set NLDJ [expr $NSUB+$TMP]}
68 if {$LDT && $PMOS && $VTN} {set NLDJ [expr $NSUB+$TMP]}
69 if {$LDT} {set LDYC [expr $LDDJUNC/sqrt(log($LDDPEAK/$NLDJ))]}
71 set FileID [open $FileName w]
72 puts "Write GSS input statements to $FileName"
74 #-----------------------
75 # MESH GENERATION
76 #-----------------------
77 puts $FileID "MESH Type=GSS ModelFile=$TRANTYPE.cgns Triangle=pzAY"
78 puts $FileID "XMESH WIDTH=$LSCONT N.SPACES=[expr int($LSCONT/0.1)]"
79 puts $FileID "XMESH WIDTH=$LSOURCE-$LSCONT N.SPACES=[expr int(($LSOURCE-$LSCONT)/0.1)]"
80 puts $FileID "XMESH WIDTH=$LGATE/2 N.SPACES=[expr int($LGATE/0.2)]"
81 puts $FileID "XMESH WIDTH=$LGATE/2 N.SPACES=[expr int($LGATE/0.2)]"
82 puts $FileID "XMESH WIDTH=$LDRAIN-$LDCONT N.SPACES=[expr int(($LDRAIN-$LDCONT)/0.1)]"
83 puts $FileID "XMESH WIDTH=$LDCONT N.SPACES=[expr int($LDCONT/0.1)]"
85 puts $FileID "YMESH Y.TOP=0.1+$TOX Y.BOTTOM=$TOX N.SPACES=1"
86 puts $FileID "YMESH Y.BOTTOM=0.0 N.SPACES=1"
87 puts $FileID "YMESH DEPTH=$SDJUNC H1=$SDJUNC/8 H2=$SDJUNC/4"
88 puts $FileID "YMESH DEPTH=1-$SDJUNC H1=$SDJUNC/4 H2=0.2"
89 puts $FileID "YMESH Y.BOTTOM=-$SUBDEP H1=0.2 RATIO=1.2"
90 puts $FileID "YMESH Y.BOTTOM=-$SUBDEP-0.1 N.SPACES=1"
92 puts $FileID "ELIMINATE Direction=COLUMNS Y.TOP=-1.5"
94 #-----------------------
95 # REGIONS
96 #-----------------------
97 puts $FileID "#---------------------------------------------------"
98 puts $FileID "REGION Label=Silicon Material=Si"
99 puts $FileID "REGION Label=Oxide Material=Ox IY.MAX=2"
101 #-----------------------
102 # ELECTRODES
103 #-----------------------
104 puts $FileID "REGION Label=Drain IY.MAX=2 X.MIN=$LMAX-$LDCONT Material=Elec"
105 puts $FileID "REGION Label=Gate IY.MAX=1 X.MIN=$LSOURCE X.MAX=$LSOURCE+$LGATE Material=Elec"
106 puts $FileID "REGION Label=Source IY.MAX=2 X.MAX=$LSCONT Material=Elec"
107 puts $FileID "REGION Label=Substrate Y.MAX=-$SUBDEP+0.0001 Material=Elec"
109 #-----------------------
110 # PROFILES
111 #-----------------------
112 if {$VTTYPE == "P"} {
113 set VTTYP "Acceptor"
114 } else {
115 set VTTYP "Donor"
117 if {$NMOS} {
118 set SDTYP "Donor"
119 set SUBTYP "Acceptor"
121 if {$PMOS} {
122 set SDTYP "Acceptor"
123 set SUBTYP "Donor"
127 #-----------------------
128 # ANALYTIC PROFILES
129 #-----------------------
130 puts $FileID "PROFILE Ion=$SUBTYP N.PEAK=$NSUB Type=Uniform X.MIN=0.0 X.MAX=$LMAX Y.TOP=0.0 Y.BOTTOM=-$SUBDEP"
131 if {$VTPEAK > 1.0} {
132 puts $FileID "PROFILE Type=Gauss Ion=$VTTYP N.PEAK=$VTPEAK Y.CHAR=$VTCHAR X.MIN=0.0 X.MAX=$LMAX"
134 if {$LDT} {
135 puts $FileID "PROFILE Type=Gauss Ion=$SDTYP N.PEAK=$LDDPEAK Y.CHAR=$LDYC X.CHAR=[expr $LATD*$LDYC] \
136 X.MIN=0.0 X.MAX=$LSOURCE"
137 puts $FileID "PROFILE Type=Gauss Ion=$SDTYP N.PEAK=$LDDPEAK Y.CHAR=$LDYC X.CHAR=[expr $LATD*$LDYC] \
138 X.MIN=[expr $LMAX-$LDRAIN] X.MAX=[expr $LMAX-$LDRAIN+$LDRAIN]"
141 puts $FileID "PROFILE Type=Gauss Ion=$SDTYP N.PEAK=$SDPEAK Y.CHAR=$SDYC X.CHAR=[expr $LATD*$SDYC] \
142 X.MIN=0.0 X.MAX=[expr $LSOURCE-$LSPACER]"
143 puts $FileID "PROFILE Type=Gauss Ion=$SDTYP N.PEAK=$SDPEAK Y.CHAR=$SDYC X.CHAR=[expr $LATD*$SDYC] \
144 X.MIN=[expr $LMAX-$LDRAIN+$LSPACER] X.MAX=[expr $LMAX-$LDRAIN+$LSPACER+$LDRAIN-$LSPACER]"
147 #-----------------------
148 # REGRIDS
149 #-----------------------
150 # Doping regrids
151 puts $FileID "REFINE Variable=Doping Measure=SignedLog Dispersion=3 Triangle=praz"
153 # Potential regrids
156 #-----------------------
157 # PLOTS
158 #-----------------------
159 puts $FileID "#---------------------------------------------------"
160 puts $FileID "PLOT Variable=DeviceMesh"
162 #-----------------------
163 # Boundary Conditions
164 #-----------------------
165 # WF = Work Function (V)
166 if {$GATE == "PPoly"} {
167 set WF 5.25
168 } elseif {$GATE == "NPoly"} {
169 set WF 4.17
170 } elseif {$GATE == "Al"} {
171 set WF 4.15
174 puts $FileID "#---------------------------------------------------"
175 puts $FileID "BOUNDARY Type = InsulatorInterface ID = IF_Oxide_to_Silicon QF=0"
176 puts $FileID "CONTACT Type = GateContact ID = Gate WorkFunction=$WF"
177 puts $FileID "CONTACT Type = OhmicContact ID = Substrate"
178 puts $FileID "CONTACT Type = OhmicContact ID = Source"
179 puts $FileID "CONTACT Type = OhmicContact ID = Drain"
181 #-----------------------
182 # PLOTS
183 #-----------------------
184 puts $FileID "#---------------------------------------------------"
185 puts $FileID "PLOT Variable=DeviceMesh"
187 #-----------------------
188 # Solve Equilibrium State
189 #-----------------------
190 puts $FileID "METHOD Type = DDML1 Scheme = Newton NS=Basic LS=GMRES"
191 puts $FileID "SOLVE Type = TRANSIENT TStart = 0 TStep=1e-11 TStop = 3e-10"
192 puts $FileID "SOLVE Type = EQUILIBRIUM"
193 puts $FileID "PLOT Variable=Na Resolution=RES.High AzAngle=120 ElAngle=60"
194 puts $FileID "PLOT Variable=Nd Resolution=RES.High AzAngle=120 ElAngle=60"
195 puts $FileID "PLOT Variable=Potential Resolution=RES.High AzAngle=240 ElAngle=20"
196 puts $FileID "PLOT Variable=ElecDensity Resolution=RES.High AzAngle=240 ElAngle=20"
197 puts $FileID "PLOT Variable=HoleDensity Resolution=RES.High AzAngle=240 ElAngle=20"
198 puts $FileID "EXPORT CoreFile = $TRANTYPE.init.cgns"
199 puts $FileID "END"
202 close $FileID