Skip to content

Commit

Permalink
DevRec on Ring Resonator
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasc-ubc committed Nov 14, 2015
1 parent e0720b3 commit db046da
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 28 deletions.
81 changes: 57 additions & 24 deletions klayout_dot_config/pymacros/SiEPIC_EBeam_PCells.lym
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,16 @@ class DoubleBus_Ring(pya.PCellDeclarationHelper):
super(DoubleBus_Ring, self).__init__()

# declare the parameters
self.param("l", self.TypeLayer, "Layer", default = pya.LayerInfo(1, 0))
self.param("layer", self.TypeLayer, "Si Layer", default = pya.LayerInfo(1, 0))
self.param("s", self.TypeShape, "", default = pya.DPoint(0, 0))
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("npoints", self.TypeInt, "Number of points", default = 500)
self.param("textpolygon", self.TypeInt, "Draw text polygon label? 0/1", default = 1)
self.param("textl", self.TypeLayer, "Text Layer", default = pya.LayerInfo(10, 0))
self.param("pinrec", self.TypeLayer, "PinRec Layer", default = pya.LayerInfo(69, 0))
self.param("devrec", self.TypeLayer, "DevRec Layer", default = pya.LayerInfo(68, 0))

def display_text_impl(self):
# Provide a descriptive text for the cell
Expand All @@ -231,18 +233,44 @@ class DoubleBus_Ring(pya.PCellDeclarationHelper):

# fetch the parameters
dbu = self.layout.dbu
ly = self.layout

SiLayer = self.layer
SiLayerN = ly.layer(self.layer)
TextLayerN = ly.layer(self.textl)
LayerPinRecN = ly.layer(self.pinrec)
LayerDevRecN = ly.layer(self.devrec)


# Create the ring resonator:
layout_Ring(self.cell, self.l_layer, self.r+self.w/2, self.r+self.g+self.w, self.r, self.w, self.npoints)
layout_Ring(self.cell, SiLayerN, self.r+self.w/2, self.r+self.g+self.w, self.r, self.w, self.npoints)

# w = int(round(self.w/dbu))
# r = int(round(self.r/dbu))

# Create the two waveguides
wg1 = pya.Box(0, -self.w/2/dbu, (self.w+2*self.r)/dbu, self.w/2/dbu)
self.cell.shapes(self.layer).insert(wg1)

self.cell.shapes(SiLayerN).insert(wg1)
y_offset = 2*self.r + 2*self.g + 2*self.w
wg2 = pya.Box(0, (y_offset-self.w/2)/dbu, (self.w+2*self.r)/dbu, (y_offset+self.w/2)/dbu)
self.cell.shapes(self.layer).insert(wg2)
wg2 = pya.Box(0, round((y_offset-self.w/2)/dbu), round((self.w+2*self.r)/dbu), round((y_offset+self.w/2)/dbu))
self.cell.shapes(SiLayerN).insert(wg2)

# Create the pins, as short paths:
pin_length = 0.2
pin = pya.Path([pya.Point(0, 0), pya.Point(pin_length/dbu, 0)], self.w/dbu)
self.cell.shapes(LayerPinRecN).insert(pin)
pin = pya.Path([pya.Point((self.w+2*self.r-pin_length)/dbu, 0), pya.Point((self.w+2*self.r)/dbu, 0)],self.w/dbu )
self.cell.shapes(LayerPinRecN).insert(pin)
pin = pya.Path([pya.Point(0, (y_offset)/dbu), pya.Point(pin_length/dbu, (y_offset)/dbu)], self.w/dbu)
self.cell.shapes(LayerPinRecN).insert(pin)
pin = pya.Path([pya.Point((self.w+2*self.r-pin_length)/dbu, (y_offset)/dbu), pya.Point((self.w+2*self.r)/dbu, (y_offset)/dbu)], self.w/dbu)
self.cell.shapes(LayerPinRecN).insert(pin)



# Create the device recognition layer
dev = pya.Box(0, -self.w*3/dbu, (self.w+2*self.r)/dbu, (y_offset+self.w*3)/dbu )
self.cell.shapes(LayerDevRecN).insert(dev)


# Add a polygon text description
Expand Down Expand Up @@ -272,6 +300,8 @@ class TestStruct_DoubleBus_Ring(pya.PCellDeclarationHelper):
self.param("npoints", self.TypeInt, "Number of points", default = 500)
self.param("textpolygon", self.TypeInt, "Draw text polygon label? 0/1", default = 1)
self.param("textlayer", self.TypeLayer, "Text Layer", default = pya.LayerInfo(10, 0))
self.param("pinrec", self.TypeLayer, "PinRec Layer", default = pya.LayerInfo(69, 0))
self.param("devrec", self.TypeLayer, "DevRec Layer", default = pya.LayerInfo(68, 0))

