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