From e3ae612981a87d895c15da084f8ad4d21665000c Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Tue, 18 Jul 2023 05:40:50 +0200 Subject: [PATCH] add cells --- .github/write_cells.py | 69 ++++++++++++++++++++++ docs/_toc.yml | 1 + docs/cells.rst | 126 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+) create mode 100644 .github/write_cells.py create mode 100644 docs/cells.rst diff --git a/.github/write_cells.py b/.github/write_cells.py new file mode 100644 index 0000000..8ef7377 --- /dev/null +++ b/.github/write_cells.py @@ -0,0 +1,69 @@ +from typing import Tuple +import inspect +from gvtt.config import PATH +from gvtt import cells + + +filepath = PATH.repo / "docs" / "cells.rst" + +skip = {} + +skip_plot: Tuple[str, ...] = ("add_fiber_array_siepic",) +skip_settings: Tuple[str, ...] = ("flatten", "safe_cell_names") + + +with open(filepath, "w+") as f: + f.write( + """ + +Here are the components available in the PDK + + +Cells +============================= +""" + ) + + for name in sorted(cells.keys()): + if name in skip or name.startswith("_"): + continue + print(name) + sig = inspect.signature(cells[name]) + kwargs = ", ".join( + [ + f"{p}={repr(sig.parameters[p].default)}" + for p in sig.parameters + if isinstance(sig.parameters[p].default, (int, float, str, tuple)) + and p not in skip_settings + ] + ) + if name in skip_plot: + f.write( + f""" + +{name} +---------------------------------------------------- + +.. autofunction:: gvtt.components.{name} + +""" + ) + else: + f.write( + f""" + +{name} +---------------------------------------------------- + +.. autofunction:: gvtt.components.{name} + +.. plot:: + :include-source: + + import gvtt + + c = gvtt.components.{name}({kwargs}) + c.plot_matplotlib() + +""" + ) diff --git a/docs/_toc.yml b/docs/_toc.yml index 6d86a25..1e71738 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -4,4 +4,5 @@ format: jb-book root: index chapters: + - file: cells - file: changelog diff --git a/docs/cells.rst b/docs/cells.rst new file mode 100644 index 0000000..c978617 --- /dev/null +++ b/docs/cells.rst @@ -0,0 +1,126 @@ + + +Here are the components available in the PDK + + +Cells +============================= + + +bend_euler +---------------------------------------------------- + +.. autofunction:: gvtt.components.bend_euler + +.. plot:: + :include-source: + + import gvtt + + c = gvtt.components.bend_euler(angle=90.0, p=1.0, with_arc_floorplan=False, direction='ccw', with_bbox=True, cross_section='strip') + c.plot_matplotlib() + + + +die +---------------------------------------------------- + +.. autofunction:: gvtt.components.die + +.. plot:: + :include-source: + + import gvtt + + c = gvtt.components.die(size=(5000.0, 9500.0), street_width=75.0, street_length=1000.0, die_name='chip99', text_size=100.0, text_location='SW', draw_corners=True, draw_dicing_lane=True) + c.plot_matplotlib() + + + +edge_coupler_rib +---------------------------------------------------- + +.. autofunction:: gvtt.components.edge_coupler_rib + +.. plot:: + :include-source: + + import gvtt + + c = gvtt.components.edge_coupler_rib(edge_coupling_width=3.0, polishing_length=25.0, side='W', xpos=0.0, ypos=0.0) + c.plot_matplotlib() + + + +mmi1x2 +---------------------------------------------------- + +.. autofunction:: gvtt.components.mmi1x2 + +.. plot:: + :include-source: + + import gvtt + + c = gvtt.components.mmi1x2(width_taper=1.875, length_taper=1.0, length_mmi=43.25, width_mmi=6.25, gap_mmi=1.25, with_bbox=True) + c.plot_matplotlib() + + + +mmi2x2 +---------------------------------------------------- + +.. autofunction:: gvtt.components.mmi2x2 + +.. plot:: + :include-source: + + import gvtt + + c = gvtt.components.mmi2x2(width_taper=1.875, length_taper=1.0, length_mmi=112.0, width_mmi=5.0, gap_mmi=1.25, with_bbox=True) + c.plot_matplotlib() + + + +rib_taper +---------------------------------------------------- + +.. autofunction:: gvtt.components.rib_taper + +.. plot:: + :include-source: + + import gvtt + + c = gvtt.components.rib_taper(width1=1, width2=1, taper_ratio=50.0) + c.plot_matplotlib() + + + +rib_to_strip +---------------------------------------------------- + +.. autofunction:: gvtt.components.rib_to_strip + +.. plot:: + :include-source: + + import gvtt + + c = gvtt.components.rib_to_strip(length=200.0, width1=3.0, width2=3.0) + c.plot_matplotlib() + + + +strip_taper +---------------------------------------------------- + +.. autofunction:: gvtt.components.strip_taper + +.. plot:: + :include-source: + + import gvtt + + c = gvtt.components.strip_taper(width1=1, width2=1, taper_ratio=25.0) + c.plot_matplotlib()