Step 4: Simple layout: First GDSII

Result

In this example we add shapes on GDSII-layers to compose a real layout of the ring resonator defined in the previous steps and export the layout to GDSII.

Ring resonator

A layout of a ring resonator with the used parameters

Illustrates

  1. how to use shapes.

  2. how to use layers.

  3. how to place a shape on layer using paths.

  4. how paths can be added on a layout.

  5. how to write a layout to GDSII.

  6. how to visualize a layout.

How to run this example

To run the example, run ‘execute.py’.

Files (see: tutorials/pcell_basic/04-simple-layout)

There are two files contained in this step.

  • ring.py : which is a self-contained python file that contains a description of our ringresonator. It is imported in execute.py

  • execute.py : which is the file that is ultimately executed by python. It imports the description of the ringresonator from ring.py and performs operations on it.

Adding elements to a layout

In IPKISS the actual layout is built by adding elements to the layout view. Elements refer to objects that can be placed on a GDSII layer (see Elements for more information on the different types of elements). We add elements by defining the specific method _generate_elements.

Let’s see how this is done in practice.

class RingResonator(i3.PCell):

    #... Pcell definition omitted #

    class Layout(i3.LayoutView):

        #... properties definitions omitted #

        def validate_properties(self):
            # ....
            return True

        # This method generates the layout by adding elements to "elems"
        def _generate_elements(self, elems):
             # Here, we add the layout elements based shapes: two paths on
             # the same layer, with the right width.

             # 1. We build the ring shape and a bus shape add it to the layout elements.
             shape_ring = i3.ShapeCircle(center=(0,0), radius=self.ring_radius)
             shape_bus =  [(-self.ring_radius, -self.ring_radius - self.coupler_spacing),
                             (self.ring_radius, -self.ring_radius - self.coupler_spacing)]

             # 2. We add the shapes to elems.
             elems += i3.Path(layer=i3.TECH.PPLAYER.WG.CORE, shape=shape_ring, line_width=self.ring_wg_width)
             elems += i3.Path(layer=i3.TECH.PPLAYER.WG.CORE, shape=shape_bus, line_width=self.bus_wg_width)

             # 3. We return elems
             return elems

Let’s go over what we have done here:

  1. We have added a method _generate_elements to the layout view. This method adds layout elements to the elems array that is automatically initialized by the layoutview as an empty element array. We start by defining shapes that are composed of an array of coordinates (x,y).

    • shape_ring, a circle using ShapeCircle and by specifying the radius.

    • shape_bus just by using an array of coordinates.

  2. Now we must transform the newly defined shapes to layout elements which are objects on a GDSII layer. There are different ways of doing this. Here we chose to use Paths which are lines of a given width along a certain shape on a layer.

    Paths require 3 arguments:

    • layer: This is the GDSII layer (in fact a Process Purpose Layer). We use TECH.PPLAYER.WG.CORE wich is the default layer for waveguides.

    • shape: refers to the shape used.

    • line_width: the width of the line to be used.

  3. The method _generate_elements returns elems.

Note

the leading underscore in _generate_elements before the generate indicates that this is an internal method and that it should not be called by a user of the class. This convention is applied in many python libraries and is also used throughout IPKISS.

Visualizing and export to GDSII

Here we illustrate how to visualize the layoutview and how to export it to GSDII.

# Don't forget to import a technology first!
import si_fab.all as pdk  # noqa

# 1. load the file with our RingResonator component
from ring import RingResonator

# create a new RingResonator object
my_ring = RingResonator(name="my_unique_ring_name")

# instantiate the ring layout view.
my_ring_layout = my_ring.Layout(ring_radius=10.0)

# 2. Visualizing the layout
my_ring_layout.visualize()

# 3. Export to GDSII
my_ring_layout.write_gdsii("myring.gds")  # fast writing to GDSII
  1. We instantiate the layout view or the RingResonator and name it my_ring_layout

  2. We use the preprogrammed visualize method of the layout view to plot a matplotlib image of the layout.

  3. We also write to GDSII using the write_gdsii method of the layout_view. The .gds file is written in the folder that where python is called.

Ring resonator

Visualized ring using my_ring_layout.visualize()

Recap

Congratulations! You have now learned the fundamentals of the IPKISS architecture and are able to make elementary layouts. Of course, there is much more to discover such as how to use component hierarchy, how to use waveguides and much more. This will be the subject of Advanced layout tutorial

If you want to know more about: