-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathmosfet.typ
74 lines (61 loc) · 2.42 KB
/
mosfet.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#import "@preview/cetz:0.3.1": canvas, draw
#import draw: line, rect, content, set-style
#set page(width: auto, height: auto, margin: 8pt)
#canvas({
// Circuit board (base)
rect((0, 0), (11, -0.25), fill: rgb("#008080"), name: "board")
content("board.south", [circuit board], anchor: "north", padding: (top: 3pt))
// Dielectric layer with brick pattern
let brick-width = 0.4
let brick-height = 0.2
let start-x = 3.8
let end-x = 7.2
let start-y = 2
let end-y = 3
// Draw brick pattern background
rect((start-x, start-y), (end-x, end-y), fill: white, stroke: rgb("#f00"), name: "dielectric-box")
// Draw horizontal brick lines
for y in range(int((end-y - start-y) / brick-height + 1)) {
let y-pos = start-y + y * brick-height
if y-pos < end-y {
line((start-x, y-pos), (end-x, y-pos), stroke: rgb("#f00"))
}
}
// Draw vertical brick lines with offset for alternating rows
for x in range(int((end-x - start-x) / brick-width + 1)) {
for y in range(int((end-y - start-y) / brick-height)) {
let x-offset = if calc.rem(y, 2) == 0 { 0 } else { brick-width / 2 }
let x-pos = start-x + x * brick-width + x-offset
if x-pos < end-x {
let y-start = start-y + y * brick-height
let y-end = calc.min(y-start + brick-height, end-y)
line((x-pos, y-start), (x-pos, y-end), stroke: rgb("#f00"))
}
}
}
// P-type semiconductor substrate
rect((0, 0), (11, 2), fill: rgb("#ffa500").lighten(50%), name: "substrate")
content("substrate", [#set align(center); $p$-type\ semiconductor])
// N-type semiconductor regions
rect((1, 1), (4, 2), fill: rgb("#90ee90"), name: "source-n")
content("source-n", [#set align(center); $n$-type\ semiconductor])
rect((7, 1), (10, 2), fill: rgb("#90ee90"), name: "drain-n")
content("drain-n", [#set align(center); $n$-type\ semiconductor])
content(
"dielectric-box",
[dielectric],
frame: "rect",
padding: 2pt,
fill: white,
stroke: (thickness: .5pt, paint: black),
)
// Metal contacts
rect((4, 3), (7, 3.5), fill: rgb("#e6e6ff"), name: "gate-metal")
content("gate-metal", [gate])
rect((1.25, 2), (3, 2.5), fill: rgb("#e6e6ff"), name: "source-metal")
content("source-metal", [source])
rect((8, 2), (9.75, 2.5), fill: rgb("#e6e6ff"), name: "drain-metal")
content("drain-metal", [drain])
// Title
content("gate-metal.north", [$n$-type MOSFET], anchor: "south", padding: (bottom: 2mm))
})