-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdk_template_photodiode.py
113 lines (93 loc) · 3.81 KB
/
pdk_template_photodiode.py
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
#-----------------------------------------------------------------------
# This file is part of Nazca.
#
# Nazca is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# Nazca is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Nazca. If not, see <http://www.gnu.org/licenses/>.
#-----------------------------------------------------------------------
#==============================================================================
# (c) 2016-2017 Ronald Broeke, Katarzyna Lawniczuk
#==============================================================================
"""Module defining black box templates for PDK implementation."""
from math import atan, tan, sin, cos, degrees, radians
import nazca as nd
import nazca.bb_util as bbu
def Tp_PhotoDetector(
length=100, width=50, buf=20,
name='BBname', groupname='',
pinwidth=None, xs=None,
icon=None):
"""Template for a photodetector with option to draw a metal DC pad.
Returns:
function that generates a Cell object
"""
@bbu.hashme(name, 'length')
def cell(length=length):
"""Create a PhotoDetector cell.
Args:
length (float): length of the diode in um
pad (bool): flag to add a bond pad
Returns:
Cell: photo diode element
"""
with nd.Cell(hashme=True) as C:
C.groupname = groupname
C.default_pins('a0', 'a0')
C.foundry_spt = []
bb_length = length+buf
p1 = nd.Pin(name='a0', xs=xs['a0'], width=pinwidth['a0'], remark='optical').put(0, 0, 180)
p2 = nd.Pin(name='c0', xs=xs['c0'], width=pinwidth['c0'], remark='electrical').put(bb_length)
#nd.connect_path(p1, p2=None, sigtyp=None, path=0)
nd.connect_path(p1, p2, s=0, sigtype='o2e', path=0)
bbu.put_stub(['a0', 'c0'])
bbu.put_boundingbox('org', bb_length, width)
if icon:
icon(bb_length, width).put(0)
return C
return cell
def Tp_PhotoDetectorRF(
length=100, width=50,
name='BBname', groupname='',
pinwidth=None, xs=None,
spaceGS=10,
icon=None):
"""Template for a photodetector with an option to draw a metal RF GSG pad.
Returns:
function that generates a Cell object
"""
@bbu.hashme(name)
def cell(length=length):
"""Create a photodetector RF cell.
Returns:
Cell
"""
cshift = 0
with nd.Cell(hashme=True) as C:
C.default_pins('a0', 'a0')
C.groupname = groupname
C.foundry_spt = []
p1 = nd.Pin(name='a0', xs=xs['a0'], width=pinwidth['a0'], remark='optical').\
put(0, 0, 180)
nd.Pin(name='c0', xs=xs['c0'], width=pinwidth['c0'], remark='gnd').\
put(length, cshift-spaceGS-pinwidth['c0'])
nd.Pin(name='c1', xs=xs['c1'], width=pinwidth['c1'], remark='signal').\
put(length, cshift)
nd.Pin(name='c2', xs=xs['c2'], width=pinwidth['c2'], remark='gnd').\
put(length, cshift+spaceGS+pinwidth['c2'])
nd.connect_path(p1, None, 0)
bbu.put_stub(['a0'])
bbu.put_boundingbox('org', length, width)
if icon:
icon(length, width).put(0)
bbu.put_stub(['c0', 'c1', 'c2'])
return C
return cell