-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d7e5a6
commit f98e7df
Showing
7 changed files
with
230 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Run SiEPIC-Tool Layout tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- '**' | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
|
||
|
||
jobs: | ||
test_layouts: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout repo content | ||
uses: actions/checkout@v3 | ||
|
||
# can also specify python version if needed | ||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
|
||
- name: install python packages | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install klayout numpy scipy pytest | ||
- name: Test with pytest | ||
run: pytest klayout_dot_config/tech | ||
|
||
- name: run python test script | ||
run: | | ||
python $GITHUB_WORKSPACE/klayout_dot_config/tech/GSiP/pymacros/tests/example_circuit.py | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
print('SiEPIC-GSiP PDK Python module: siepic_gsip_pdk, KLayout technology: GSipP') | ||
|
||
# Load the KLayout technology, when running in Script mode | ||
import pya, os | ||
tech = pya.Technology().create_technology('GSiP') | ||
tech.load(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'GSiP.lyt')) | ||
|
||
# then import all the technology modules | ||
from . import pymacros | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
print('SiEPIC-GSiP PDK Python module: pymacros') | ||
|
||
from . import GSiP_Library | ||
|
||
|
||
|
||
|
||
|
23 changes: 1 addition & 22 deletions
23
klayout_dot_config/tech/GSiP/pymacros/pcells_GSiP/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,4 @@ | ||
import os, sys | ||
import SiEPIC | ||
try: | ||
import siepic_tools | ||
except: | ||
pass | ||
|
||
op_tag = "" #operation tag which defines whether we are loading library in script or GUI env | ||
|
||
try: | ||
# import pya from klayout | ||
import pya | ||
if("Application" in str(dir(pya))): | ||
from SiEPIC.utils import get_technology_by_name | ||
op_tag = "GUI" | ||
#import pya functions | ||
else: | ||
raise ImportError | ||
|
||
except: | ||
import klayout.db as pya | ||
from zeropdk import Tech | ||
op_tag = "script" | ||
lyp_filepath = os.path(str(os.path(os.path.dirname(os.path.realpath(__file__))).parent) + r"/klayout_Layers_GSiP.lyp") | ||
print(lyp_filepath) | ||
from SiEPIC.utils import get_technology_by_name |
85 changes: 0 additions & 85 deletions
85
klayout_dot_config/tech/GSiP/pymacros/tests/example_circuit.py
This file was deleted.
Oops, something went wrong.
102 changes: 102 additions & 0 deletions
102
klayout_dot_config/tech/GSiP/pymacros/tests/test_example_circuit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
''' | ||
--- Simple MZI --- | ||
by Lukas Chrostowski, 2020-2023 | ||
Example simple script to | ||
- create a new layout with a top cell | ||
- create an MZI | ||
- export to OASIS for submission to fabrication | ||
using SiEPIC-Tools function including connect_pins_with_waveguide and connect_cell | ||
usage: | ||
- run this script in KLayout Application | ||
''' | ||
|
||
from pya import * | ||
|
||
def example_circuit(): | ||
designer_name = 'Test' | ||
top_cell_name = 'GSiP_%s' % designer_name | ||
|
||
import pya | ||
|
||
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 | ||
from SiEPIC.extend import to_itype | ||
from SiEPIC.verification import layout_check | ||
|
||
import os | ||
path = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
tech_name = 'GSiP' | ||
|
||
if SiEPIC.__version__ < '0.5.4': | ||
raise Exception("Errors", "This example requires SiEPIC-Tools version 0.5.4 or greater.") | ||
|
||
if Python_Env == 'Script': | ||
# Load the PDK from a folder, e.g, GitHub, when running externally from the KLayout Application | ||
import sys | ||
sys.path.insert(0,os.path.abspath(os.path.join(path, '../../..'))) | ||
import GSiP | ||
|
||
''' | ||
Create a new layout, with a top cell, and Draw the floor plan | ||
''' | ||
cell, ly = new_layout(tech_name, top_cell_name, GUI=True, overwrite = True) | ||
floorplan(cell, 605e3, 410e3) | ||
|
||
dbu = ly.dbu | ||
|
||
from SiEPIC.scripts import connect_pins_with_waveguide, connect_cell | ||
waveguide_type='Strip TE 1550 nm' | ||
|
||
# Load cells from library | ||
cell_ebeam_gc = ly.create_cell('Grating_Coupler_13deg_TE_1550_Oxide', tech_name) | ||
cell_ebeam_y = ly.create_cell('YBranch_te1550', tech_name) | ||
|
||
# grating couplers, place at absolute positions | ||
x,y = 60000, 15000 | ||
t = Trans(Trans.R0,x,y) | ||
instGC1 = cell.insert(CellInstArray(cell_ebeam_gc.cell_index(), t)) | ||
t = Trans(Trans.R0,x,y+127000) | ||
instGC2 = cell.insert(CellInstArray(cell_ebeam_gc.cell_index(), t)) | ||
|
||
# automated test label | ||
text = Text ("opt_in_TE_1550_device_%s_MZI1" % designer_name, t) | ||
cell.shapes(ly.layer(ly.TECHNOLOGY['Text'])).insert(text).text_size = 5/dbu | ||
|
||
# Y branches: | ||
instY1 = connect_cell(instGC1, 'opt_wg', cell_ebeam_y, 'opt1') | ||
instY1.transform(Trans(20000,0)) | ||
instY2 = connect_cell(instGC2, 'opt_wg', cell_ebeam_y, 'opt1') | ||
instY2.transform(Trans(20000,0)) | ||
|
||
# Waveguides: | ||
connect_pins_with_waveguide(instGC1, 'opt_wg', instY1, 'opt1', waveguide_type=waveguide_type) | ||
connect_pins_with_waveguide(instGC2, 'opt_wg', instY2, 'opt1', waveguide_type=waveguide_type) | ||
connect_pins_with_waveguide(instY1, 'opt2', instY2, 'opt3', waveguide_type=waveguide_type) | ||
connect_pins_with_waveguide(instY1, 'opt3', instY2, 'opt2', waveguide_type=waveguide_type,turtle_B=[25,-90]) | ||
|
||
# Zoom out | ||
zoom_out(cell) | ||
|
||
# Verify | ||
num_errors = layout_check(cell=cell, verbose=True, GUI=True) | ||
print('Number of errors: %s' % num_errors) | ||
|
||
# Save | ||
filename = os.path.splitext(os.path.basename(__file__))[0] | ||
file_out = export_layout(cell, path, filename, format='oas', screenshot=True) | ||
|
||
return num_errors | ||
|
||
def test_example_circuit(): | ||
assert example_circuit() == 0 | ||
|
||
if __name__ == "__main__": | ||
example_circuit() | ||
|