Skip to content

Commit

Permalink
Verification in PyPI working, with KLive show(gds, rdb)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasc-ubc committed Nov 19, 2023
1 parent 534a1da commit 3a79502
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@

from SiEPIC._globals import Python_Env
from SiEPIC.scripts import load_klayout_technology
from SiEPIC.scripts import zoom_out, export_layout

if Python_Env == 'Script':
path_module = os.path.join(path_GitHub, 'SiEPIC_EBeam_PDK/klayout')
path_lyt_file = os.path.join(path_GitHub, 'SiEPIC_EBeam_PDK/klayout/EBeam/EBeam.lyt')
tech = load_klayout_technology('EBeam', path_module, path_lyt_file)

tech_name = 'EBeam'

# Example layout function
def dbl_bus_ring_res():

# Import functions from SiEPIC-Tools
from SiEPIC.extend import to_itype
from SiEPIC.scripts import connect_cell, connect_pins_with_waveguide, zoom_out, export_layout
from SiEPIC.scripts import connect_cell, connect_pins_with_waveguide
from SiEPIC.utils.layout import new_layout, floorplan

# Create a layout for testing a double-bus ring resonator.
Expand Down Expand Up @@ -68,7 +70,6 @@ def dbl_bus_ring_res():
with a top cell
and Draw the floor plan
'''
tech_name = 'EBeam'
cell, ly = new_layout(tech_name, 'top', GUI=True, overwrite = True)
floorplan(cell, 605e3, 410e3)

Expand Down Expand Up @@ -159,22 +160,33 @@ def dbl_bus_ring_res():

# GC3 to bottom-right of ring
connect_pins_with_waveguide(instGCs[3], 'opt1', inst_dc2, 'pin3', waveguide_type=waveguide_type)

# Zoom out
zoom_out(cell)

# Save
path = os.path.dirname(os.path.realpath(__file__))
export_layout(cell, path, 'Test_structures_ring_resonators', relative_path = '', format='oas', screenshot=True)

# Introduce an error, to demonstrate the Functional Verification
inst_dc2.transform(Trans(1000,-1000))


return ly, cell

ly, cell = dbl_bus_ring_res()

# Zoom out
zoom_out(cell)

# Save
path = os.path.dirname(os.path.realpath(__file__))
filename = 'Test_structures_ring_resonators'
file_out = export_layout(cell, path, filename, relative_path = '', format='oas', screenshot=True)

from SiEPIC.verification import layout_check
print('SiEPIC_EBeam_PDK: example_Ring_resonator_sweep.py - verification')

layout_check(cell = cell, verbose=True, GUI=True)
file_lyrdb = os.path.join(path,filename+'.lyrdb')
layout_check(cell = cell, verbose=False, GUI=True, file_rdb=file_lyrdb)

from SiEPIC.utils import klive
klive.show(file_out, lyrdb_filename=file_lyrdb, technology=tech_name)

# klive.lyrbd(file_lyrdb, technology=tech_name)


print('SiEPIC_EBeam_PDK: example_Ring_resonator_sweep.py - done')
25 changes: 17 additions & 8 deletions klayout/EBeam/pymacros/SiEPIC_EBeam_Library.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"""

verbose=False

import pya
from pya import *
Expand Down Expand Up @@ -133,9 +134,11 @@
pcells_=[]
for f in files:
module = 'pcells_EBeam.%s' % f.replace('.py','') ### folder name ###
print(' - found module: %s' % module)
if verbose:
print(' - found module: %s' % module)
m = importlib.import_module(module)
print(m)
if verbose:
print(m)
pcells_.append(importlib.reload(m))


Expand All @@ -150,7 +153,8 @@ def __init__(self):
library = tech_name
self.technology=tech_name

print("Initializing '%s' Library." % library)
if verbose:
print("Initializing '%s' Library." % library)

# Set the description
self.description = "v0.3.58, Components with models"
Expand All @@ -162,28 +166,33 @@ def __init__(self):
# Import all the GDS files from the tech folder
import os, fnmatch
dir_path = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../gds/EBeam"))
print(' library path: %s' % dir_path)
if verbose:
print(' library path: %s' % dir_path)
search_str = '*.[Oo][Aa][Ss]' # OAS
for root, dirnames, filenames in os.walk(dir_path, followlinks=True):
for filename in fnmatch.filter(filenames, search_str):
file1=os.path.join(root, filename)
print(" - reading %s" % file1 )
if verbose:
print(" - reading %s" % file1 )
self.layout().read(file1)
search_str = '*.[Gg][Dd][Ss]' # GDS
for root, dirnames, filenames in os.walk(dir_path, followlinks=True):
for filename in fnmatch.filter(filenames, search_str):
file1=os.path.join(root, filename)
print(" - reading %s" % file1 )
if verbose:
print(" - reading %s" % file1 )
self.layout().read(file1)

# Create the PCell declarations
for m in pcells_:
mm = m.__name__.replace('pcells_EBeam.','')
mm2 = m.__name__+'.'+mm+'()'
print(' - register_pcell %s, %s' % (mm,mm2))
if verbose:
print(' - register_pcell %s, %s' % (mm,mm2))
self.layout().register_pcell(mm, eval(mm2))

print(' done with pcells')
if verbose:
print(' done with pcells')

# Register us the library with the technology name
# If a library with that name already existed, it will be replaced then.
Expand Down
19 changes: 13 additions & 6 deletions klayout/EBeam/pymacros/SiEPIC_EBeam_Library_ANT.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
This file implements a library called "EBeam-ANT", consisting of components that are biased to work the best with ANT process.
"""
print('SiEPIC_EBeam_Library_ANT')
verbose=False
if verbose:
print('SiEPIC_EBeam_Library_ANT')

import pya
from pya import *
Expand Down Expand Up @@ -43,7 +45,8 @@ def __init__(self):
library = tech_name +'-ANT'
self.technology=tech_name

print("Initializing '%s' Library." % library)
if verbose:
print("Initializing '%s' Library." % library)

# Set the description
self.description = "v0.3.58, ANT components"
Expand All @@ -55,18 +58,21 @@ def __init__(self):
# Import all the GDS files from the tech folder
import os, fnmatch
dir_path = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../gds/ANT"))
print(' library path: %s' % dir_path)
if verbose:
print(' library path: %s' % dir_path)
search_str = '*.[Oo][Aa][Ss]' # OAS
for root, dirnames, filenames in os.walk(dir_path, followlinks=True):
for filename in fnmatch.filter(filenames, search_str):
file1=os.path.join(root, filename)
print(" - reading %s" % file1 )
if verbose:
print(" - reading %s" % file1 )
self.layout().read(file1)
search_str = '*.[Gg][Dd][Ss]' # GDS
for root, dirnames, filenames in os.walk(dir_path, followlinks=True):
for filename in fnmatch.filter(filenames, search_str):
file1=os.path.join(root, filename)
print(" - reading %s" % file1 )
if verbose:
print(" - reading %s" % file1 )
self.layout().read(file1)

# Create the PCell declarations
Expand All @@ -76,7 +82,8 @@ def __init__(self):
# print(' - register_pcell %s, %s' % (mm,mm2))
# self.layout().register_pcell(mm, eval(mm2))

print(' done with pcells')
if verbose:
print(' done with pcells')

# Register us the library with the technology name
# If a library with that name already existed, it will be replaced then.
Expand Down
28 changes: 19 additions & 9 deletions klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ def PCell_get_parameters ( pcell ):
"""

print('SiEPIC_EBeam_Library_Beta')
verbose=False
if verbose:
print('SiEPIC_EBeam_Library_Beta')

import pya
from pya import *
Expand All @@ -145,9 +147,11 @@ def PCell_get_parameters ( pcell ):
pcells_=[]
for f in files:
module = 'pcells_EBeam_Beta.%s' % f.replace('.py','') ### folder name ###
print(' - found module: %s' % module)
if verbose:
print(' - found module: %s' % module)
m = importlib.import_module(module)
print(m)
if verbose:
print(m)
pcells_.append(importlib.reload(m))


Expand All @@ -162,7 +166,8 @@ def __init__(self):
library = tech_name +'_Beta'
self.technology=tech_name

print("Initializing '%s' Library." % library)
if verbose:
print("Initializing '%s' Library." % library)

# Set the description
self.description = "v0.3.58, Beta components"
Expand All @@ -174,28 +179,33 @@ def __init__(self):
# Import all the GDS files from the tech folder
import os, fnmatch
dir_path = os.path.normpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../gds/EBeam_Beta"))
print(' library path: %s' % dir_path)
if verbose:
print(' library path: %s' % dir_path)
search_str = '*.[Oo][Aa][Ss]' # OAS
for root, dirnames, filenames in os.walk(dir_path, followlinks=True):
for filename in fnmatch.filter(filenames, search_str):
file1=os.path.join(root, filename)
print(" - reading %s" % file1 )
if verbose:
print(" - reading %s" % file1 )
self.layout().read(file1)
search_str = '*.[Gg][Dd][Ss]' # GDS
for root, dirnames, filenames in os.walk(dir_path, followlinks=True):
for filename in fnmatch.filter(filenames, search_str):
file1=os.path.join(root, filename)
print(" - reading %s" % file1 )
if verbose:
print(" - reading %s" % file1 )
self.layout().read(file1)

# Create the PCell declarations
for m in pcells_:
mm = m.__name__.replace('pcells_EBeam_Beta.','')
mm2 = m.__name__+'.'+mm+'()'
print(' - register_pcell %s, %s' % (mm,mm2))
if verbose:
print(' - register_pcell %s, %s' % (mm,mm2))
self.layout().register_pcell(mm, eval(mm2))

print(' done with pcells')
if verbose:
print(' done with pcells')

# Register us the library with the technology name
# If a library with that name already existed, it will be replaced then.
Expand Down
20 changes: 14 additions & 6 deletions klayout/EBeam/pymacros/SiEPIC_EBeam_Library_Dream.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
consisting of components developed by Dream Photonics Inc,
that have been validated in the ANT process.
"""
print('EBeam-Dream')
verbose=False

if verbose:
print('EBeam-Dream')

import pya
from pya import *
Expand All @@ -26,9 +29,11 @@
pcells_=[]
for f in files:
module = 'pcells_EBeam_Dream.%s' % f.replace('.py','') ### folder name ###
print(' - found module: %s' % module)
if verbose:
print(' - found module: %s' % module)
m = importlib.import_module(module)
print(m)
if verbose:
print(m)
pcells_.append(importlib.reload(m))


Expand All @@ -43,7 +48,8 @@ def __init__(self):
library = tech_name +'-Dream'
self.technology=tech_name

print("Initializing '%s' Library." % library)
if verbose:
print("Initializing '%s' Library." % library)

# Set the description
self.description = "v0.0.1, Dream Photonics"
Expand Down Expand Up @@ -75,10 +81,12 @@ def __init__(self):
for m in pcells_:
mm = m.__name__.replace('pcells_EBeam_Dream.','')
mm2 = m.__name__+'.'+mm+'()'
print(' - register_pcell %s, %s' % (mm,mm2))
if verbose:
print(' - register_pcell %s, %s' % (mm,mm2))
self.layout().register_pcell(mm, eval(mm2))

print(' done with pcells')
if verbose:
print(' done with pcells')

# Register us the library with the technology name
# If a library with that name already existed, it will be replaced then.
Expand Down
Loading

0 comments on commit 3a79502

Please sign in to comment.