It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
How to write a DRC check for contact/via with a minimum enclosure on at least 2 opposite side ?
For instance, a via has to be enclosed by metal by 0.01µm on 2 opposite sides and can be 0 or whatever positive value on the2 other sides.
Best regards,
Laurent
Comments
Hi Laurent,
there is no out-of-the-box function yet, but there are several solutions based on the available features.
I hope this code explains two of them:
Best regards,
Matthias
Hi all,

I see 4 ways to satisfy contact / via enclosure rule (as shown below). I am trying to write a DRC check for contact / via with enclosure but I have not thought of a way to check these 4 cases. Can you help me ?
Thank you so much
Have you tried to options mentioned in my first reply?
Matthias
Hi Matthias,
I tried to options mentioned in your first reply. But it does not cover 2 case that I circle below.
Best regards,
Nam
Hi,
Maybe you need to explain what's the expected outcome.
I rebuilt your sample (file attached) and with the script above I get this result:
which looks perfectly fine to me. According to your description only the rightmost one violates the rule because it's the one where only one side encloses the via more than 10nm.
Matthias
Hi sir,

Sorry for my ambiguity. According to rules file, I can draw metal enclose via by 2 ways: (enclosure 4 edge >= 0.02 um) or (2 opposite sides> = 0.025um, other 2 edges> = 0.005um)
I have created the wrong case in the attachment.
Thanks sir
Nam
Hi Nam,
Here is the way I have encoded it and used for some time in an other process, so I have adjusted the sizes to your process :
I cannot remember exactly the layout case that push me to add "with_area" during the debug, but I guess it was to find the opposite edges.
?
Maybe, our master Matthias has a more efficient way to code it
Laurent
I wish I had ...
I am considering the code a special option inside the enclosure check. I think that is basically the most efficient way. I'm just wondering how much variations there are and how flexible such an option has to be.
Best regards,
Matthias
hi laurent_c

I tried with yours but it wrong flag as like this picture:
1: should be not flag.
2: should be flag.
can you find out why?
Thank you in advance.
Hi dai,
I think you need to adjust the values according to your process.
You can always debug such kind of code by emitting intermediate layers as debug output. There are many solutions sketched in the discussion above. Try them and pick the one that works for you.
I have added now a built-in option to code this case without any coding around. It's going to be released in 0.27. You can give it a try with the continuous builds: https://www.klayout.org/downloads/master/
The notation will be like this:
Matthias
Thank your helping, Matthias
I have done this. here is what i did:
dai
Hi Matthias,
I don't know how to use layer.each { |object| ... }
can you give me an example about this?
Thank you very much
dai
Hi Dai,
It allows you to do "something" with each object (data structure) on that layer, for instance if you want to extract only the squares of a layer to a new layer:
Layer01 = input(1,0)
Layer02 = polygon_layer # new empty layer
Layer01.rectangles.each {|rectangle|
if rectangle.bbox.height == rectangle.bbox.width
Layer02.insert(rectangle)
end
}
Layer02.output(2,0)
Cheers,
Tomas
Thank you very much, Tomas
regards,
dai
Is there a way to use the waivers options like for the separation check ?
For example, for 2 opposite sides :
For example, for only 1 side :
I have tried the second one, but it does not work ...
Laurent
Hi Laurent,
first of all the rectangle filters work only this way round:
The reason is that filtering happens when rectangle edges are fully flagged. If you check via vs. metal, the via rectangle's edges are flagged along their whole length while in the "metal.enclosing(via, ...)" case, the metal edges are only partially flagged.
Second unfortunately the options cannot be combined. The last one will basically win. So you'd need something like "one_to_three_sides_allowed", but such an option is not available yet
Matthias
Hi Matthias,
Thank you, then the method for the second case becomes :
The first case is then also easy to write. It is probably faster than the methods at the top this discussion.
Laurent
I am slightly confused now ...
Actually, the comma way of adding rectangle filters is already there and seems to work. I just missed it.
E.g.
gives this:
Which means it flags only the case where there isn't a single enclosure larger than the threshold.
So I wonder if there is another issue I don't see as of now.
Matthias
I just found out that the following command does not work in some strange cases below :
BRgds,
Laurent
Hmm ... that's bad.
To be honest, I'm no longer sure what the expectation is: that partial "two sides" is flagged as error or accepted.
As first test gave me all partial situations flagged:
Do you happen to have a small test case?
Thanks,
Matthias
Oups, my exact command was :
BRgds,
Laurent
Assuming a via width of 100nm, I solved it this way :
BRgds,
Laurent
Assuming a via width of 100nm, I solved it this way :
BRgds,
Laurent
Hello,
I have an issue with the DRC. I don't understand this error. Does anyone have the same problem?
I am using drc_sky130.lydrc to check the DRC, but I don't know if it is the best option.
Thank you for your help.
/ This via is genarated by vias_gen /
@CMeyer If would be extremely helpful if you could cite the sources - this forum is not about Sky130 or any related implementation, so we don't know what exactly you're writing about.