Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make CORNERSTONE package support all the different pdks #29

Merged
merged 6 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions .github/write_components_plot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import inspect

from cspdk import _cells as cells
from cspdk.config import PATH
from cspdk.si220 import _cells as cells
from cspdk.si220.config import PATH

filepath = PATH.repo / "docs" / "cells.rst"

Expand All @@ -15,10 +15,7 @@
f.write(
"""

Here are the components available in the PDK


Cells
Cells Si220
=============================
"""
)
Expand All @@ -43,7 +40,7 @@
{name}
----------------------------------------------------

.. autofunction:: cspdk.cells.{name}
.. autofunction:: cspdk.si220.cells.{name}

"""
)
Expand All @@ -54,14 +51,14 @@
{name}
----------------------------------------------------

.. autofunction:: cspdk.cells.{name}
.. autofunction:: cspdk.si220.cells.{name}

.. plot::
:include-source:

import cspdk

c = cspdk.cells.{name}({kwargs})
c = cspdk.si220.cells.{name}({kwargs})
c.plot()

"""
Expand Down
42 changes: 0 additions & 42 deletions cspdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,42 +0,0 @@
from gdsfactory.cross_section import get_cross_sections
from gdsfactory.get_factories import get_cells
from gdsfactory.pdk import Pdk

from cspdk import cells, config, tech
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Missing tests for new module structure.

The PR introduces a new module structure under 'cspdk.si220'. It's crucial to add tests to verify that the new imports and module paths are correctly set up and functional.

from cspdk.cells import _bend, _straight, _taper
from cspdk.config import PATH
from cspdk.models import get_models
from cspdk.tech import LAYER, LAYER_STACK, LAYER_VIEWS, routing_strategies

_models = get_models()
_cells = get_cells(cells)
_cells.update(
{
"_straight": _straight,
"_bend": _bend,
"_taper": _taper,
}
)
_cross_sections = get_cross_sections(tech)
PDK = Pdk(
name="cornerstone",
cells=_cells,
cross_sections=_cross_sections,
layers=dict(LAYER),
layer_stack=LAYER_STACK,
layer_views=LAYER_VIEWS,
models=_models,
routing_strategies=routing_strategies,
)
PDK.activate()

__all__ = [
"LAYER",
"LAYER_STACK",
"LAYER_VIEWS",
"PATH",
"cells",
"config",
"tech",
]
__version__ = "0.7.0"
42 changes: 42 additions & 0 deletions cspdk/si220/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from gdsfactory.cross_section import get_cross_sections
from gdsfactory.get_factories import get_cells
from gdsfactory.pdk import Pdk

from cspdk.si220 import cells, config, tech
from cspdk.si220.cells import _bend, _straight, _taper
from cspdk.si220.config import PATH
from cspdk.si220.models import get_models
from cspdk.si220.tech import LAYER, LAYER_STACK, LAYER_VIEWS, routing_strategies

_models = get_models()
_cells = get_cells(cells)
_cells.update(
{
"_straight": _straight,
"_bend": _bend,
"_taper": _taper,
}
)
_cross_sections = get_cross_sections(tech)
PDK = Pdk(
name="cornerstone",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is no longer a good, distinctive pdk name. what if we make it mirror the package name, i.e. cspdk.si220?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, fixed now, i named it cornerstone_si220, cornerstone_sin300 ... and so on

cells=_cells,
cross_sections=_cross_sections,
layers=dict(LAYER),
layer_stack=LAYER_STACK,
layer_views=LAYER_VIEWS,
models=_models,
routing_strategies=routing_strategies,
)
PDK.activate()

__all__ = [
"LAYER",
"LAYER_STACK",
"LAYER_VIEWS",
"PATH",
"cells",
"config",
"tech",
]
__version__ = "0.7.0"
4 changes: 2 additions & 2 deletions cspdk/cells.py → cspdk/si220/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import gdsfactory as gf
from gdsfactory.typings import ComponentSpec, CrossSectionSpec, LayerSpec

from cspdk.config import PATH
from cspdk.tech import LAYER, xs_nc, xs_no, xs_rc, xs_ro, xs_sc, xs_so
from cspdk.si220.config import PATH
from cspdk.si220.tech import LAYER, xs_nc, xs_no, xs_rc, xs_ro, xs_sc, xs_so

################
# Straights
Expand Down
2 changes: 1 addition & 1 deletion cspdk/config.py → cspdk/si220/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
cwd = pathlib.Path.cwd()
cwd_config = cwd / "config.yml"
module = pathlib.Path(__file__).parent.absolute()
repo = module.parent
repo = module.parent.parent


class Path:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sax

import cspdk
from cspdk import PDK
from cspdk.si220 import PDK

if __name__ == "__main__":
c = cspdk.cells.mzi_sc(delta_length=100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import matplotlib.pyplot as plt
import sax

import cspdk
from cspdk import PDK
from cspdk.si220 import PDK, cells, tech

if __name__ == "__main__":
c = gf.Component()
mzi1 = c << cspdk.cells.mzi_sc(delta_length=10)
mzi2 = c << cspdk.cells.mzi_sc(delta_length=100)
mzi1 = c << cells.mzi_sc(delta_length=10)
mzi2 = c << cells.mzi_sc(delta_length=100)
mzi2.move((200, 200))
route = cspdk.tech.get_route_sc(mzi1.ports["o2"], mzi2.ports["o1"])
route = tech.get_route_sc(mzi1.ports["o2"], mzi2.ports["o1"])
c.add(route.references)
c.add_port(name="o1", port=mzi1.ports["o1"])
c.add_port(name="o2", port=mzi2.ports["o2"])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sample_pads = """
name: pads
pdk: cspdk
pdk: cspdk.si220

instances:
bl:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import gdsfactory as gf

import cspdk
from cspdk.si220 import cells, tech

if __name__ == "__main__":
c = gf.Component("sample_connect")
mmi1 = c << cspdk.cells.mmi1x2_nc()
mmi2 = c << cspdk.cells.mmi1x2_nc()
mmi1 = c << cells.mmi1x2_nc()
mmi2 = c << cells.mmi1x2_nc()
mmi2.move((500, 50))

route = cspdk.tech.get_route_nc(
route = tech.get_route_nc(
mmi1.ports["o3"],
mmi2.ports["o1"],
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cspdk/tech.py → cspdk/si220/tech.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from gdsfactory.technology import LayerLevel, LayerMap, LayerStack, LayerViews
from gdsfactory.typings import ConnectivitySpec, Layer

from cspdk.config import PATH
from cspdk.si220.config import PATH

nm = 1e-3

Expand Down
Loading
Loading