def display_text_impl(self):
# Provide a descriptive text for the cell
Expand All @@ -287,9 +317,7 @@ class TestStruct_DoubleBus_Ring(pya.PCellDeclarationHelper):
cell = self.cell

SiLayer = self.layer
# print SiLayer

SiLayerN = ly.layer(self.layer)
SiLayerN = ly.layer(SiLayer)
TextLayerN = ly.layer(self.textlayer)

# Import cells from the SiEPIC GDS Library, and instantiate them
Expand All @@ -309,6 +337,8 @@ class TestStruct_DoubleBus_Ring(pya.PCellDeclarationHelper):
# print instance.cell_index




lib = pya.Library.library_by_name("SiEPIC")
if lib == None:
raise Exception("Unknown lib 'SiEPIC'")
Expand All @@ -320,23 +350,26 @@ class TestStruct_DoubleBus_Ring(pya.PCellDeclarationHelper):
"r": r,
"w": wg_width,
"g": g,
"l": SiLayer
"layer": SiLayer,
"devrec": self.devrec,
"pinrec": self.pinrec
}

pv = []
for p in pcell_decl.get_parameters():
if p.name in param:
pv.append(param[p.name])
else:
pv.append(p.default)
# "fake PCell code"
pcell = cell.layout().create_cell("Ring")
pcell = ly.create_cell("Ring")
pcell_decl.produce(ly, [ SiLayerN ], pv, pcell)
t = pya.Trans(pya.Trans.R270, 10 / dbu, y_ring / dbu)
instance = cell.insert(pya.CellInstArray(pcell.cell_index(), t))


# Grating couplers, Ports 1, 2, 3, 4 (top-down):
GC_name = "TE1550_SubGC_neg31_oxide"
GC_name = "ebeam_gc_te1550"
GC_imported = ly.cell(GC_name)
if GC_imported == None:
GC_imported = ly.create_cell(GC_name, "SiEPIC-EBeam").cell_index()
Expand Down Expand Up @@ -374,10 +407,15 @@ class TestStruct_DoubleBus_Ring(pya.PCellDeclarationHelper):
points = [ [0, 127*3], [10+2*r+2*g+2*wg_width,127*3], [10+2*r+2*g+2*wg_width, y_ring] ]
layout_waveguide_abs(cell, SiLayer, points, wg_width, 20)



print "Done drawing the layout for – TestStruct_DoubleBus_Ring: %.3f-%g" % (r, g)






