Skip to content

Commit

Permalink
Merge branch 'SiEPIC:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
newmansc2 authored Oct 16, 2024
2 parents 8d9aa2a + 4a7a714 commit 291f33c
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/AutomaticApprove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
uses: mheap/automatic-approve-action@v1
with:
token: ${{ secrets.PAT }}
workflows: "run-verification.yml"
workflows: "run-verification.yml,case_sensitivity.yml"
4 changes: 1 addition & 3 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ jobs:

- name: install Python packages
run: |
# python -m pip install --upgrade pip
pip install klayout SiEPIC siepic_ebeam_pdk pandas
pip install klayout SiEPIC siepic_ebeam_pdk pandas packaging
- name: run merge script
run: |
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/python-to-oas_gds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: checkout repo content
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -32,8 +32,7 @@ jobs:

- name: install python packages
run: |
# python -m pip install --upgrade pip
pip install klayout SiEPIC siepic_ebeam_pdk
pip install klayout SiEPIC siepic_ebeam_pdk packaging
- name: run python scripts and get output gds / oas file
run: |
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/run-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

steps:
- name: checkout repo content
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -46,13 +46,14 @@ jobs:

# can also specify python version if needed
- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: install python packages
run: |
python -m pip install --upgrade pip
pip install klayout SiEPIC siepic_ebeam_pdk
python -m pip install --upgrade SiEPIC
pip install klayout SiEPIC siepic_ebeam_pdk packaging
- name: download latest python-to-oas-gds artifact from triggering workflow
uses: dawidd6/action-download-artifact@v2
Expand All @@ -73,7 +74,7 @@ jobs:
else
if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target" ]]; then
# triggered on pull request, get all changed / added files from forked repo
FILES=$(git diff --name-only --diff-filter=ACM FETCH_HEAD | grep -i -E '\.(gds|oas)$' | sed 's|^submissions/||')
FILES=$(git diff --name-only --diff-filter=ACM origin/main...HEAD | grep -i -E '\.(gds|oas)$' | sed 's|^submissions/||')
else
# triggered push, locate the changed / added .gds and .oas files in the submission folder
FILES=$(git diff --name-status --diff-filter=ACM --relative=submissions ${{ github.event.before }} ${{ github.sha }} submissions | grep -i -E '\.(gds|oas)$' | awk '{print $2}')
Expand Down Expand Up @@ -131,9 +132,9 @@ jobs:
fi
echo "Done verification on $file"
echo "$output" >> verification_output.txt
done
echo "$output" > verification_output.txt
echo "files_with_errors=$files_with_errors" >> $GITHUB_ENV
- name: move output lyrdb files to new folder
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ The verification and merging is performed using GitHub actions. The repository i

## Latest Merge Layout File
<!-- start-link -->
https://github.com/SiEPIC/openEBL-2024-10-SiN/actions/runs/10786612253/artifacts/1912598540
https://github.com/SiEPIC/openEBL-2024-10-SiN/actions/runs/11373290621/artifacts/2065630542
<!-- end-link -->
Binary file added submissions/EBeam_LukasChrostowski_MZI_1550.oas
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''
--- Simple MZI ---
by Lukas Chrostowski, 2020-2024
by Lukas Chrostowski, 2024
Expand Down
136 changes: 136 additions & 0 deletions submissions/KLayout Python/EBeam_LukasChrostowski_MZI_1550.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
'''
--- Simple MZI ---
by Lukas Chrostowski, 2024
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
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_MZI' % designer_name
export_type = 'static' # static: for fabrication, PCell: include PCells in file

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
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_MZI layout script')

tech_name = 'EBeam'

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
'''
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_type1='SiN Strip TE 1550 nm, w=750 nm'
waveguide_type_delay='SiN routing TE 1550 nm (compound waveguide)'

# Load cells from library
cell_ebeam_gc = ly.create_cell('GC_SiN_TE_1550_8degOxide_BB', 'EBeam-SiN')

# grating couplers, place at absolute positions
x,y = 60000, 20000
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_loopback" % designer_name, t)
cell.shapes(ly.layer(ly.TECHNOLOGY['Text'])).insert(text).text_size = 5/dbu

# Waveguides:
connect_pins_with_waveguide(instGC1, 'opt1', instGC2, 'opt1', waveguide_type=waveguide_type1)

if 0:
# 3rd MZI, with a very long delay line
cell_ebeam_delay = ly.create_cell('spiral_paperclip', 'EBeam_Beta',
{'waveguide_type':waveguide_type_delay,
'length':200,
'flatten':True})
x,y = 60000, 205000
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_MZI3" % designer_name, t)
cell.shapes(ly.layer(ly.TECHNOLOGY['Text'])).insert(text).text_size = 5/dbu

# Y branches:
instY1 = connect_cell(instGC1, 'opt1', cell_ebeam_y_dream, 'opt1')
instY1.transform(Trans(20000,0))
instY2 = connect_cell(instGC2, 'opt1', cell_ebeam_y_dream, 'opt1')
instY2.transform(Trans(20000,0))

# Spiral:
instSpiral = connect_cell(instY2, 'opt2', cell_ebeam_delay, 'optA')
instSpiral.transform(Trans(20000,0))

# Waveguides:
connect_pins_with_waveguide(instGC1, 'opt1', instY1, 'opt1', waveguide_type=waveguide_type)
connect_pins_with_waveguide(instGC2, 'opt1', instY2, 'opt1', waveguide_type=waveguide_type)
connect_pins_with_waveguide(instY1, 'opt2', instY2, 'opt3', waveguide_type=waveguide_type)
connect_pins_with_waveguide(instY2, 'opt2', instSpiral, 'optA', waveguide_type=waveguide_type)
connect_pins_with_waveguide(instY1, 'opt3', instSpiral, 'optB', waveguide_type=waveguide_type,turtle_B=[5,-90])

# Zoom out
zoom_out(cell)

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

# Verify
file_lyrdb = os.path.join(path,filename+'.lyrdb')
num_errors = layout_check(cell = cell, 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, lyrdb_filename=file_lyrdb, technology=tech_name)

0 comments on commit 291f33c

Please sign in to comment.