Associating cell instances with SubCircuits of the netlist (netlist_properties branch).

I'm trying to implement a simple place & route framework on top of KLayout.
Now I'm looking for a good way to make a link from cell instances to their corresponding parts in the netlist. I thought of using .set_property() to associate the db.CellInstArray with the ID of the corresponding db.SubCircuit. However, .set_property seems not to be defined for this class.
How could I do this?
Is there something from the LVS classes that I could use from Python? I guess there must be something to relate layout and netlist.



  • Hi Thomas,

    The object kept inside the layout database is an Instance object. CellInstArray is the "working object" similar to "Polygon", which you can use as independent objects in your code. "Instance" is the placeholder in the database, similar to "Shape" which acts as a gateway to the database.

    Typically you do something like:

    ly = pya.Layout()
    cell = ly.create_cell("THE_CELL")
    child_cell = ly.create_cell("THE_CHILD_CELL")
    ia = pya.CellInstArray(child_cell.cell_index(), pya.Trans(1000, 2000))
    # or in µm coordinates:
    # ia = pya.DCellInstArray(child_cell.cell_index(), pya.DTrans(1.0, 2.0))
    # Add the CellInstArray object to the database and receive an Instance object
    instance = cell.insert(ia)
    # Now we can set properties on the Instance
    instance.set_property(42, "The answer")


  • Ahhh, nice! Thanks! I will try that :)

Sign In or Register to comment.