class TestStruct_DoubleBus_Ring2(pya.PCellDeclarationHelper):
"""
The PCell declaration for the DoubleBus_Ring test structure with grating couplers and waveguides
Expand All @@ -397,6 +435,8 @@ class TestStruct_DoubleBus_Ring2(pya.PCellDeclarationHelper):
self.param("npoints", self.TypeInt, "Number of points", default = 500)
self.param("textpolygon", self.TypeInt, "Draw text polygon label? 0/1", default = 1)
self.param("textlayer", self.TypeLayer, "Text Layer", default = pya.LayerInfo(10, 0))
self.param("pinrec", self.TypeLayer, "PinRec Layer", default = pya.LayerInfo(69, 0))
self.param("devrec", self.TypeLayer, "DevRec Layer", default = pya.LayerInfo(68, 0))

def display_text_impl(self):
# Provide a descriptive text for the cell
Expand All @@ -412,30 +452,26 @@ class TestStruct_DoubleBus_Ring2(pya.PCellDeclarationHelper):
cell = self.cell

SiLayer = self.layer
# print SiLayer

SiLayerN = ly.layer(self.layer)
TextLayerN = ly.layer(self.textlayer)

# Import cells from the SiEPIC GDS Library, and instantiate them


# Ring resonator PCell
r = self.r
wg_width = self.w
g = self.g
y_ring = 127*3/2+r


pcell = ly.create_cell("DoubleBus_Ring", "SiEPIC", {"r": r, "w": wg_width, "g": g, "l": SiLayer})
pcell = ly.create_cell("DoubleBus_Ring", "SiEPIC", {"r": r, "w": wg_width, "g": g, "layer": SiLayer, "devrec": self.devrec, "pinrec": self.pinrec })
print "pcell: %s, %s" % (pcell.cell_index(), ly.cell_name(pcell.cell_index()) )
t = pya.Trans(pya.Trans.R270, 10 / dbu, y_ring / dbu)
instance = cell.insert(pya.CellInstArray(pcell.cell_index(), t))
print instance.cell_index


# Grating couplers, Ports 1, 2, 3, 4 (top-down):
GC_name = "TE1550_SubGC_neg31_oxide"
GC_name = "ebeam_gc_te1550"
GC_imported = ly.cell(GC_name)
if GC_imported == None:
GC_imported = ly.create_cell(GC_name, "SiEPIC-EBeam").cell_index()
Expand All @@ -452,8 +488,6 @@ class TestStruct_DoubleBus_Ring2(pya.PCellDeclarationHelper):
shape = cell.shapes(TextLayerN).insert(text)
shape.text_size = 3/dbu



# Create paths for waveguides
wg_bend_radius = 10

Expand All @@ -473,7 +507,7 @@ class TestStruct_DoubleBus_Ring2(pya.PCellDeclarationHelper):
points = [ [0, 127*3], [10+2*r+2*g+2*wg_width,127*3], [10+2*r+2*g+2*wg_width, y_ring] ]
layout_waveguide_abs(cell, SiLayer, points, wg_width, 20)

print "Done drawing the layout for – TestStruct_DoubleBus_Ring: %.3f-%g" % (r, g)
print "Done drawing the layout for – TestStruct_DoubleBus_Ring2: %.3f-%g" % (r, g)



Expand Down Expand Up @@ -503,7 +537,7 @@ def PCell_get_parameters ( pcell ):
# function to list the values for all parameters for an intantiated PCell
# example usage:
# ly = pya.Application.instance().main_window().current_view().active_cellview().layout()
# pcell = ly.create_cell("CIRCLE", "Basic", { "radius": 10, "layer": pya.LayerInfo(1, 0) } )
# pcell = ly.create_cell("CIRCLE", "Basic", { "actual_radius": 10, "layer": pya.LayerInfo(1, 0) } )
# PCell_get_parameters( pcell )

print "* def PCell_get_parameters ( %s ):" % pcell
Expand Down Expand Up @@ -533,7 +567,6 @@ class SiEPIC(pya.Library):
self.layout().register_pcell("DoubleBus_Ring", DoubleBus_Ring())
self.layout().register_pcell("TestStruct_DoubleBus_Ring", TestStruct_DoubleBus_Ring())
self.layout().register_pcell("TestStruct_DoubleBus_Ring2", TestStruct_DoubleBus_Ring2())
# self.layout().register_pcell("Circle", Circle())

# Register us with the name "SiEPIC_EBeam_PCells".
# If a library with that name already existed, it will be replaced then.
Expand Down
9 changes: 5 additions & 4 deletions klayout_dot_config/pymacros/SiEPIC_EBeam_Verification.lym
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def flag_waveguide_error(dpoints, text, optical_waveguide, topcell):
a1 = []
for p in dpoints:
a1.append (pya.Point(p[0], p[1]))
path = pya.Path(a1, optical_waveguide.wg_width*4/dbu)
path = pya.Path(a1, optical_waveguide.wg_width*4/dbu)
topcell.shapes(LayerErrorN).insert(path)
x = numpy.array(dpoints)[:,0].mean()*dbu
y = numpy.array(dpoints)[:,1].mean()*dbu
Expand Down Expand Up @@ -373,9 +373,9 @@ def find_all_components(cell, LayerDevRecN, LayerPinRecN, LayerFbrTgtN):
path= iter2.shape().path.transformed(iter2.itrans())
path= path.transformed(iter1.itrans())
print "%s: PinRec in cell #{}: %s, path -- %s" % (i, iter2.cell().name, path)
points = path_to_points(path)
optical_pins.append (Optical_pin (points, component_n) )
optical_components[component_n-1].npins += 1
points = path_to_points(path)
optical_pins.append (Optical_pin (points, component_n) )
optical_components[component_n-1].npins += 1
iter2.next()
iter2 = subcell.begin_shapes_rec(LayerFbrTgtN)
while not(iter2.at_end()):
Expand Down Expand Up @@ -500,6 +500,7 @@ def flag_component_error(box, text, x, y):
topcell.shapes(LayerErrorN).insert(box)
layout_errors.append(Layout_error(text, x, y) )
print text
wtext.insertHtml('%s<br>' %text)


def check_connectivity(optical_components, topcell, LayerErrorN):
Expand Down

0 comments on commit db046da

Please sign in to comment.