Create a new IPKISS design project

This short tutorial will teach you how to set up a project with PyCharm and gives some suggestions on how to organize it. These suggestions aim to make the design team work together effectively by using a consistent folder structure, making it easy to share components, designs and algorithms. In the end you will have a clean environment to work in that can serve as a good starting point for your own projects.

Configuring PyCharm

PyCharm has a built-in project manager that we can use to create IPKISS design projects. The instructions below are for recent (2023.3.4 and newer) PyCharm versions.

If this is the first time opening PyCharm, you will be greeted by this window:

First time opening PyCharm. Choose 'New project'.

This window is shown when opening PyCharm for the first time. Select ‘New project’.

Alternatively, if you are in the main PyCharm window, select File ‣ New Project:

Create a new project using File --> New Project

Create a new project using File ‣ New Project.

In the “New Project window”, choose a new folder for your design and check “Custom environment”, then check “Select existing”, and type “Conda”, finally choose the “ipkiss3” environment:

Create a new project, select an existing Python interpreter.

Creating a new project and selecting an existing Python interpreter.

There are two situations now (also shown in the image above):

  1. If you have already set up an IPKISS Python interpreter before, you may find it in the list of interpreters. In that case, you can proceed to the section below on adding a PDK to the project.

  2. The IPKISS interpreter is not shown in the list of existing interpreters. In that case, click “Reload environments”. Reloading the environments will update all the environments that are registered with conda. If the environment still does not show up, you might need to reinstall the software to have it register itself with conda.

Changing or updating the environment after the project is created is possible via the project settings File ‣ Settings ‣ Project: MyProject ‣ Python interpreter.

New Python interpreter page: select 'Interpreter'.

In the ‘Python interpreter’ page, select the ipkiss3 environment if it is already available or add it through Add Interpreter.

If the interpreter is already present, you can select it and press OK.

New Python interpreter page: select 'Conda Environment' and select the conda executable.

On the ‘add Python Interpreter’ page, select Conda Environment.

To add a new interpreter, click on ‘Add Interpreter’ and go to the ‘Conda Environment’ tab of the window that is opened. Here you should select the conda executable that comes with the IPKISS installation, navigate to C:\luceda\ipkiss_<version>\python\env\conda.exe.

When you have selected the correct conda executable, press the ‘Load Environments’ button. Next make sure the ‘use existing environment’ radial is checked and select the ipkiss3 environment from the dropdown box.

Note

You can also use a system-wide install of conda if it is configured correctly. When doing so, verify the version of the ipkiss3 environment by checking the path.

After the main PyCharm window opens, let’s add a PDK to the project.

Note

You can also open an existing folder or project (File ‣ Open…). When a folder is first opened, an .idea folder is created which stores project settings. If you open the same folder at a later moment, the project settings are remembered.

Adding a PDK

We illustrate the process using si_fab, a sample PDK included with Luceda Academy, but the principle is the same for all PDKs supported by Luceda. First, copy-paste the PDK that you received in a new folder named ‘pdks’.

Add a PDK to your project.

Add the si_fab PDK to your project.

Now we have to edit the PYTHONPATH to let Python know where to look for the PDK. Go to File ‣ Settings ‣ Project: <Your project name> ‣ Project Structure. Navigate to the ipkiss folder inside the PDK and mark it as source. The folder should turn blue.

Add PDK to the project structure.

Add the si_fab PDK to PYTHONPATH.

You can also add this through the right click menu.

Or add the si_fab PDK to PYTHONPATH through the right click menu.

Note

The si_fab pdk requires an extra dependency called additional utils that needs to be included in the PYTHONPATH as well. Click Add Content root (see figure above) and select the additional utils folder you find in Luceda Academy.

Finally, whenever you make a new design, import the PDK before you import IPKISS:

import si_fab.all as pdk
import ipkiss3.all as i3

Most PDKs have examples stored in them, so let’s run a sample to verify that everything is set up properly. Here, we run pdks/si_fab/ipkiss/si_fab/components/phase_shifter/doc/example_phase_shifter.py:

Choose a file from the samples and run it.

Choose a file from the samples and run it.

Note

You should never modify the files inside your PDK because it constitutes the foundation of all your designs. Tampering with it can result in unexpected behavior or invalid designs. Instead, create a new library where you add new components, technology settings and so on.

Adding a user library

Libraries contain reusable components built on top of a PDK. You can easily import an existing library by following the same steps as adding a PDK: create a libraries folder in your project, paste in the library and include its ipkiss folder in your PYTHONPATH.

If instead you want to create new components and design a library from scratch, have a look at Develop and distribute your component library A convenient way to start is to copy pteam_library_si_fab from Luceda Academy and rename / refactor its contents to fit your needs.

You may also refer to Library Organization in the documentation to find more explanations on the library structure and its content.

Add a library to your project.

Add a library to your project.

Creating a new design

At this point everything is set up and we are ready to create a design that can include both PDK and library components. The final result of the design process (tape-out) is a GDS file that the foundry uses to manufacture a photonic integrated circuit.

We will start by creating a designs folder and choosing a clear name for our tapeout that contains the date and the name of the PDK being used, e.g. 202208_tapeout_si_fab. Every design will be placed in here, each with its own regeneration file to generate a GDS. The tapeout folder then contains a merging script to combine all the designs into one. A basic example of such a file structure is shown below:

Typical folder structure to organize designs.

Typical folder structure to organize designs.

For a more in-depth tutorial on organizing designs, have a look at Several contributions to one tape-out run.