Connectivity / Device extraction - "get_texted"?

Thinking ahead to trying to LVS something, I am curious about device recognition. I have a plurality of different NPN transistor layouts - lateral and vertical, with and without collector ring, etc. Fewer PNPs, but several styles - lateral, substrate. My question regards the facilities for assigning the netlist model to a "found device instance". Unlike vanilla CMOS where there's two device types varying only in W, L, M, here I need to assign the correct model to a device which may vary by features, but not in a very nice "boolean logic friendly" way.

In a previous life I worked with similar issues, but Cadence Diva extract and DRC both understood a get_texted(shape_layer, text_to_match) function which would let you "tag" any polygon at any level with a text that can define what it's for.

So for example I might want to make a transistor with "NPN_cbe_1X" text inside the "TANK" rectangle, be recognized and its model assigned to "NPN_cbe_1X" SPICE model, while another with a ring collector and different layout has "NPN_rceb_1X" and would see the model reference for "NPN_rceb_1X" written to the netlist instead.

Very much easier than trying to express by Boolean logic whether the device has or has not the ring collector, the order of its emitter and base contacts relative to collector(s), the size and so on. Does such a capability exist? I gather that the LVS (connectivity extract) is somewhere in the development phase and documentation, probably further back in the weeds. I did not find more than a half-page description of connectivity with only the simplest operators mentioned.

If there is a function that works like this I'd like to know where to find primers / manuals / anything about it.

If there isn't, I'd like to encourage its addition to the extract / DRC toolbox; it's also handy for applying device-specific layout rules.


  • Hi,

    I'm working on a documentation currently and want to release it asap. I'm aware that without such a manual trying the feature is tedious.

    Thanks for the input about "get_texted". I think this is available, but I need to try it before I can confirm that.

    To sketch the basic idea: KLayout works on the basis of layers. For bipolar devices you need three or four layers: E, B, C and substrate (optional). When all three layers are present on some area defined by shapes on the base layer, a device is created. You can define multiple recognition steps each producing a different device class (or model).

    So you can basically select shapes from the base layer having a certain label on it and use these in the recognition for a certain device type.

    Here is the idea:

    # here is where the labels are
    labels = input(1, 0)
    # select labels "npn1" and "npn2"
    npn1_texts = labels.text("npn1")
    npn2_texts = labels.text("npn2")
    emitter = input(2, 0)   # or created by booleans
    base = input(3, 0)  # or created by booleans
    collector = input(4, 0)   # or created by booleans
    # extract BJT (3 terminal) devices using emitter, base_npn1, collector
    # as model "npn1"
    base_npn1 = base.interacting(npn1_texts)
    extract_devices(bjt3("npn1"), { "E" => emitter, "B" => base_npn1, "C" => collector })
    # extract BJT (3 terminal) devices using emitter, base_npn1, collector
    # as model "npn2"
    base_npn2 = base.interacting(npn1_texts)
    extract_devices(bjt3("npn2"), { "E" => emitter, "B" => base_npn2, "C" => collector })


  • This looks like it performs the desired function, so great.

    A secondary question might be, does the ".intersecting" look at the text origin only, or the "plotted extent" of the label?

  • Hi Jim,

    In Klayout, a text is always just a point, never the "plotted size". It's too dependent on font details and there even is a font that doesn't scale.

    Actually a "point" cannot done for internal reasons, but it will be 2x2DBU - so hopefully "pointlike" enough as the DBU is usually much smaller than any design rule dimension.


Sign In or Register to comment.