Can this design rule be checked by DRC script?

edited December 2016 in General
Hello Matthias,

I can not have a good understanding of the DRC script in klayout. Can you show an example to check the following design rule?

"The width of metal must be greater than or equal to 3 microns except where poly and metal overlap by more than 1 micron, then the metal width must be greater than or equal to 4 microns."

Thanks & Regards,


  • edited November -1


    I just have a rough idea about the meaning of this rule, so I can just guess.

    Maybe you want to try this:

    poly = input(2)
    metal = input(1)
    # e1 = metal edges overlapping poly by less than 1µm
    e1 = metal.overlap(poly,, projection).edges
    # e2 = metal edges inside poly
    e2 = (metal.edges & (metal & poly).edges)
    # e3 = metal edges overlapping poly by more than 1µm
    e3 = e2 - e1
    # Checks 4µm rule
    metal.edges.overlap(e3,"Metal width >= 4µm where Poly overlaps metal by more than 1µm")
    # Check 3µm rule
    (metal.edges - e3).width("Metal width >= 3µm otherwise")


  • edited December 2016
    Hi Matthias,

    Yes, this is the rule I want to check. Thank you.

    For the overlap method, is it possible to give an option to check at the rule boundary?
    For example, e1 find the edge of overlapping < 1um, but sometimes I need to find the overlapping <= 1um.
    And for the 4um rule, I do need to check overlapping < 4um instead of <=4um.
  • edited November -1
    One more question, I can not find how to use the option of many methods in the link of Documentation . Are there any other documents I can refer to?
  • edited December 2016


    All checks is designed to check "less" not "less or equal", so the overlap check should do what you're expecting: it will check width >= 4.0 and report an error on < 4.0 µm. Doesn't it?

    If you really need to check the other way around, you an add or subtract a tiny value, preferably one database unit: - 1.dbu    # a "little less" than 4 µm + 1.dbu    # a "little more" than 1 µm

    (one database unit is the smallest distance that can be represented by the design's resolution).

    The options are documented with the "width" method. There should be a link from the other methods embedded in the text. At least it's working on the HTML documentation here for example.


  • edited November -1
    OK, thank you, Matthias.
Sign In or Register to comment.