It looks like you're new here. If you want to get involved, click one of these buttons!
Hello,
We are currently using the evaluate_nets function to implement the antenna checks for gf180mcu.
Here is the current implementation:
# ANTENNADIFFSIDEAREARATIO-like antenna check
def antenna_check_gf180mcu(gate, antenna_layer, thickness, limit, n_diode, p_diode, nwell, mf)
expression = "var garea = area; var darea = area(n_diode) + area(p_diode) + area(nwell); var per = perimeter(antenna_layer) * thickness; "\
"var ar = per / (garea + mf * darea); skip(ar < limit); "\
"put('GATE_AREA', garea); put('DIODES_AREA', darea); put('ANT_PERIMETER', per); put('RATIO', ar);"
variables = { "thickness" => thickness, "mf" => mf, "limit" => limit}
return evaluate_nets(gate, { "antenna_layer" => antenna_layer, "n_diode" => n_diode, "p_diode" => p_diode, "nwell" => nwell }, expression, variables)
end
I have two questions:
For the first question, I tried to adapt the antenna check as follows:
# ANTENNADIFFSIDEAREARATIO-like antenna check
def antenna_check_gf180mcu(gate, antenna_layer, thickness, limit, diodes, mf)
expression = "var garea = area; var darea = 0; diodes.each { |diode| darea += area(diode) }; var per = perimeter(antenna_layer) * thickness; "\
"var ar = per / (garea + mf * darea); skip(ar < limit); "\
"put('GATE_AREA', garea); put('DIODES_AREA', darea); put('ANT_PERIMETER', per); put('RATIO', ar);"
variables = { "thickness" => thickness, "mf" => mf, "limit" => limit}
return evaluate_nets(gate, { "antenna_layer" => antenna_layer, "diodes" => diodes }, expression, variables)
end
And tried to use it like so:
antenna_check_gf180mcu(thin_gate, metal1, 0.54, 400, [n_diode, p_diode, nwell], 2)
Unfortunately, I get this error:
ERROR: RuntimeError: 'evaluate_nets': Second argument must be a hash of names and polygon in Executable::execute
Is there another way of passing a variable number of layers?
As for the second question, an antenna violation currently produces two items in the database (gate of nmos and gate of pmos). Is there a way to merge them?


Thanks!
Leo
Comments
Hi Leo,
The expressions syntax is somewhat limited - there are no loops. You can still pass arrays:
And as the expression is evaluated at execution time, you could also synthesize an expression for an array with arbitrary length.
About how to put an error on one shape: I have no good idea how to do that - if you think about cumulative antenna check, the evaluation has to be done on all shapes individually, as on different levels different nets my be formed. So in the general case, it's not easy to decide which group to form to pick a representative for. That is also an issue for the merge question.
In your case it's a bit easier as the evaluation is net-by-net. If useful I could add another clause that allows generating a single marker polygon conditionally. But that would be a random single gate on the net. Or should that rather be a huge polygon representing all shapes of a net?
Matthias
Hi Matthias,
thanks for your reply.
I tried using your version of the antenna check, but I still get this error:
So it seems that I can only pass a "hash of names and polygon" as secondary_layers, but I would need to pass a "hash of names and polygon or list of polygon".
That's great! Once I can pass an array, I can add as many
+ area(diodes[n])to the expression as I need to.After taking a close look at your cumulative antenna check in https://github.com/KLayout/klayout/issues/2245#issuecomment-3623149610, I now understand what you mean.
Yes, that would be perfect! This would create one shape for each antenna check and we can see the violating net at first glance.
Up until now, I always had to use the net tracer to trace the entire net, which made it difficult to see which part of the net was conidered for this antenna check.
Leo
Oh, I'm sorry. You are right. Arrays of layers are not supported as of now. I left my brain at some Christmas party obviously.
You can pass any value to variables, including arrays, but one should not use that for layers.
But it should still be possible to synthesize the expressions with an array of layers as input to your function. Here is slightly spiced-up version which does so:
Let me think about the debugging topic. I agree, fixing Antenna violations may become difficult. I think it is possible to dump the net information used internally and use that for debugging. What is needed is some back-annotation of antenna violation to the extracted net.
A single polygon is surely possible, I am just somewhat afraid they would potentially become huge.
Best regards,
Matthias
Happy New Year, Matthias!
Haha, it happens 😉
But I could also have thought about creating the hash based on the number of diode layers. Thanks for the hint!
I'm still new to Ruby, but I quite like the language so far.
Regarding the DRC: would
evaluate_netsthen return the polygons for the whole violated net, instead of just the gates of the violated net?I think this would be fine for most situations. Take this violated net that I traced, for example:
Of course, in some situations the net might become huge, e.g. if you accidentally connect VDD/VSS directly to a gate. However, in normal situations, this should probably be fine.
Best,
Leo
Hi Leo,
I have started an implementation of the "copy whole net as marker" (https://github.com/KLayout/klayout/pull/2257).
With this patch "evaluate_nets" will have a new feature that allows finer control over what is produced. The function is "copy" and provides an alternative to "skip". It is used the following ways:
Copy the whole net as error marker (merged polygons from all layers):
Copy individual polygons instead of merged polygons:
Copy polygons from a single layer (merged is default, can be combined with
merged=false):Copy polygons from multiple layers (0 is the primary layer by convention):
Copy the merged "all layers" net polygon, but emit only the bounding box is the number of original polygons is exceeding 1000 (don't confuse 'limit' (the variant) with 'limit' (the keyword parameter):
With the new version it is also basically possible to log information into a L2N database with net references. This allows browsing the antenna check results in the netlist browser's log view:
The code for this example (which logs the antenna ratios unconditionally) is here: https://github.com/KLayout/klayout/blob/evaluate_net-enhancements/testdata/drc/drcSimpleTests_147.drc.
I am currently also trying to utilize soft connections for Antenna checks. Soft connections split nets into subnets and are used to detect weak connections. It should be possible to define soft connections for the vias and the allow computing net areas while not crossing specific soft connections. This would allow to compute all antenna ratios from one extraction, by just stopping at connections from via1 (for metal1 antenna area), via2 (for metal2 antenna area) etc. I am not sure if that works, but if it does, it would eliminate the need for multiple extractions with increasing number of metals and allow implementation of cumulative Antenna checks in a single (large) expression.
Matthias