Skip to content

Commit

Permalink
EBeam Tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
kithminrw committed Nov 25, 2023
1 parent b9769d4 commit 3f35f6e
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 16 deletions.
37 changes: 21 additions & 16 deletions klayout/EBeam/pymacros/pcells_EBeam_Beta/DoubleBus_Ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self):
self.param("r", self.TypeDouble, "Radius", default = 10)
self.param("w", self.TypeDouble, "Waveguide Width", default = 0.5)
self.param("g", self.TypeDouble, "Gap", default = 0.2)
self.param("d", self.TypeBoolean, "Drop", default = False)
self.param("textpolygon", self.TypeInt, "Draw text polygon label? 0/1", default = 1)
self.param("textl", self.TypeLayer, "Text Layer", default = LayerInfo(10, 0))
self.param("pinrec", self.TypeLayer, "PinRec Layer", default = TECHNOLOGY['PinRec'])
Expand Down Expand Up @@ -87,6 +88,7 @@ def produce_impl(self):
w = int(round(self.w/dbu))
r = int(round(self.r/dbu))
g = int(round(self.g/dbu))
d = self.d

# pcell = ly.create_cell("DirectionalCoupler_HalfRing_Straight", "SiEPIC", { "r": self.r, "w": self.w, "g": self.g, "silayer": LayerSi, "bustype": 0 } )
# print ("Cell: pcell: #%s" % pcell.cell_index())
Expand All @@ -99,9 +101,11 @@ def produce_impl(self):
# Create the two waveguides
wg1 = Box(0, -w/2, w+2*r, w/2)
shapes(LayerSiN).insert(wg1)
y_offset = 2*r + 2*g + 2*w
wg2 = Box(0, y_offset-w/2, w+2*r, y_offset+w/2)
shapes(LayerSiN).insert(wg2)
y_offset = 0
if d==True:
y_offset = 2*r + 2*g + 2*w
wg2 = Box(0, y_offset-w/2, w+2*r, y_offset+w/2)
shapes(LayerSiN).insert(wg2)

from SiEPIC._globals import PIN_LENGTH as pin_length
# Create the pins, as short paths:
Expand All @@ -120,19 +124,20 @@ def produce_impl(self):
shape = shapes(LayerPinRecN).insert(text)
shape.text_size = 0.4/dbu

pin = Path([Point(pin_length/2, y_offset), Point(-pin_length/2, y_offset)], w)
shapes(LayerPinRecN).insert(pin)
t = Trans(Trans.R0, 0, y_offset)
text = Text ("pin3", t)
shape = shapes(LayerPinRecN).insert(text)
shape.text_size = 0.4/dbu

pin = Path([Point(w+2*r-pin_length/2, y_offset), Point(w+2*r+pin_length/2, y_offset)], w)
shapes(LayerPinRecN).insert(pin)
t = Trans(Trans.R0, w+2*r, y_offset)
text = Text ("pin4", t)
shape = shapes(LayerPinRecN).insert(text)
shape.text_size = 0.4/dbu
if d==True:
pin = Path([Point(pin_length/2, y_offset), Point(-pin_length/2, y_offset)], w)
shapes(LayerPinRecN).insert(pin)
t = Trans(Trans.R0, 0, y_offset)
text = Text ("pin3", t)
shape = shapes(LayerPinRecN).insert(text)
shape.text_size = 0.4/dbu

pin = Path([Point(w+2*r-pin_length/2, y_offset), Point(w+2*r+pin_length/2, y_offset)], w)
shapes(LayerPinRecN).insert(pin)
t = Trans(Trans.R0, w+2*r, y_offset)
text = Text ("pin4", t)
shape = shapes(LayerPinRecN).insert(text)
shape.text_size = 0.4/dbu


# Create the device recognition layer
Expand Down
160 changes: 160 additions & 0 deletions klayout/EBeam/pymacros/pcells_EBeam_Beta/Ring.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
import pya
import math
from . import *
from pya import *
from SiEPIC.utils import get_technology_by_name

class Ring(pya.PCellDeclarationHelper):
def __init__(self):

super(Ring, self).__init__()
TECHNOLOGY = get_technology_by_name('EBeam')

# declare the parameters
self.param("silayer", self.TypeLayer, "Layer", default = TECHNOLOGY['Si'])
self.param("r", self.TypeDouble, "Radius", default = 10)
self.param("w", self.TypeDouble,"Width",default = 0.5)
self.param("g", self.TypeDouble,"Gap",default = 0.2)
self.param("b", self.TypeDouble,"Bus Length",default = 50)
self.param("d", self.TypeBoolean, "Drop", default = False)
self.param("n", self.TypeInt, "Number of points", default = 2048)
self.param("p",self.TypeLayer,"Pin Layer",default = pya.LayerInfo(1,10))
self.param("oxideopen", self.TypeLayer, "Oxide Open Layer", default = TECHNOLOGY['Oxide open (to BOX)'])
self.param("devrec", self.TypeLayer, "Dev Rec Layer", default = TECHNOLOGY['DevRec'])

def display_text_impl(self):
return "Ring(R=" + ('%.3f' % self.r) + ",g=" + ('%g' % (1000*self.g)) + ")"

