# Reusing cells in circuits¶

In this section we explain how to build a new cell in L-Edit, that can be reused in user designs.

Note

The final designs for this tutorial can be found in the library tutorial_hierarchy, inside samples\demo\projects\my_designs_oa in your installation folder. The library tutorial_hierarchy will be visible in the Libraries tab in L-Edit after loading my_designs_oa.

We will go through the following steps:

1. Create a new design MZI in the design_switch library
2. Instantiate a splitter and combiner
3. Draw waveguides between the splitter and combiner
4. Propagate the unconnected ports (the input of the splitter, the output of the combiner)
5. Create a new design test_design_mzi
6. Instantiate several MZI components and grating couplers, draw waveguide routes
7. Finish by generating the waveguides

The crucial step here is step 4: this ensures that the unconnected ports are recognized in step 6. If you are routing waveguides, there always has to be a port defined.

## Create the MZI design¶

1. Create a new design MZI
2. Instantiate a splitter and combiner

We start by creating an MZI cell in the design_switch library (see figures below).

In the design_switch library, create a new cell called MZI.

Instantiate a splitter (one for splitting, one for combining).

Place, align and mirror the components.

Rename the first splitter to splitter, rename the second to combiner.

We generate the waveguide control shapes, and generate the waveguides, as shown in Figure and Figure.

1. Draw waveguides between the splitter and the combiner

Draw the waveguide control shapes on the SI:TRC layer.

Generate the waveguides (from menu bar, Luceda ‣ Waveguides ‣ Generate all waveguides)

To finalize our component, we need to ensure the unconnected ports are duplicated in the top-level design. That way, we will be able to use these ports in other designs as well. To do so, we use the Propagate ports function from the Luceda menu.

1. Propagate the unconnected ports

Propagate the ports (from menu bar, Luceda ‣ Connection ‣ Propagate ports).

## Create the test design¶

1. Create a new design test_design_mzi
2. Instantiate several MZI components and grating couplers, draw waveguide routes

We now create a test design, in which we cascade three MZI components. We then connect them to two fiber couplers (Figure).

Create a design test_design_mzi, place three cascaded MZI components, two fiber grating couplers and draw the connecting wires.

We are now ready to finalized the design by connecting the fiber couplers to the MZIs, and the MZIs themselves with waveguides. The final result is shown below (Figure).

1. Finish by generating the waveguides

Finished design after generating the waveguides.

## Conclusion¶

In this short tutorial you learned how to create a cell in L-Edit, which can be reused in other designs. This method is very powerful because it allows cell reuse and allows to manage design complexity by splitting your design in smaller chunks that are easier to understand. Note that in this case, the created MZI is a fixed cell. If you want to make parametric cells, we suggest to have a look at IPKISS PCells.