Skip to content

Commit

Permalink
update, making things fit, DRC errors fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasc-ubc committed Nov 6, 2024
1 parent 915b9cd commit 319c8c7
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 15 deletions.
Binary file modified framework/EBL_Framework_1cm_PCM_static.oas
Binary file not shown.
Binary file added framework/loopback_1550_FaML.oas
Binary file not shown.
108 changes: 108 additions & 0 deletions framework/loopback_1550_FaML.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
'''
--- Simple Loopback, tested using Facet-Attached Micro Lenses (FaML) ---
by Lukas Chrostowski, 2024
Example simple script to
- choose the fabrication technology provided by Applied Nanotools, using silicon nitride (SiN) waveguides
- use the SiEPIC-EBeam-PDK technology
- using KLayout and SiEPIC-Tools, with function including connect_pins_with_waveguide and connect_cell
- create a new layout with a top cell
- create as many loopbacks for calibration as will fit
- export to OASIS for submission to fabrication
- display the layout in KLayout using KLive
Use instructions:
Run in Python, e.g., VSCode
pip install required packages:
- klayout, SiEPIC, siepic_ebeam_pdk, numpy
'''

designer_name = 'LukasChrostowski'
top_cell_name = 'EBeam_%s_loopback_FaML' % designer_name
export_type = 'static' # static: for fabrication, PCell: include PCells in file
tech_name = 'EBeam'

import pya
from pya import *

import SiEPIC
from SiEPIC._globals import Python_Env
from SiEPIC.scripts import connect_cell, connect_pins_with_waveguide, zoom_out, export_layout
from SiEPIC.utils.layout import new_layout, floorplan, FaML_two, coupler_array
from SiEPIC.extend import to_itype
from SiEPIC.verification import layout_check

import os

if Python_Env == 'Script':
# For external Python mode, when installed using pip install siepic_ebeam_pdk
import siepic_ebeam_pdk

print('EBeam_LukasChrostowski_loopback layout script')

from packaging import version
if version.parse(SiEPIC.__version__) < version.parse("0.5.4"):
raise Exception("Errors", "This example requires SiEPIC-Tools version 0.5.4 or greater.")

'''
Create a new layout using the EBeam technology,
with a top cell
and Draw the floor plan
'''
topcell, ly = new_layout(tech_name, top_cell_name, GUI=True, overwrite = True)

# subcell
cell = ly.create_cell('FaML_test')
height = 2760e3
floorplan(cell, 200e3, height)

waveguide_type1='SiN Strip TE 1550 nm, w=750 nm'

#######################
# Circuit – Loopback
#######################

for i in range(int(height / 2/127e3)+1):
# draw two edge couplers for facet-attached micro-lenses
inst_faml = coupler_array(cell,
y_offset = i *254e3 + 50e3,
cell_name = 'ebeam_dream_FaML_SiN_1550_BB',
cell_library = 'EBeam-Dream',
label = "opt_in_TE_1550_FaML_loopback",
#cell_params = None,
count = 2,
)
# loopback waveguide
connect_pins_with_waveguide(inst_faml[0], 'opt1', inst_faml[1], 'opt1', waveguide_type=waveguide_type1)

t = pya.Trans(pya.Trans.R180,0,0)
topcell.insert(pya.CellInstArray(cell.cell_index(), t))


# Zoom out
zoom_out(topcell)

# Export for fabrication, removing PCells
thisfilepath = os.path.dirname(os.path.realpath(__file__))
filename, extension = os.path.splitext(os.path.basename(__file__))
if export_type == 'static':
file_out = export_layout(topcell, thisfilepath, filename, relative_path = '', format='oas', screenshot=True)
else:
file_out = os.path.join(thisfilepath, '',filename+'.oas')
ly.write(file_out)

'''
# Verify
file_lyrdb = os.path.join(thisfilepath, filename+'.lyrdb')
num_errors = layout_check(cell = topcell, verbose=False, GUI=True, file_rdb=file_lyrdb)
print('Number of errors: %s' % num_errors)
'''

# Display the layout in KLayout, using KLayout Package "klive", which needs to be installed in the KLayout Application
if Python_Env == 'Script':
from SiEPIC.utils import klive
klive.show(file_out, technology=tech_name)
Binary file added loopback_1550_FaML.oas
Binary file not shown.
43 changes: 32 additions & 11 deletions merge/EBeam_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ def log(text):
files_in_alphabetical = []
for f in sorted(files):
if '.oas' in f.lower() or '.gds' in f.lower():
# print(f, path2)
if 'FaML' not in f:
if 'FaML' not in f and 'FAVE' not in f:
fpath = os.path.join(path2,f)
layout2 = pya.Layout()
layout2.read(fpath)
Expand All @@ -150,6 +149,22 @@ def log(text):
for f in sorted(files_in_alphabetical, key = lambda x: x[0]):
files_in.append(os.path.join(path2,f[1]))

