cell.bbox in DRC

edited December 2019 in KLayout Support

How to use the cell.bbox in a DRC file ?

nwell = input (1,0)
cellBulk = RBA::CellView::active.cell.bbox
pwell = cellBulk - nwell

But, the last command does not work, because I cannot mix a bbox with a polygon.
Here, I cannot use make_polygon : I need it for the extraction of NMOS in triple well.

Thank you,

Laurent

Comments

  • Hi Laurent,

    the "extent" function will simply return the bounding box of the input layout:

    nwell = input(1,0)
    cellBulk = extent
    pwell = cellBulk - nwell
    

    (you just need to be careful not to define a layer with this name).

    Best regards,

    Matthias

  • Thank you Matthias.

    I tried it, but it is not compatible with deep (hierarchical) extraction. I works for a simple cell without hierarchy, but find different nets at higher level. The solution I use so far is a boundary layer for all cells including a device, and no boundary for the cells that only include cells.

    cellBulk = input(100,0)   # Boundary layer
    nwell = input(1,0)
    tpwell = input(2,0)   # Triple well layer
    #cellBulk = extent
    
    bulk    = cellBulk  - tpwell - nwell
    pwell  = (cellBulk - nwell) + (tpwell - nwell)
    

    I need to add (tpwell - nwell) because the tpwell is surrounded by nwell and then excluded from the cellBulk.

    Laurent

  • Hi Laurent,

    That's right, unfortunately :(

    Unfortunately, an hierarchical cell extension is difficult to do as you cannot easily tell what the cell's true boundary is and how it is to be distributed on parent and child cells. This might be a box - but that could be any shape shape too.

    The solution I have found for this issue is this: you might be interested in the "bulk" as such, but usually you would just need it to connect something to. That is probably some bulk contact. So let's say, you have a pplus layer which acts as the bulk contact within bulk, but not within tpwell or nwell, you would define a "bulk_diode" layer like this:

    bulk_diode = pplus - nwell - tpwell
    

    Later you'd connect these markers to the "BULK" global net, i.e.

    connect_global(bulk_diode, "BULK")
    

    So instead of creating a layer for bulk, you create a net for it.

    Would this solve your problem?

    Best regards,

    Matthias

  • Hi Matthias,
    Sprry to bother you.
    I just have a simple question about "extent" function.
    I make a boundry box but the texts are counted in.
    Could I use "extent_refs" ?

  • @Liyuan,

    Yes, texts are counted too.

    But only, if you use "input" to read a layer. If you use "polygons" instead, the layer will not contain the texts. In the same fashion, when you use "labels", the layer won't contain polygons.

    Matthias

  • @Matthias
    I draw two box in layer 0 and layer 1 and use a text in layer 2 to test the "extent"
    the codes is in below,
    my_layer1 = polygons
    my_layer1 = extent
    my_layer1.output(3,0)
    but I still find the text is included.
    Should I create the box by polygons when I draw it?
    sorry to cause your inconvenience and thanks for your kindly help.

  • That is because "extent" without a layer is a global bounding box and this will always include all objects, texts included.

    I meant you should take the bounding box of some polygon layer. Usually there is some design layer defining the chip extents. Assuming that is layer 10/0, you can get the bounding box using:

    bbox = polygons(10, 0).bbox
    
    # create a layer with the bounding box
    bbox_layer = polygon_layer
    bbox_layer.insert(bbox)
    
    ...
    

    Matthias

  • @Matthias
    Got it, thank you.

Sign In or Register to comment.