Editing Library Cells without Converting to Static Cell

Hi All,

I have been trying to edit library cells on a separate .gds file (not on the actual .gds file of the library cell) and it seems like Klayout does not allow me to do so unless I convert that specific library cell into a static cell. However, that would change the cell instance name of my library cell and it would also not update my library cell in its own .gds file if I make any changes in that new static cell. This might have been asked already, but is there a way that I can edit my library cells at different files without converting my library cells into static cells?

The reason I want to do that is because it would be really helpful and less difficult to edit library cells in a separate file that uses these library cells. That way, I can see how my library cells are used and fitted into my design and I can adjust the dimensions and other properties of my library cells accordingly.

Here’s an example to illustrate my problem:

Suppose I am editing this test.GDS file and I inserted the cell “M1G1” from file M1G1.gds, which is not created inside test.GDS.

I have also included the M1G1.gds file in the ruby script:

The problem is when I descend (or “Show As New Top”) into my “M1G1” cell from M1G1.gds, I am not allowed to edit that cell:

The only possible ways are to edit “M1G1” inside the file M1G1.gds or convert my “M1G1” cell as a static cell inside test.gds:

If I convert my “M1G1” cell into a static cell, the cell instance name will change,

and any change I made inside my new “M1G1$2” static cell will not get updated to M1G1.gds.

Lastly, if I overwrite my new “M1G1$2” static cell into the M1G1.gds file, I would get something like this if I open M1G1.gds:

I would get a cell instance name of “M1G1$2” instead of “M1G1” that I used to have.

In the end, is there a way that I can edit my library cells at different files without converting my library cells into static cells?

Sorry for the long post and thank you very much!



  • Hi Yoyo,

    thanks for this well illustrated post :-)

    Basically the idea of a library is that you instantiate something from an external source. As part of this concept, the external source is immutable.

    In short: only what is inside the current layout is editable, external content isn't.

    I think that allowing to edit a library would spoil tracebility of changes. Imagine a library is used by many projects and installed centrally - editing it would modify other's work in unpredictable ways. So libraries are taken as read-only.

    This is specifically true if you have PCells in your library. In this case, edits cannot happen as the layout is produced by code, not drawn. Every re-execution of the code would overwrite any changes.

    You can only edit the layout of a library cell and/or PCell if you disconnect the cell from it's external origin. This is what "convert to static" does: it will copy over the current layout from the PCell or library into the local layout and remove the link. After this operation you can edit the cell but not backannotate these changes into the library. In order to edit the library you have to modify (and ideally version control) the sources of this library: the library GDS file in case of static libraries or the PCell code in case of PCells.

    Does this explanation help you?

    Kind regards,


Sign In or Register to comment.