more fix on Ec/Ev.
[gss-tcad.git] / lib / template / mosstr1.tcl
blob326df6756ed439fe2ad4e00d30976449884ab602
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 of gate
12 # 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
54 # out-diffusion distance (microns)
56 set NSRF [expr $NSUB+$VTPEAK]
57 if { $NMOS && $VTN } {
58 set NSRF [expr abs($NSUB-$VTPEAK)]
60 if { $PMOS && $VTP } {
61 set NSRF [expr abs($NSUB-$VTPEAK)]
64 set NSDJ [expr $NSUB]
65 set TMP [expr $VTPEAK*exp(- pow($SDJUNC/$VTCHAR,2))]
66 if { $NMOS && $VTP } {
67 set NSDJ [expr $NSUB+$TMP]
69 if { $PMOS && $VTN } {
70 set NSDJ [expr $NSUB+$TMP]
72 set SDYC [expr $SDJUNC/sqrt(log($SDPEAK/$NSDJ))]
73 set SDXC [expr $SDYC*$LATD]
74 set SDDIF [expr $SDXC*sqrt(log($SDPEAK/$NSRF))]
76 if { $LDT } {
77 set NLDJ [expr $NSUB]
78 set TMP [expr $VTPEAK*exp(- pow($LDDJUNC/$VTCHAR,2))]
79 if { $NMOS && $VTP } {
80 set NLDJ [expr $NSUB+$TMP]
82 if { $PMOS && $VTN } {
83 set NLDJ [expr $NSUB+$TMP]
85 set LDYC [expr $LDDJUNC/sqrt(log($LDDPEAK/$NLDJ))]
86 set LDXC [expr $LDYC*$LATD]
87 set LDDIF [expr $LDXC*sqrt(log($LDDPEAK/$NSRF))]
90 if { $LDF } {
91 set LDDIF [expr 0.0 ]
94 #COMMENT More definitions
95 # LSSDIF = distance from source edge
96 # to edge of source diffusion
97 # LDDDIF = distance from drain edge
98 # to edge of drain diffusion
99 # SCE2JD = source contact edge
100 # to junction distance (microns)
101 # DCE2JD = drain contact edge
102 # to junction distance (microns)
103 # SCESP = grid spacing at source contact edge (microns)
104 # DCESP = grid spacing at drain contact edge (microns)
105 # LSLDIF = distance from source edge
106 # to edge of LDD diffusion
107 # LDLDIF = distance from drain edge
108 # to edge of LDD diffusion
110 set LSSDIF [expr $LSOURCE-$LSPACER+$SDDIF]
111 set LDDDIF [expr $LDRAIN-$LSPACER+$SDDIF]
112 set SCE2JD [expr $LSSDIF-$LSCONT]
113 set DCE2JD [expr $LDDDIF-$LDCONT]
114 set SCESP [expr $SCE2JD-($SCE2JD-$JUNCSP)/$RATIO]
115 set DCESP [expr $DCE2JD-($DCE2JD-$JUNCSP)/$RATIO]
116 set LSLDIF [expr $LSOURCE+$LDDIF]
117 set LDLDIF [expr $LDRAIN+$LDDIF]
121 #COMMENT Evaluate Statement Mask Logicals
122 # A ==> (SDDIF+JUNCSP) < LSPACER
123 # A1 ==> (SDDIF+JUNCSP) >= LSPACER
124 # B ==> A1 & (SDDIF < (LSPACER+JUNCSP))
125 # B1 ==> B & LDT & (2*JUNCSP < LDDIF)
126 # B2 ==> B & LDT & (2*JUNCSP >= LDDIF)
127 # C ==> A1 & (SDDIF >= (LSPACER+JUNCSP))
128 # C1 ==> C & LDT & ((SDDIF+2*JUNCSP) < (LDDIF+LSPACER))
129 # C2 ==> C & LDT & ((SDDIF+2*JUNCSP) >= (LDDIF+LSPACER))
130 # D ==> LDT & (SDDIF < (LSPACER+LDDIF))
131 # D1 ==> LDT & (SDDIF >= (LSPACER+LDDIF))
132 # E ==> D & (LDDJUNC < SDJUNC)
133 # E1 ==> D & (LDDJUNC >= SDJUNC)
135 set A 0
136 set A1 0
137 set B 0
138 set B1 0
139 set B2 0
140 set C 0
141 set C1 0
142 set C2 0
143 set D 0
144 set D1 0
145 set E 0
146 set E1 0
147 set F 0
148 set F1 0
149 set G 0
150 set G1 0
151 set G2 0
152 set G3 0
154 set TMP [expr int(($SDDIF+$JUNCSP+$EPS)/($LSPACER+$EPS))]
156 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
157 set A 0
158 set A1 1
159 } else {
160 set A 1
161 set A1 0
164 if { $A && $LDT} {
165 set WD [expr ($LSPACER-$SDDIF+$LDDIF)/2]
166 set SPC [expr $WD-($WD-$JUNCSP)/$RATIO]
167 set SPT [expr $LSSDIF+$WD]
168 set DPT [expr $LDDDIF+$WD]
171 #COMMENT More masks
172 # G ==> A & LDT & ((SDDIF+WD+SPC) < LSPACER)
173 # G1 ==> A & LDT & ((SDDIF+WD+SPC) >= LSPACER)
174 # G2 ==> G1 & ((SDDIF+WD) < (LSPACER+SPC))
175 # G3 ==> G1 & ((SDDIF+WD) >= (LSPACER+SPC))
177 if { $A1 } {
178 set TMP [expr int($SDDIF/($LSPACER+$JUNCSP))]
179 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
180 set B 0
181 set C 1
182 } else {
183 set B 1
184 set C 0
188 if { $B && $LDT} {
189 set TMP [expr int((2*$JUNCSP)/$LDDIF)]
190 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
191 set B1 0
192 set B2 1
193 } else {
194 set B1 1
195 set B2 0
199 if { $C && $LDT} {
200 set TMP [expr int(($SDDIF+2*$JUNCSP)/($LDDIF+$LSPACER))
201 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
202 set C1 0
203 set C2 1
204 } else {
205 set C1 1
206 set C2 0
210 if { $LDT } {
211 set TMP [expr int($SDDIF/($LSPACER+$LDDIF))]
212 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
213 set D 0
214 set D1 1
215 } else {
216 set D 1
217 set D1 0
221 if { $D } {
222 set TMP [expr int($LDDJUNC/$SDJUNC) ]
223 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
224 set E 0
225 set E1 1
226 } else {
227 set E 1
228 set E1 0
232 if { $A && $LDT} {
233 set TMP [expr int(($SDDIF+$WD+$SPC)/$LSPACER) ]
234 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
235 set G 0
236 set G1 1
237 } else {
238 set G 1
239 set G1 0
243 if { $G1 } {
244 set TMP [expr int(($SDDIF+$WD)/($LSPACER+$SPC))]
245 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
246 set G2 0
247 set G3 1
248 } else {
249 set G2 1
250 set G3 0
254 set FileID [open $FileName w]
255 puts "Write GSS input statements to $FileName"
257 #-----------------------
258 # MESH statement
259 #-----------------------
260 puts $FileID "MESH Type=GSS ModelFile=$TRANTYPE.cgns Triangle=pzAY"
262 #-----------------------
263 # XMESH statements
264 #-----------------------
265 puts $FileID "#---------------------------------------------------"
266 set WD [expr $SCESP]
267 set TMP [expr int($SCESP/$LSCONT) ]
268 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
269 set X1 1
270 } else {
271 set X1 0
274 if { $X1 } {
275 set WD $LSCONT
278 puts $FileID "XMESH X.MAX=$LSCONT H2=$WD RATIO=$RATIO"
280 if {$A} {
281 puts $FileID "XMESH X.MAX=$LSSDIF H2=$JUNCSP RATIO=$RATIO"
284 if {$G} {
285 puts $FileID "XMESH X.MAX=$SPT H1=$JUNCSP RATIO=$RATIO"
286 puts $FileID "XMESH X.MAX=$LSOURCE H1=$SPC RATIO=1/$RATIO"
287 puts $FileID "XMESH X.MAX=$LSLDIF H2=$JUNCSP RATIO=$RATIO"
290 if {$G2} {
291 puts $FileID "XMESH X.MAX=$LSOURCE H1=$JUNCSP RATIO=$RATIO"
292 puts $FileID "XMESH X.MAX=$LSLDIF H2=$JUNCSP RATIO=$RATIO"
295 if {$G3} {
296 puts $FileID "XMESH X.MAX=$LSOURCE H1=$JUNCSP RATIO=$RATIO"
297 puts $FileID "XMESH X.MAX=$SPT H2=$SPC RATIO=1/$RATIO"
298 puts $FileID "XMESH X.MAX=$LSLDIF H2=$JUNCSP RATIO=$RATIO"
301 if {$A && $LDT} {
302 puts $FileID "XMESH X.MAX=$LMID H1=$JUNCSP RATIO=$RATIO"
303 puts $FileID "XMESH X.MAX=$LMAX-$LDLDIF H2=$JUNCSP RATIO=$RATIO"
306 if {$G3} {
307 puts $FileID "XMESH X.MAX=$LMAX-$DPT H1=$JUNCSP RATIO=$RATIO"
308 puts $FileID "XMESH X.MAX=$LMAX-$LDRAIN H1=$SPC RATIO=1/$RATIO"
309 puts $FileID "XMESH X.MAX=$LMAX-$LDDDIF H2=$JUNCSP RATIO=$RATIO"
312 if {$G2} {
313 puts $FileID "XMESH X.MAX=$LMAX-$LDRAIN H1=$JUNCSP RATIO=$RATIO"
314 puts $FileID "XMESH X.MAX=$LMAX-$LDDDIF H2=$JUNCSP RATIO=$RATIO"
317 if {$G} {
318 puts $FileID "XMESH X.MAX=$LMAX-$LDRAIN H1=$JUNCSP RATIO=$RATIO"
319 puts $FileID "XMESH X.MAX=$LMAX-$DPT H2=$SPC RATIO=1/$RATIO"
320 puts $FileID "XMESH X.MAX=$LMAX-$LDDDIF H2=$JUNCSP RATIO=$RATIO"
323 if {$A && $LDF } {
324 set TMP [expr $LSPACER-$SDDIF]
325 set GCESP [expr $TMP-($TMP-$JUNCSP)/$RATIO]
326 puts $FileID "XMESH X.MAX=$LSOURCE H1=$JUNCSP RATIO=$RATIO"
327 puts $FileID "XMESH X.MAX=$LMID H1=$GCESP RATIO=$RATIO"
328 puts $FileID "XMESH X.MAX=$LMAX-$LDRAIN H2=$GCESP RATIO=$RATIO"
329 puts $FileID "XMESH X.MAX=$LMAX-$LDDDIF H2=$JUNCSP RATIO=$RATIO"
332 if {$A} { puts $FileID "XMESH X.MAX=$LMAX-$LDCONT H1=$JUNCSP RATIO=$RATIO" }
334 if {$B} { puts $FileID "XMESH X.MAX=$LSOURCE H2=$JUNCSP RATIO=$RATIO"}
335 if {$B1} { puts $FileID "XMESH WIDTH=$LDDIF/2 H1=$JUNCSP RATIO=$RATIO"}
336 if {$B1} { puts $FileID "XMESH WIDTH=$LDDIF/2 H2=$JUNCSP RATIO=$RATIO"}
337 if {$B} { puts $FileID "XMESH X.MAX=$LMID H1=$JUNCSP RATIO=$RATIO"}
338 if {$B1} { puts $FileID "XMESH X.MAX=$LMAX-$LDLDIF H2=$JUNCSP RATIO=$RATIO"}
339 if {$B1} { puts $FileID "XMESH WIDTH=$LDDIF/2 H1=$JUNCSP RATIO=$RATIO"}
340 if {$B1} { puts $FileID "XMESH WIDTH=$LDDIF/2 H2=$JUNCSP RATIO=$RATIO"}
341 if {$B2} { puts $FileID "XMESH X.MAX=$LMAX-$LDRAIN H2=$JUNCSP RATIO=$RATIO"}
342 if {$B && $LDF} { puts $FileID "XMESH X.MAX=$LMAX-$LDRAIN H2=$JUNCSP RATIO=$RATIO"}
343 if {$B} { puts $FileID "XMESH X.MAX=$LMAX-$LDCONT H1=$JUNCSP RATIO=$RATIO"}
345 if {$C} {
346 set TMP [expr $SDDIF-$LSPACER]
347 set GCESP [expr $TMP-($TMP-$JUNCSP)/$RATIO]
348 puts $FileID "XMESH X.MAX=$LSOURCE H1=$SCESP H2=$GCESP"
349 puts $FileID "XMESH X.MAX=$LSSDIF H2=$JUNCSP RATIO=$RATIO"
351 if {$C1} {puts $FileID "XMESH WIDTH=[expr ($LDDIF-$SDDIF+$LSPACER)/2] H1=$JUNCSP RATIO=$RATIO"}
352 if {$C1} {puts $FileID "XMESH WIDTH=[expr ($LDDIF-$SDDIF+$LSPACER)/2] H2=$JUNCSP RATIO=$RATIO"}
353 if {$C} {puts $FileID "XMESH X.MAX=$LMID H1=$JUNCSP RATIO=$RATIO"}
354 if {$C1} {puts $FileID "XMESH X.MAX=$LMAX-$LDLDIF H2=$JUNCSP RATIO=$RATIO"}
355 if {$C1} {puts $FileID "XMESH WIDTH=[expr ($LDDIF-$SDDIF+$LSPACER)/2] H1=$JUNCSP RATIO=$RATIO"}
356 if {$C1} {puts $FileID "XMESH WIDTH=[expr ($LDDIF-$SDDIF+$LSPACER)/2] H2=$JUNCSP RATIO=$RATIO"}
357 if {$C2} {puts $FileID "XMESH X.MAX=$LMAX-$LDDDIF H2=$JUNCSP RATIO=$RATIO"}
358 if {$C && $LDF} {puts $FileID "XMESH X.MAX=$LMAX-$LDDDIF H2=$JUNCSP RATIO=$RATIO"}
359 if {$C} {puts $FileID "XMESH X.MAX=$LMAX-$LDRAIN H1=$JUNCSP RATIO=$RATIO"}
360 if {$C} {puts $FileID "XMESH X.MAX=$LMAX-$LDCONT H1=$GCESP H2=$DCESP"}
362 set WD [expr $DCESP]
363 set TMP [expr int($DCESP/$LDCONT)]
364 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
365 set X1 1
366 } else {
367 set X1 0
369 if {$X1} {set WD [expr $LDCONT]}
371 puts $FileID "XMESH X.MAX=$LMAX H1=$WD RATIO=$RATIO"
373 #-----------------------
374 # Y.MESH statements
375 #-----------------------
376 #COMMENT JUNC1 = deepest vertical junction location
377 # JUNC2 = shallowest vertical junction location
378 # (if it exists)
379 puts $FileID "#---------------------------------------------------"
380 set JUNC1 [expr $SDJUNC]
381 set JUNC2 [expr $SDJUNC]
382 if {$E} {set JUNC2 [expr $LDDJUNC]}
383 if {$E1} {set JUNC1 [expr $LDDJUNC]}
384 if {$E1} {set JUNC2 [expr $SDJUNC]}
386 #COMMENT F ==> D & ((JUNC2+2*JUNCSP) < JUNC1)
387 #+ F1 ==> D & ((JUNC2+2*JUNCSP) >= JUNC1)
389 if {$D} {
390 set TMP [expr int(($JUNC2+2*$JUNCSP)/$JUNC1)]
391 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
392 set F 0
393 set F1 1
394 } else {
395 set F 1
396 set F1 0
400 puts $FileID "YMESH Y.TOP=0.1+$TOX Y.BOTTOM=$TOX N.SPACES=1"
401 puts $FileID "YMESH Y.BOTTOM=0 N.SPACES=1"
403 if {$F} {puts $FileID "YMESH Y.BOTTOM=-$JUNC2 H1=$CHANSP H2=$JUNCSP #RATIO=$RATIO"}
404 if {$F} {puts $FileID "YMESH Y.BOTTOM=-$JUNC1 H1=$JUNCSP H2=$JUNCSP #RATIO=$RATIO"}
405 if {$F1} {puts $FileID "YMESH Y.BOTTOM=-$JUNC1 H1=$CHANSP H2=$JUNCSP #RATIO=$RATIO"}
406 if {$D1} {puts $FileID "YMESH Y.BOTTOM=-$JUNC1 H1=$CHANSP H2=$JUNCSP #RATIO=$RATIO"}
407 if {$LDF} {puts $FileID "YMESH Y.BOTTOM=-$JUNC1 H1=$CHANSP H2=$JUNCSP #RATIO=$RATIO"}
409 puts $FileID "YMESH Y.BOTTOM=-$SUBDEP H1=$JUNCSP RATIO=$RATIO"
410 puts $FileID "YMESH Y.BOTTOM=-$SUBDEP-0.1 N.SPACES=1"
412 #-----------------------
413 # ELIMINATE ROWS
414 #-----------------------
415 puts $FileID "#---------------------------------------------------"
417 set WD [expr (($RATIO+$EPS)*$JUNCSP-$CHANSP)/($RATIO+$EPS-1)]
418 set TMP [expr int(2*$WD/$JUNC2)]
419 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
420 set X1 1
421 } else {
422 set X1 0
426 if {$X1} {set WD [expr $JUNC2/2]}
428 puts $FileID "ELIMINATE Direction=ROWS Y.TOP=-$EPS Y.BOTTOM=-$WD X.MIN=0 X.MAX=$LSOURCE-$EPS"
429 puts $FileID "ELIMINATE Direction=ROWS Y.TOP=-$EPS Y.BOTTOM=-$WD X.MIN=[expr $LMAX-$LDRAIN+$EPS] X.MAX=$LMAX"
431 set Z1 [expr 1.5*$JUNCSP]
432 set Z2 [expr $JUNCSP*(2*($RATIO+$EPS)-1)/($RATIO+$EPS-1)]
434 set XMN [expr $LSSDIF+$Z2]
435 set XMX [expr $LMAX-$LDDDIF-$Z2]
436 set YMN [expr $SDJUNC-$Z1]
437 set YMX [expr $SDJUNC+$Z1]
439 if {$E1} {
440 set XMN [expr $LSLDIF+$Z2]
441 set XMX [expr $LMAX-$LDLDIF-$Z2]
442 set YMN [expr $LDDJUNC-$Z1]
443 set YMX [expr $LDDJUNC+$Z1]
446 #COMMENT Make sure we can really do this eliminate.
447 set TMP [expr int($XMN/$LMID)]
448 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
449 set X1 0
450 } else {
451 set X1 1
454 if {$X1} { puts $FileID "ELIMINATE Direction=ROWS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN Y.BOTTOM=-$YMX" }
456 #-----------------------
457 # ELIMINATE COLUMNS
458 #-----------------------
459 #COMMENT The program treats the B2 and C2 cases as if there were
460 # only one lateral junction, whether there is an LDD
461 # implant or not. Furthermore, the B2 case puts the
462 # finest lateral spacing at LSOURCE and LMAX-LDRAIN.
464 set DSSDIF [expr $LSSDIF]
465 set DDDDIF [expr $LDDDIF]
466 set DSLDIF [expr $LSLDIF]
467 set DDLDIF [expr $LDLDIF]
469 if {$B2} {
470 set DSSDIF [expr $LSOURCE]
471 set DDDDIF [expr $LDRAIN]
472 set DSLDIF [expr $DSSDIF]
473 set DDLDIF [expr $DDDDIF]
476 if {$C2} {
477 set DSLDIF [expr $DSSDIF]
478 set DDLDIF [expr $DDDDIF]
481 set Z3 [expr 2*$JUNCSP*(1+$RATIO)]
482 set Z4 [expr $Z2+$JUNCSP*(1+$RATIO+$RATIO*$RATIO)]
484 set H 1
485 set H1 0
486 if {$D} {
487 set TMP [expr int(($DSSDIF+$Z3)/($DSLDIF))]
488 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
489 set H 0
490 set H1 1
491 } else {
492 set H 1
493 set H1 0
497 if {$H} {
498 set XMN [expr $DSSDIF-$Z1]
499 set XMX [expr $DSSDIF+$Z1]
500 set YMN [expr $SDJUNC+$Z2]
501 if {$E1} {
502 set XMN [expr $DSLDIF-$Z1]
503 set XMX [expr $DSLDIF+$Z1]
504 set YMN [expr $LDDJUNC+$Z2]
506 puts $FileID "ELIMINATE Direction=COLUMNS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN"
508 set XMN [expr $LMAX-$DDDDIF-$Z1]
509 set XMX [expr $LMAX-$DDDDIF+$Z1]
510 if {$E1} {
511 set XMN [expr $LMAX-$DDLDIF-$Z1]
512 set XMX [expr $LMAX-$DDLDIF+$Z1]
514 puts $FileID "ELIMINATE Direction=COLUMNS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN"
516 if {$D} { set YMN [expr $LDDJUNC+$Z2]}
518 set X1 0
519 if {$E} {
520 set TMP [expr int(($DSLDIF)/($DSSDIF+$Z4))]
521 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
522 set X1 0
523 } else {
524 set X1 1
528 if {$X1} { set YMN [expr $SDJUNC+$JUNCSP*(1.5+$RATIO)] }
529 if {$E} {
530 set XMN [expr $DSLDIF-$Z1]
531 set XMX [expr $DSLDIF+$Z1]
533 if {$E1} {
534 set XMN [expr $DSSDIF-$Z1]
535 set XMX [expr $DSSDIF+$Z1]
537 if {$D} { puts $FileID "ELIMINATE Direction=COLUMNS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN"}
538 if {$E} {
539 set XMN [expr $LMAX-$DDLDIF-$Z1]
540 set XMX [expr $LMAX-$DDLDIF+$Z1]
542 if {$E1} {
543 set XMN [expr $LMAX-$DDDDIF-$Z1]
544 set XMX [expr $LMAX-$DDDDIF+$Z1]
546 if {$D} { puts $FileID "ELIMINATE Direction=COLUMNS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN "}
549 #-----------------------
550 if {$H1} {
551 set XMN [expr $DSSDIF-$Z1]
552 set XMX [expr $DSLDIF+$Z1]
554 if {$E} { set YMN [expr $SDJUNC+$Z2]}
555 if {$E1} { set YMN [expr $LDDJUNC+$Z2]}
557 puts $FileID "ELIMINATE Direction=COLUMNS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN"
559 set XMN [expr $LMAX-$DDLDIF-$Z1]
560 set XMX [expr $LMAX-$DDDDIF+$Z1]
561 puts $FileID "ELIMINATE Direction=COLUMNS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN"
564 #-----------------------
565 #COMMENT Second pass of eliminates.
567 if {$LDF} { set DSLDIF [expr $DSSDIF]}
568 if {$LDF} { set DDLDIF [expr $DDDDIF]}
569 if {$D1} { set DSLDIF [expr $DSSDIF]}
570 if {$D1} { set DDLDIF [expr $DDDDIF]}
572 set WD [expr ($DSLDIF-$DSSDIF)/2]
574 set SPC [expr $JUNCSP]
575 set TMP [expr int($WD/$JUNCSP)]
576 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
577 set X1 1
578 } else {
579 set X1 0
582 if {$X1} { set SPC [expr $WD-($WD-$JUNCSP)/$RATIO] }
584 set WD [expr (($RATIO+$EPS)*4*$SPC-$JUNCSP)/($RATIO+$EPS-1)]
585 set YMN [expr $JUNC1+$WD]
587 #COMMENT Only do the eliminate if YMN < SUBDEP.
588 set TMP [expr int($YMN/$SUBDEP)]
589 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
590 set X1 0
591 } else {
592 set X1 1
595 if {$X1} { set XMX [expr $DSLDIF+$WD] }
597 #COMMENT See if a single eliminate can be done or if we need to
598 #+ do separate eliminates for the left and right sides.
599 set X2 0
600 set X3 0
602 if {$X1} {
603 set TMP [expr int($XMX/$LMID)]
604 if { [expr int((2+$TMP)/(1+$TMP))%2] == 1} {
605 set X2 0
606 set X3 1
607 } else {
608 set X2 1
609 set X3 0
613 #COMMENT Separate eliminates for the left and right.
614 if {$X2} {
615 set XMN [expr $DSSDIF-$WD]
616 puts $FileID "ELIMINATE Direction=COLUMNS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN"
617 set XMN [expr $LMAX-$DDLDIF-$WD]
618 set XMX [expr $LMAX-$DDDDIF+$WD]
619 puts $FileID "ELIMINATE Direction=COLUMNS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN"
622 #COMMENT Single eliminate.
623 if {$X3} {
624 set XMN [expr $DSSDIF-$WD-$EPS]
625 set XMX [expr $LMAX-$DDDDIF+$WD+$EPS]
626 puts $FileID "ELIMINATE Direction=COLUMNS X.MIN=$XMN X.MAX=$XMX Y.TOP=-$YMN"
630 #-----------------------
631 # REGIONS
632 #-----------------------
633 puts $FileID "#---------------------------------------------------"
634 puts $FileID "REGION Label=Silicon Material=Si"
635 puts $FileID "REGION Label=Oxide Material=Ox IY.MAX=2"
637 #-----------------------
638 # ELECTRODES
639 #-----------------------
640 puts $FileID "REGION Label=Drain IY.MAX=2 X.MIN=$LMAX-$LDCONT Material=Elec"
641 puts $FileID "REGION Label=Gate IY.MAX=1 X.MIN=$LSOURCE X.MAX=$LMAX-$LDRAIN Material=Elec"
642 puts $FileID "REGION Label=Source IY.MAX=2 X.MAX=$LSCONT Material=Elec"
643 puts $FileID "REGION Label=Substrate Y.MAX=-$SUBDEP+0.0001 Material=Elec"
645 #-----------------------
646 # PROFILES
647 #-----------------------
648 if {$VTTYPE == "P"} {
649 set VTTYP "Acceptor"
650 } else {
651 set VTTYP "Donor"
654 if {$NMOS} {
655 set SDTYP "Donor"
656 set SUBTYP "Acceptor"
658 if {$PMOS} {
659 set SDTYP "Acceptor"
660 set SUBTYP "Donor"
663 #-----------------------
664 # ANALYTIC PROFILES
665 #-----------------------
666 puts $FileID "#---------------------------------------------------"
667 puts $FileID "PROFILE Type=Uniform Ion=$SUBTYP N.PEAK=$NSUB X.MIN=0.0 X.MAX=$LMAX Y.TOP=0.0 Y.BOTTOM=-$SUBDEP"
669 if {$VTPEAK > 1.0} {
670 puts $FileID "PROFILE Type=Gauss Ion=$VTTYP N.PEAK=$VTPEAK Y.CHAR=$VTCHAR X.MIN=0.0 X.MAX=$LMAX"
673 if {$LDT} {
674 puts $FileID "PROFILE Type=Gauss Ion=$SDTYP N.PEAK=$LDDPEAK Y.CHAR=$LDYC X.CHAR=[expr $LATD*$LDYC] \
675 X.MIN=0.0 X.MAX=$LSOURCE"
676 puts $FileID "PROFILE Type=Gauss Ion=$SDTYP N.PEAK=$LDDPEAK Y.CHAR=$LDYC X.CHAR=[expr $LATD*$LDYC] \
677 X.MIN=[expr $LMAX-$LDRAIN] X.MAX=[expr $LMAX-$LDRAIN+$LDRAIN]"
680 puts $FileID "PROFILE Type=Gauss Ion=$SDTYP N.PEAK=$SDPEAK Y.CHAR=$SDYC X.CHAR=[expr $LATD*$SDYC] \
681 X.MIN=0.0 X.MAX=[expr $LSOURCE-$LSPACER]"
682 puts $FileID "PROFILE Type=Gauss Ion=$SDTYP N.PEAK=$SDPEAK Y.CHAR=$SDYC X.CHAR=[expr $LATD*$SDYC] \
683 X.MIN=[expr $LMAX-$LDRAIN+$LSPACER] X.MAX=[expr $LMAX-$LDRAIN+$LSPACER+$LDRAIN-$LSPACER]"
686 #-----------------------
687 # Boundary Conditions
688 #-----------------------
689 # WF = Work Function (V)
690 if {$GATE == "PPoly"} {
691 set WF 5.25
692 } elseif {$GATE == "NPoly"} {
693 set WF 4.17
694 } elseif {$GATE == "Al"} {
695 set WF 4.15
698 puts $FileID "#---------------------------------------------------"
699 puts $FileID "BOUNDARY Type = InsulatorInterface ID = IF_Oxide_to_Silicon QF=0"
700 puts $FileID "CONTACT Type = GateContact ID = Gate WorkFunction=$WF"
701 puts $FileID "CONTACT Type = OhmicContact ID = Substrate"
702 puts $FileID "CONTACT Type = OhmicContact ID = Source"
703 puts $FileID "CONTACT Type = OhmicContact ID = Drain"
705 #-----------------------
706 # PLOTS
707 #-----------------------
708 puts $FileID "#---------------------------------------------------"
709 puts $FileID "PLOT Variable=DeviceMesh"
711 #-----------------------
712 # Solve Equilibrium State
713 #-----------------------
714 puts $FileID "METHOD Type = DDML1 Scheme = Newton NS=Basic LS=GMRES"
715 puts $FileID "SOLVE Type = TRANSIENT TStart = 0 TStep=1e-11 TStop = 3e-10"
716 puts $FileID "SOLVE Type = EQUILIBRIUM"
717 puts $FileID "EXPORT CoreFile = $TRANTYPE.init.cgns"
718 puts $FileID "PLOT Variable=Na Resolution=RES.High AzAngle=120 ElAngle=60"
719 puts $FileID "PLOT Variable=Nd Resolution=RES.High AzAngle=120 ElAngle=60"
720 puts $FileID "PLOT Variable=Potential Resolution=RES.High AzAngle=240 ElAngle=20"
721 puts $FileID "PLOT Variable=ElecDensity Resolution=RES.High AzAngle=240 ElAngle=20"
722 puts $FileID "PLOT Variable=HoleDensity Resolution=RES.High AzAngle=240 ElAngle=20"
723 puts $FileID "END"
725 close $FileID