Copying of pcell content issues

Noticed unexpected behavior when copying cells containing PCells. In the worst case, some layout content (structures and layers) is missing after the copy operation.

The test file is a GDS containing a top cell and several sub-cells, including both standard cells and PCells. The maximum hierarchy depth is 3.

Test Cases

1) Using Cell Copy into a New Layout

  • Right-click on a cell -> Copy -> Deep Copy
  • Create a new layout
  • Paste the copied cell into the new layout

=> PCell content is not copied.

2) Using Cell Copy within the Current Layout

  • Right-click on a cell -> Copy -> Deep Copy
  • Paste the copied cell

=> Newly added standard cells receive a "$1" suffix.
=> Newly added PCells are not copied. They do not receive the "$1" suffix and remain referenced to the source cells.

3) Selecting All Shapes

  • Draw a selection box around the layout while KLayout is in "Select Mode"
  • Press [CTRL]+C (Copy) or [CTRL]+X (Cut, all shapes disappear)
  • Create a new layout
  • Press [CTRL]+V (Paste) in the new layout

=> PCell content is not copied.

Observations

  • Flattening the layout preserves the PCell content (although the resulting cell is, of course, flattened).
  • KLayout 0.26.x does not show this behavior. All three test cases work as expected in that version. The results were verified using an external XOR tool.
  • Newer KLayout versions provide the option:
    File -> Setup -> Application -> Selection -> "PCell content is selectable"
    (disabled by default).

  • When this option is enabled, it becomes possible to select and copy PCell geometry as described in Test Case 3.

  • However, the procedure described in Test Case 1 still does not copy the PCell content.

Has anyone observed the same behavior?
Is this a known bug?

Comments

  • Hello,

    I'm not sure what you mean by PCell content... When I copy a cell, I want all internal references to PCells to be kept with same the parameter settings... That's exactly what happens in cases 1-3 above (0.30.9)... You can convert PCells to static cells before doing the copy, then the copies of these cells are indeed real copies/duplicates but you loose the PCell format...

    Cheers,

    Tomas

  • Hi Tomas,

    thanks for the reply.

    I may have used the term "PCell content" ambiguously.

    What I mean is the following:

    • When a cell containing PCells in its hierarchy is copied into a new layout (Case 1), all copied PCells are empty. The PCell instances are present, but their generated geometry is missing.
    • In Case 1, the copied hierarchy is pasted into a completely new layout/GDS. Since there are no name conflicts, no "$1" suffix is expected or required.
    • In Case 2, the cell is copied and pasted into the same layout. In this situation, KLayout normally performs a hierarchy duplication and appends a "$1" suffix to the copied cell names to avoid name conflicts.
    • For regular cells, this is exactly what happens: the complete hierarchy is duplicated and the newly created cells receive the "$1" suffix.
    • For PCells, however, the behavior is different. The PCells do not receive the "$1" suffix and remain references to the original PCells instead of being duplicated as part of the Deep Copy operation.

    My expectation for Deep Copy is that the complete hierarchy below the selected cell is copied. Whether the destination is a new layout (Case 1) or the same layout (Case 2), the result should be a fully self-contained copy of the hierarchy. The only difference should be that, in Case 2, the copied cells need a "$1" suffix to avoid name conflicts.

    This is also why I suspect a regression. With KLayout 0.26.x, all three scenarios produced the expected result. The copied hierarchy was complete, including the geometry generated by the PCells.

    Am I misunderstanding the intended behavior of "Deep Copy", or has the handling of PCells changed in newer KLayout versions?

    Regards,
    M.

  • Hello,

    I don't see any empty PCells in version 0.30.9, all 3 cases work as intended with respect to PCell references...

    PCells are generated by code so you cannot just get copies/duplicates of them during a deep copy. Therefore, PCells will never get a "$1" suffix, unless you convert them to regular/static cells first before doing the deep copy (Edit > Selection > Convert To Static Cell)...

    Cheers,

    Tomas

  • Hi @Signal23,

    there is no known bug here.

    I'd really appreciate if you could provide a working test case that allows reproducing the problem. It's very hard to guess what you are really doing. Specifically, as a PCell's behavior heavily depends in it's implementation which may be flawed. There are hundreds of possible ways how this could go wrong. For example, your library may be tied to a technology and it is not available in the new layout you create, because that uses a different technology.

    You're also not saying which is the version you're using. 0.26.x is very old.

    Regarding 2.): copies of library references don't receive the "$x" disambiguator even in deep copy mode, because they are essentially the same cell. You cannot go into that cell and change it, so a deep copy is not required. Yet you can change the PCell parameters of one cell which will make a PCell reference a new cell.

    Regarding 3.): Have you enabled "Select top level objects" in the "View" menu? If not you will get a mix of shapes and instances, including

    And finally regarding "PCell content is selectable": you can use that option to copy out PCell content to a different place. But only the shapes. And that of course does not preserve the PCell itself.

    I have attached a sample file that uses PCells from the Basic library. I am not able to reproduce the problems you describe with that file. For example, I can copy the "TOP" or "C" cells into a new layout in "deep" mode without loosing the PCells.

    Matthias

Sign In or Register to comment.