generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathClawCapacitors.jl
More file actions
294 lines (256 loc) · 10.7 KB
/
ClawCapacitors.jl
File metadata and controls
294 lines (256 loc) · 10.7 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
"""
module ClawCapacitors
An `ExamplePDK` component module containing claw capacitors for coupling coplanar
waveguides in shunt and series configurations.
`ExamplePDK` is intended for demonstrations, tutorials, and tests. While we aim to
demonstrate best practices for Julia code and DeviceLayout.jl usage, these components are not
optimized for device performance. Most importantly: **Breaking changes to `ExamplePDK` may
occur within major versions.** In other words, don't depend on `ExamplePDK` in your own PDK
or for real devices!
"""
module ClawCapacitors
using DeviceLayout, DeviceLayout.SchematicDrivenLayout, DeviceLayout.PreferredUnits
using .SchematicDrivenLayout.ExamplePDK, .ExamplePDK.LayerVocabulary
import .ExamplePDK: tap!
export ExampleSeriesClawCapacitor, ExampleShuntClawCapacitor
"""
ExampleSeriesClawCapacitor <: Component
Series capacitor between two coplanar lines. The input forms a claw around a pad at the output.
Contains hooks `p0` at the input and `p1` at the output, as well as left-handed versions `p0_lh`
and `p1_lh`. (When left-handed hooks are fused to right-handed hooks, an extra reflection is applied
when aligning the hooks—see [`HandedPointHook`](@ref).)
This component is intended for use in demonstrations.
claw_inner_gap
←——→ ←——→
███████████████████
██ ██
██ ███████████ ██ ↑ claw_inner_gap
██ ███████████ ██ ↓
←input_length→██ ████ ↑ ████ ██
████████████████ ████ | ████████
input_style ████ inner_cap_length ↕ output_style.trace
████████████████ ████ | ████████ ↕ output_style.gap
██ ████ ↓ ████ ██
██ ███████████ ██
██←→███████████ ██
██claw_width↕ ██
↕███████████████████
claw_outer_gap←→ ←—→ inner_cap_width
# Parameters
- `name = "claw"`: Name of component
- `input_length = 2μm`: Length of input segment
- `input_style = Paths.CPW(10μm, 6μm)`: Style of input path
- `inner_cap_width = 20μm`: Width (short dimension, usually) of inner capacitor pad
- `inner_cap_length = 200μm`: Length (long dimension) of inner capacitor pad
- `claw_inner_gap = 5μm`: Gap between claw and inner pad
- `claw_width = 10μm`: Width of claw metal trace
- `claw_outer_gap = 20μm`: Outer gap around claw
- `output_style = Paths.CPW(10μm, 6μm)`: Style of output path
- `rounding = 2μm`: Rounding radius applied to the capacitor
# Hooks
- `p0`: Input
- `p1`: Output
- `p0_lh`: Input (left-handed)
- `p1_lh`: Output (left-handed)
"""
@compdef struct ExampleSeriesClawCapacitor <: Component
name = "claw"
input_length = 2μm
input_style = Paths.CPW(10μm, 6μm)
inner_cap_width = 20μm
inner_cap_length = 200μm
claw_inner_gap = 5μm
claw_width = 10μm
claw_outer_gap = 20μm
output_style = Paths.CPW(10μm, 6μm)
rounding = 2μm
end
function SchematicDrivenLayout._geometry!(
cs::CoordinateSystem,
cc::ExampleSeriesClawCapacitor
)
path = _path(cc)
place!(cs, path)
claw_cutout = RotationPi(1 // 2)(_series_claw(cc))
ms = MeshSized(critical_dimension(cc))
place!(cs, ms(Align.rightof(claw_cutout, path, centered=true)), METAL_NEGATIVE)
return cs
end
function _path(cc::ExampleSeriesClawCapacitor)
(;
input_length,
input_style,
rounding,
claw_outer_gap,
claw_width,
claw_inner_gap,
inner_cap_width
) = cc
pa = Path(metadata=METAL_NEGATIVE, name=uniquename("$(cc.name)_in"))
if (input_length - rounding) > zero(input_length)
straight!(pa, input_length - rounding, input_style)
end
straight!(
pa,
2 * (claw_outer_gap + claw_width + claw_inner_gap + rounding) + inner_cap_width,
Paths.NoRender()
)
return pa
end
function SchematicDrivenLayout.hooks(cc::ExampleSeriesClawCapacitor)
path = _path(cc)
return hooks(path)
end
function _series_claw(cc)
(;
input_style,
inner_cap_width,
inner_cap_length,
claw_inner_gap,
claw_width,
claw_outer_gap,
output_style,
rounding
) = cc
## Claw
# Output positive metal
inner_pad = centered(Rectangle(inner_cap_length, inner_cap_width))
output_trace = Rectangle(
output_style.trace,
claw_inner_gap + claw_width + claw_outer_gap + rounding
)
output_trace = Align.below(output_trace, inner_pad; centered=true)
# Claw negatives
# Use `halo` to get larger rectangle around original
# Halo returns a vector, but we know it's length 1
inner_hole = only(halo(inner_pad, claw_inner_gap))
output_trace_hole = Rectangle(output_style.trace + 2 * claw_inner_gap, claw_width)
output_trace_hole = Align.below(output_trace_hole, inner_hole; centered=true)
# Claw positive
claw_rect = only(halo(inner_hole, claw_width))
claw_poly = only(to_polygons(difference2d(claw_rect, [inner_hole, output_trace_hole])))
input_trace = Rectangle(input_style.trace, claw_outer_gap + rounding)
input_trace = Align.above(input_trace, claw_poly; centered=true)
# Outer cutout (negatives)
cutout_rect = only(halo(claw_rect, claw_outer_gap))
input_cutout_tail = Align.above(
Rectangle(2 * Paths.extent(input_style), rounding),
cutout_rect;
centered=true
)
output_cutout_tail = Align.below(
Rectangle(2 * Paths.extent(output_style), rounding),
cutout_rect;
centered=true
)
# Generate entire polygon
outer_negatives = [cutout_rect, input_cutout_tail, output_cutout_tail]
positives = [inner_pad, output_trace, claw_poly, input_trace]
cutout_poly = only(to_polygons(union2d(difference2d(outer_negatives, positives))))
# Round except for interface points
interface_points = findall(
pt ->
gety(pt) == lowerleft(cutout_poly).y ||
gety(pt) == upperright(cutout_poly).y,
points(cutout_poly)
)
rounded =
Rounded(rounding; p0=points(cutout_poly)[interface_points], inverse_selection=true)
return rounded(cutout_poly)
end
function critical_dimension(cc)
return min(
cc.input_style.trace,
cc.input_style.gap,
cc.inner_cap_width,
cc.inner_cap_length,
cc.claw_inner_gap,
cc.claw_width,
cc.claw_outer_gap,
cc.output_style.trace,
cc.output_style.gap
)
end
"""
ExampleShuntClawCapacitor <: Component
Similar to [ExampleSeriesClawCapacitor](@ref), but the capacitor is teed off a feedline.
Contains hooks `p0` at the feedline input and `p1` at the feedline output, as well as
`p2` at the capacitively coupled output, as well as left-handed versions. (When left-handed hooks
are fused to right-handed hooks, an extra reflection is applied when aligning the hooks—see
[`HandedPointHook`](@ref).)
This component is intended for use in demonstrations.
# Parameters
- `name = "claw"`: Name of component
- `feedline_length = 300μm`: Total length of feedline
- `feedline_style = Paths.CPW(10μm, 6μm)`: Style of feedline path
- `input_length = 20μm`: Length of "input" path between edge of feedline and claw
- `input_style = Paths.CPW(10μm, 6μm)`: Style of "input" path
- `inner_cap_width = 20μm`: Width (short dimension, usually) of inner capacitor pad
- `inner_cap_length = 200μm`: Length (long dimension) of inner capacitor pad
- `claw_inner_gap = 5μm`: Gap between claw and inner pad
- `claw_width = 10μm`: Width of claw metal trace
- `claw_outer_gap = 20μm`: Outer gap around claw
- `output_style = Paths.CPW(10μm, 6μm)`: Style of output path
- `rounding = 2μm`: Rounding radius applied to the capacitor
- `bridge = nothing`: `CoordinateSystem` holding the air bridge geometry for the feedline and
input
# Hooks
- `p0`: Feedline input
- `p1`: Feedline output
- `p2`: Capacitively coupled output
- `p0_lh`: Feedline input (left-handed)
- `p1_lh`: Feedline output (left-handed)
- `p2_lh`: Capacitively coupled output (left-handed)
"""
@compdef struct ExampleShuntClawCapacitor <: Component
name = "claw"
feedline_length = 300μm
feedline_style = Paths.CPW(10μm, 6μm)
input_length = 20μm
input_style = Paths.CPW(10μm, 6μm)
inner_cap_width = 20μm
inner_cap_length = 200μm
claw_inner_gap = 5μm
claw_width = 10μm
claw_outer_gap = 20μm
output_style = Paths.CPW(10μm, 10μm)
rounding = 2μm
bridge = nothing
end
function SchematicDrivenLayout._geometry!(
cs::CoordinateSystem,
cc::ExampleShuntClawCapacitor
)
pa, tap = _paths(cc)
place!(cs, pa)
place!(cs, tap)
claw_cutout = _series_claw(cc)
# Align claw below tap before attaching bridge, which may extend below tap
claw_cutout = Align.below(claw_cutout, tap; centered=true)
!isnothing(cc.bridge) && attach!(tap, sref(cc.bridge), pathlength(tap[end]) / 2)
ms = MeshSized(critical_dimension(cc))
place!(cs, ms(claw_cutout), METAL_NEGATIVE)
return cs
end
# Helper function to generate paths, used in both `_geometry!` and `hooks`
function _paths(cc::ExampleShuntClawCapacitor)
(; feedline_style, feedline_length, input_style, input_length, rounding, bridge) = cc
pa = Path(metadata=METAL_NEGATIVE, name=uniquename("$(cc.name)feed"))
straight!(pa, feedline_length / 2 - Paths.extent(input_style), feedline_style)
!isnothing(bridge) && attach!(pa, sref(bridge), zero(feedline_length))
tap = tap!(pa, input_style)
straight!(pa, feedline_length - pathlength(pa))
!isnothing(bridge) && attach!(pa, sref(bridge), pathlength(pa[end]))
straight!(tap, input_length - rounding) # Extend tap, leave room for rounding later
return pa, tap
end
function SchematicDrivenLayout.hooks(cc::ExampleShuntClawCapacitor)
(; inner_cap_width, claw_inner_gap, claw_width, claw_outer_gap, rounding) = cc
pa, tap = _paths(cc) # Generate another copy of the paths so we can use their hooks
straight!(
tap, # Extend tap to get to the connection point on the other side
inner_cap_width + 2 * (rounding + claw_outer_gap + claw_width + claw_inner_gap)
)
return merge(hooks(pa), (; p2=p1_hook(tap), p2_lh=p1_hook(tap, false)))
end
end # module