# Then all FAVE designs
files_in_alphabetical = []
for f in sorted(files):
if '.oas' in f.lower() or '.gds' in f.lower():
if 'FAVE' in f:
fpath = os.path.join(path2,f)
layout2 = pya.Layout()
layout2.read(fpath)
top_cells = layout2.top_cells()
top_cells.sort(key=lambda x: x.child_instances())
w = top_cells[-1].bbox().width()
files_in_alphabetical.append ([w,fpath])
# Then sort the designs by cell width
for f in sorted(files_in_alphabetical, key = lambda x: -x[0]):
files_in.append(os.path.join(path2,f[1]))


# Create course cells using the folder name under the top cell
cell_edXphot1x = layout.create_cell("edX")
Expand Down Expand Up @@ -314,6 +329,20 @@ def log(text):
# bounding box of the cell
bbox = cell.bbox()
log(' - bounding box: %s' % bbox.to_s() )

# Check that the design submission has a FloorPlan. If not, add one
layerinfo_FP = pya.LayerInfo(99,0)
Layer_FP = layout2.layer(layerinfo_FP) # or use "layer"
r3 = pya.Region(cell.begin_shapes_rec(Layer_FP))
if r3.is_empty():
print(' - WARNING: Cell %s did not have a Floor Plan, %s' % (cell.name, f) )
log(' - WARNING: Cell %s did not have a Floor Plan, %s' % (cell.name, f) )
if 'FAVE' in f:
# add extra space on the left
print(' - Adding extra FloorPlan space to FAVE cell' )
bbox.left = bbox.left - 22e3
# bbox = pya.Box(bbox.left - 22e3, bbox.bottom, bbox.right, bbox.top)
cell.shapes(Layer_FP).insert(bbox)

# Create sub-cell under subcell cell, using user's cell name
subcell = layout.create_cell(cell.name)
Expand Down Expand Up @@ -341,15 +370,7 @@ def log(text):
r1.insert(iter1.shape().polygon.transformed(iter1.trans()))
iter1.next()
r1.merge()

# Check that the design submission has a FloorPlan. If not, add one
Layer_FP = layout.find_layer(99,0) # or use "layer"
r3 = pya.Region(subcell.begin_shapes_rec(Layer_FP))
if r3.is_empty():
print(' - WARNING: Cell %s did not have a Floor Plan, %s' % (subcell.name, f) )
log(' - WARNING: Cell %s did not have a Floor Plan, %s' % (subcell.name, f) )
subcell.shapes(Layer_FP).insert(subcell.bbox())


# offset for the facet-attached micro lenses
if course == 'FaML':
x_offset = -100e3
Expand Down
Binary file modified submissions/EBeam_LukasChrostowski_MZI_1550_FAVE.oas
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# draw two edge couplers for facet-attached vertical emitters
inst_fave = FaML_two(cell,
label = "opt_in_TE_1550_FAVE_loopback_%s" % designer_name,
x_offset = 211e3,
x_offset = 210e3 + 22e3,
y_offset = 59.5e3,
cell_name = "ebeam_dream_FAVE_SiN_1550_BB",
cell_params = None,
Expand All @@ -90,7 +90,7 @@
# draw two edge couplers for facet-attached vertical emitters
inst_fave = FaML_two(cell,
label = "opt_in_TE_1550_FAVE_MZI1_%s" % designer_name,
x_offset = 211e3+275e3,
x_offset = 210e3+275e3 + 22e3,
y_offset = 59.5e3,
cell_name = "ebeam_dream_FAVE_SiN_1550_BB",
cell_params = None,
Expand All @@ -107,13 +107,13 @@
#######################
cell_ebeam_delay = ly.create_cell('spiral_paperclip', 'EBeam_Beta',
{'waveguide_type':waveguide_type_delay,
'length':261,
'length':250,
'loops':8,
'flatten':True})
# draw two edge couplers for facet-attached micro-lenses
inst_fave = FaML_two(cell,
label = "opt_in_TE_1550_FAVE_MZI2_%s" % designer_name,
x_offset = 211e3,
x_offset = 210e3 + 22e3,
y_offset = 59.5e3+254e3,
cell_name = "ebeam_dream_FAVE_SiN_1550_BB",
cell_params = None,
Expand Down
Binary file modified submissions/OpenEBL_snewman_SiN_CDCB3_1_FAVE.gds
Binary file not shown.

0 comments on commit 319c8c7

Please sign in to comment.