Skip to content

Commit

Permalink
connect_pins_with_waveguide: option to set parent_cell
Browse files Browse the repository at this point in the history
option to put the waveguide (and error Paths) in a specific parent cell
  • Loading branch information
lukasc-ubc committed Feb 11, 2024
1 parent 8bc1d61 commit f535f3a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion klayout_dot_config/grain.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<salt-grain>
<name>siepic_tools</name>
<version>0.5.4</version>
<version>0.5.5</version>
<api-version>0.27</api-version>
<title>SiEPIC Tools</title>
<doc>Tools for designing Silicon Photonic Integrated Circuits, including waveguides, component simulations, functional verification, DRC verification, Functional verification, netlist extraction, circuit simulations. Layout can be implemented graphically or by programming in Python using the SiEPIC functions and KLayout Python API. Framework and examples for creating layouts using scripts. Includes a generic PDK (GSiP). Other PDKs are installed separately, and depend on SiEPIC-Tools.</doc>
Expand Down
2 changes: 1 addition & 1 deletion klayout_dot_config/python/SiEPIC/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SiEPIC-Tools package for KLayout
'''

__version__ = '0.5.4'
__version__ = '0.5.5'

print("KLayout SiEPIC-Tools version %s" %__version__)

Expand Down
19 changes: 17 additions & 2 deletions klayout_dot_config/python/SiEPIC/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def pointlist_to_turtle(pointlist):
# return pointlist


def connect_pins_with_waveguide(instanceA, pinA, instanceB, pinB, waveguide = None, waveguide_type = None, turtle_A=None, turtle_B=None, verbose=False, debug_path=False, r=None, error_min_bend_radius=True, relaxed_pinnames=True):
def connect_pins_with_waveguide(instanceA, pinA, instanceB, pinB, waveguide = None, waveguide_type = None, turtle_A=None, turtle_B=None, verbose=False, debug_path=False, r=None, error_min_bend_radius=True, relaxed_pinnames=True, parent_cell=None):
'''
Create a Path connecting instanceA:pinA to instanceB:pinB
where instance = pya.Instance; pin = string, e.g. 'pin1'
Expand All @@ -107,6 +107,15 @@ def connect_pins_with_waveguide(instanceA, pinA, instanceB, pinB, waveguide = No
* works for instances that are individual components
* works for instances that are sub-circuits with many components, but one unique pin name
- waveguide_type = string, name from WAVEGUIDES.XML
- verbose=False
- debug_path=False
- r=None
- error_min_bend_radius=True
- relaxed_pinnames=True: finds 'opt' if the pin is called 'opt1'
- parent_cell = None: move the waveguide into a specific cell
default is the common parent of instanceA and instanceB
originally thought about implementing the following, but perhaps not useful:
- absolute_vertices: list of Points, except for the first and last
Expand Down Expand Up @@ -196,7 +205,7 @@ def connect_pins_with_waveguide(instanceA, pinA, instanceB, pinB, waveguide = No

else:
cell=instanceA.parent_cell

# Find the two components:
from time import time
t = time()
Expand Down Expand Up @@ -505,6 +514,10 @@ def connect_pins_with_waveguide(instanceA, pinA, instanceB, pinB, waveguide = No
# generate the path
path = pya.Path(points,width).to_dtype(dbu).remove_colinear_points()

# put the waveguide in the parent_cell specified by the input parameter
if parent_cell:
cell = parent_cell

# Check if the path is Manhattan (it should be)
if not path.is_manhattan():
print('Turtle directions: %s, %s' % (directionB, directionA))
Expand Down Expand Up @@ -544,13 +557,15 @@ def connect_pins_with_waveguide(instanceA, pinA, instanceB, pinB, waveguide = No

if wg_pcell==None:
raise Exception("problem! cannot create Waveguide PCell from library: %s" % technology_name)

inst = cell.insert(pya.CellInstArray(wg_pcell.cell_index(), pya.Trans(pya.Trans.R0, 0, 0)))

if verbose:
print('Time elapsed, make waveguide: %s' % (time() - t))

if debug_path:
cell.shapes(1).insert(path)
print('Error path, added to cell %s' % (cell.name) )

return inst
# end of def connect_pins_with_waveguide
Expand Down
2 changes: 1 addition & 1 deletion klayout_dot_config/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "SiEPIC"
version = "0.5.4"
version = "0.5.5"
authors = [
{ name="Lukas Chrostowski", email="[email protected]" },
]
Expand Down

0 comments on commit f535f3a

Please sign in to comment.