L-Edit-like tcells

edited August 2011 in General
I'm coming from L-Edit and trying to switch to KLayout. One feature I miss from L-Edit is the ability to create so-called TCells, which are basically cells that contain macro code to generate new instances of themselves with different sets of parameters. It doesn't seem that KLayout has anything quite like this built in, though I'm sure the automation interface is flexible enough to make it happen. Is anyone familiar with this feature from L-Edit? Anyone have any thoughts or hints about implementing something similar in klayout? Thanks for the help.


  • edited 1:55PM


    right now, there is nothing like a TCell/PCell available. This does not mean that it's impossible (actually the basics are already there). I agree that such a feature is very useful however. A basic problem is the GDS format which does not support storage of meta information such a cell parameters and similar. I have to find a way to store that information within GDS in a way compatible with other tools.

    I workaround for that lacking feature is to use Ruby scripts to generate layout but that's not very convenient.

    Best regards,


  • edited 1:55PM
    Thanks for the info Matthias. I would be fine with storing cell generation code and instance parameters in auxiliary files, as long as klayout can get to them. My idea would be to have TCell instances be tagged with a special name which identifies them as TCell instances. For example, suppose you have a layout "my_layout" and a TCell called "my_cell"; instances of that TCell would be named something like "my_cell$$1", "my_cell$$2", etc. One would then need two auxiliary files, one containing code, e.g.

    <file: my_layout.tcells.rb>
    def my_cell(length, width)
    # create geometry here

    <file: my_layout.tparams.rb>
    my_cell = {
    1 => [240, 120],
    2 => [50, 50]

    There are lots of details here that could be changed. For example, tcells should probably be classes, rather than functions, and the format of parameters storage could be some flattened format, rather than a bunch of ruby dicts as shown, but that's the basic idea. You'd then want a set of helper macros in klayout that would read these files associated with a given layout and use them to generate and regenerate tcell instances as needed.

    Any thoughts?
  • edited 1:55PM


    basically, KLayout already has some code which provides a basis for programmable cells. Technically speaking, such a cell is specialization of a particular class, providing the layout generation code and some methods to store and manage arbitrary parameter sets. In addition to the implementation class, a factory singleton must be provided that allows KLayout to instantiate such a cell and declares parameters for example.

    I have also already a scheme which allows to store the parameters of a programmable cell within GDS (using a dummy cell as the container for the required meta information). Without that, I would not be possible to save the cell parameters.

    It's possible to provide several ways to implement a programmable cell, all based on the implementation class. It can be done at least using Ruby or C++ compiled into shared objects. That's at least the plan.

    Right now, the infrastructure for the management of libraries in general is missing. Currently, a layout object is a standalone entity and does not have links to other entities such as libraries. I am currently preparing a new major release in which I wanted to include libraries and in consequence programmable cells. But doing that in my spare time I currently can't state a time frame for that feature.

    Best regards,


  • edited 1:55PM
    Hello Matthias, all

    Any news about this Tcell/Pcell and libraries things ?

  • edited March 2012

    Hi Joel,

    I am currently implementing PCell's. It will be possible to write PCell's using the build-in Ruby language binding. A basic PCell library will be included that offers polygon texts and certain circular objects (arcs, circles etc.).

    Right now the implementation is fairly stable. If you are on Linux you can test the current version with the development snapshot available here: http://www.klayout.de/klayout-r1134.tar.gz.

    The new features may need some explanation. However, you can readily use the PCell feature by creating an instance of the cells inside the "Basic" library. Just create an instance as usual and select the library from the new drop-down list right to the cell name.

    Best regards,


  • edited 1:55PM
    Hi Matthias,

    Nice news :-)
    I will do a trial on this release once my linux station will be up again.
    Best Regards
Sign In or Register to comment.