KLayout netlist format

Hi (Matthias),
I'm about to use KLayouts netlist data structures to go wild with it. Sofar I read structural verilog (which comes from the synthesizer) into my own netlist data structure but now I'd like to use KLayout netlists to make things more interoperable in future. However, I could not yet figure out how I can store the direction of a pin. This information would be helpful at latest for the routing. Do you see an easy way to associate I/O direction or other data with circuits and pins? (For now I think I will just use Python dictionaries that map pins to custom attributes.)



  • I think user defined attributes would also be helpful for SubCircuits. This would allow for instance to do an easy mapping from the netlist to layout.

  • Hi Thomas,

    Took me slightly more than half an hour, but you see the trial version in "netlist_properties" branch.

    Use is like:

    # set a property:
    obj.set_property(key, value)
    # get a property
    obj.property(key)   -> value

    "key" and "value" can be any "normal" type (string, integer, ...). A non-exisiting key gives value None (or nil). Setting this value will erase the key.

    "obj" can be a Circuit, a Pin, a Device, a Net or a SubCircuit.

    The properties are currently not persisted (written to l2n DB or netlist file). And the implementation needs to be slightly more efficient in terms of memory (I shall use a map pointer rather than a map).

    Best regards,


  • Great! Thank you so much! :) I will build and try now.

  • Hmm... Somehow it does not yet work for me. Neither from within the Klayout console nor the Python API. Did you push everything? Maybe it's just too late night now and too much wine while waiting for gcc ;)

  • Sorry, sorry ... wrong push :(

    Now it should be there!


  • No problem! :)

  • I have enhanced the solution somewhat:

    • Less memory overhead when not using the properties
    • The properties are persisted in L2N, if you want to write that to a file
    • Properties are also written to layout in LayoutToNetlist#build_nets ... maybe that is going to enable interesting applications

    Best regards,


Sign In or Register to comment.