def coerce_parameters_impl(self):
pass

def can_create_from_shape(self, layout, shape, layer):
return False

def produce_impl(self):

# compute the arc
# fetch the parameters
from SiEPIC._globals import PIN_LENGTH
from SiEPIC.extend import to_itype
import math
from pya import DPolygon

pi = math.pi
# This is the main part of the implementation: create the layout

dbu = self.layout.dbu
ly = self.layout
shapes = self.cell.shapes
LayerCladN = ly.layer(self.clad)
pts_o = []
pts_i = []
da = 2*pi / (self.n)
r = self.r/dbu
r2 = self.r
w = self.w/dbu
g = self.g/dbu
b = self.b/dbu

#create the circle
for i in range(0,self.n+1):
bend_ox = (r+w/2)*math.cos(i*da)
bend_oy = (r+w/2)*math.sin(i*da)
bend_ix = (r-w/2)*math.cos(i*da)
bend_iy = (r-w/2)*math.sin(i*da)
pts_o.append(pya.Point.from_dpoint(pya.DPoint(bend_ox,bend_oy)))
pts_i.append(pya.Point.from_dpoint(pya.DPoint(bend_ix,bend_iy)))

pts_o.append(pya.Point.from_dpoint(pya.DPoint(0,r+w/2)))
pts_i.append(pya.Point.from_dpoint(pya.DPoint(0,r-w/2)))
pts_o.append(pya.Point.from_dpoint(pya.DPoint(0,0)))
pts_i.append(pya.Point.from_dpoint(pya.DPoint(0,0)))
ring1=pya.Region()
ring1.insert(pya.Polygon(pts_o))
ring2=pya.Region()
ring2.insert(pya.Polygon(pts_i))
ring = ring1-ring2
self.cell.shapes(self.l_layer).insert(ring)

# draw oxide open
self.cell.shapes(ly.layer(self.oxideopen)).insert(pya.Box(DPoint(-to_itype(r2+5,dbu),-to_itype(r2+5,dbu)),DPoint(to_itype(r2+5,dbu),to_itype(r2+5,dbu))))

#DEV BOX
self.cell.shapes(ly.layer(self.devrec)).insert(Box(DPoint(-to_itype(r2+5,dbu),-to_itype(r2+5,dbu)),DPoint(to_itype(r2+5,dbu),to_itype(r2+5,dbu))))

#insert bus waveguide
box1 = pya.Region()
xa = -b/2
xb = b/2
ya = -r-w/2-g-w
yb = -r-w/2-g
box1.insert(pya.Box(xa,ya,xb,yb))
self.cell.shapes(self.l_layer).insert(box1)

#add the left bus pin
xp1 = -0.05/self.layout.dbu
xp2 = 0.05/self.layout.dbu
yp1 = ya+2/dbu+w/2
p1 = [Point(xa+xp2,yp1),Point(xa+xp1,yp1)]
p1c = Point(xa,yp1)
self.set_p1=p1c
self.p1=p1c
pin=Path(p1,w)
t = Trans(Trans.R0,xa,yp1)
self.cell.shapes(self.p_layer).insert(pin)
text=Text("pin1",t)
self.cell.shapes(self.p_layer).insert(text)

#add the right bus pin
p2 = [Point(xb+xp1,yp1),Point(xb+xp2,yp1)]
p2c = Point(xb,yp1)
self.set_p2=p2c
self.p2=p2c
pin=Path(p2,w)
t = Trans(Trans.R180,xb,yp1)
self.cell.shapes(self.p_layer).insert(pin)
text=Text("pin2",t)
self.cell.shapes(self.p_layer).insert(text)

#insert drop port
if self.d == True:
box2 = pya.Region()
xa = -b/2
xb = b/2
ya = r+w/2+g
yb = r+w/2+g+w
box2.insert(pya.Box(xa,ya,xb,yb))
self.cell.shapes(self.l_layer).insert(box2)

box2n = pya.Region()
xa = -b/2
xb = b/2
ya = r+w/2+g-2/dbu
yb = r+w/2+g+w+2/dbu
box2n.insert(pya.Box(xa,ya,xb,yb))
self.cell.shapes(LayerCladN).insert(box2n)

#add the left drop pin
xp1 = -0.05/self.layout.dbu
xp2 = 0.05/self.layout.dbu
yp1 = ya+w/2+2/dbu
p1 = [Point(xa+xp2,yp1),Point(xa+xp1,yp1)]
p1c = Point(xa,yp1)
self.set_p1=p1c
self.p1=p1c
pin=Path(p1,w)
t = Trans(Trans.R0,xa,yp1)
self.cell.shapes(self.p_layer).insert(pin)
text=Text("pin3",t)
self.cell.shapes(self.p_layer).insert(text)

#add the right drop pin
p2 = [Point(xb+xp1,yp1),Point(xb+xp2,yp1)]
p2c = Point(xb,yp1)
self.set_p2=p2c
self.p2=p2c
pin=Path(p2,w)
t = Trans(Trans.R180,xb,yp1)
self.cell.shapes(self.p_layer).insert(pin)
text=Text("pin4",t)
self.cell.shapes(self.p_layer).insert(text)

0 comments on commit 3f35f6e

Please sign in to comment.