It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, I'm trying to manipulate a device class used by a device extractor, but I'm encountering an error when executing define_terminal “define_terminal(device, RBA::DeviceClassDiode::TERMINAL_A, 0, anode);”：
I asked you for advice on R extraction last year, and this code is a reference to your previous reply to me(https://www.klayout.de/forum/discussion/1873/how-to-display-the-results-of-comparator-in-the-netlist-browser-and-generate-a-customized-netlist#latest). All the files used for testing are in the attachment dn_lvs.zip.
Look forward to your advice！
I don't know what's wrong with the input of define_terminal, I checked the type of input and my input "define_terminal(device, RBA::DeviceClassDiode::TERMINAL_A, 0, anode);" matches "(1) Signature: void define_terminal (Device ptr device, unsigned long terminal_id, unsigned long layer_index, const Polygon shape)".
How should i handle this error?
Definition of device and anode:
the problem is the type of the anode and cathode variables: these are "Region" objects, not polygons. "Region" objects can consist of multiple polygons.
For example, for a planar MOSFET, source and drain are usually derived from the same drawing layer and are commutable. Hence, there is only one input layer with (usually) two polygons. So inside the device extractor you have to separate them and assign them to different terminals.
If in your case it is guaranteed (e.g. by layout design rules) that anode and cathode will only have a single polygon, you can extract it using "anode" and "cathode".
In your code is another mistake: TERMINAL_C needs to be output to the second layer (see "define_layer" in "setup"). So you have to define the C terminal for layer index "1". The following is my functional (cleaned) version of "DiodeExtractor":
Thanks for your detailed and perfect answer, this problem has been solved perfectly!
And I would like to report to you a bug about the "width_check" function, when the third parameter region is entered as nil, it says that nil cannot be passed in Region, i solve this with input "RBA::Region::Metrics::Euclidian". But according to the documentation for width_check, nil could be selected as the default input for Euclidian. This problem did not exist in previous versions.
Very good and thanks for the hint. Honestly, I don't know why nil was working. I need to check. By "previous versions" you mean which one?
I just checked why nil isn't working any longer - actually, the argument became type-bound which avoids issues when you forget to specify one argument, but on the other hand, nil is no longer a valid value.
Hence currently, the way to specify the default is to use "Euclidian" explicitly. I plan to add the option to have named parameters, but that won't happen quickly.
I just checked the previous log and this line of code was used in KLayout version 0.26.11 when nil was still valid.