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.
We will go through the following steps:
Create a new design MZI in the filters_ledit library
Instantiate a splitter and a combiner
Draw waveguides between the splitter and combiner
Propagate the unconnected ports (the input of the splitter, the output of the combiner)
Create a new design test_design_mzi
Instantiate several MZI components and grating couplers, draw waveguide routes
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
Create a new design MZI
Instantiate a splitter and a combiner
We start by creating an MZI cell in the filters_ledit library (see figures below).
![Create a new cell called `MZI`. We create it in the `filters_ledit` library.](../../../../_images/mzi1_mzi_new_cell.png)
In the filters_ledit
library, create a new cell called MZI.
![Instantiate a splitter (one for splitting, one for combining).](../../../../_images/mzi2_mzi_instantiate.png)
Instantiate a splitter (one for splitting, one for combining).
![Place, align and mirror the components.](../../../../_images/mzi3_mzi_place_align.png)
Place, align and mirror the components.
![Rename the first splitter to `splitter`, rename the second to `combiner`.](../../../../_images/mzi4_mzi_rename_instances.png)
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 Generate the waveguides and Figure Propagate the ports.
Draw waveguides between the splitter and the combiner
![Draw the waveguide control shapes on the SI:TRC layer.](../../../../_images/mzi5_mzi_connect_mzi.png)
Draw the waveguide control shapes on the SI:TRC layer.
![Generate the waveguides (from menu bar, :menuselection:`Luceda --> Waveguides --> Generate all waveguides`)](../../../../_images/mzi6_mzi_generate_waveguides.png)
Generate the waveguides (from menu bar, )
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 pins function from the Luceda menu.
Propagate the unconnected ports
![Propagate the ports (from menu bar, :menuselection:`Luceda --> Connection --> Propagate pins`).](../../../../_images/mzi7_mzi_propagate_ports.png)
Propagate the ports (from menu bar, ).
Create the test design
Create a new design test_design_mzi
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 the MZIs themselves, and connect the two of them to fiber couplers (Figure Cascaded MZI components).
![Create a design `test_design_mzi`, place three cascaded MZI components, two fiber grating couplers and draw the connecting wires.](../../../../_images/design_mzi1_pick_and_place.png)
Create a design test_design_mzi, place three cascaded MZI components, two fiber grating couplers and draw the connecting wires.
The final result is shown below (Figure Final design).
Finish by generating the waveguides
![Finished design after generating the waveguides.](../../../../_images/design_mzi2_final.png)
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.