Help needed with DRC enclosing check

edited February 15 in Python scripting

Just a question of my very simple DRC script:


# input layers
l1 = input(1, 0)
l2 = input(2, 0)

# min width checks
l1.width('l1_width', 'l1 min width violation')
l2.width('l2_width', 'l2 min width violation')

# min spacing check'l1_spacing', 'l1 min spacing violation')'l2_spacing', 'l2 min spacing violation')

# enclosing check
l1.enclosing(l2,"l1-enclosing-l2", "Enclosing violation")

I'm only starting to use DRC scripts and I face some problems with the enclosing check as it does not return any errors even though I draw shapes on layers l1 and l2 in such a way that there is or is not any enclosings. Do you see some stupid mistake in the I have done there? (width and spacing checks work fine)

Thanks in advance,


  • Could you attach a sample layout or maybe a screenshot of what you are drawing?



  • edited February 17

    Here is example layout where we can clearly see that other layer does not enclose the other. But there is no error from enclosing check? With the DRC check i want to check that l1 layer indeed encloses layer l2. Thanks, hwest

  • Hello hwest,

    The enclosing check works as intended...
    If you would like the blue layer to be fully inside the red one with a margin you could check for:




  • Hi Tomas,

    for some reason i still dont get an error message with that script. If I understand correctly that outside-method returns shapes. So i have to perform some check for that shape that it produces.

    I performed a "dummy width check" for it (l1 = blue_layer, l2 = red_layer):

    not_allowed = l1.outside(l2.sized(
    not_allowed.width(100 * um).output('l1_not_inside_l2', 'not inside violation')

    What I think the code does: first line selects shapes of blue layer that are outside red. Second line should return error because the shapes have dimensions of less than 100um. For some reason there is no error message as I run the DRC...

    BR, hwest

  • Oops, stupid mistake...

    blue_layer - (red_layer.sized(-sizing_value)) should highlight all violations...

    "-" is the Boolean NOT operation...

  • "enclosing" checks whether layer1 extends beyond layer 2 at least by the given distance. This works as you can see here:

    (the layer 1 edges flagged are less than 2 µm outside of layer 2).

    "enclosing" does not check if all of layer 2 is enclosed by layer 1. So you need some "all layer 2 must be covered by layer 1" check. For this, you have to use the "layer2.not_inside(layer1)" or "layer2 - layer1". You can also use the sized trick above to get both, but with enclosing you have more options like metrics or edge constraints.


  • Thank you guys for the help :smile:

    BR, hwest

Sign In or Register to comment.