Hi, Matthias,
Thank you for this friendly software.
I have a question, I want to do the simple statistic with the layout.
There are many cells in the layout and I want to know every cell appears in the layout how many times?
Is there any command can help this calculation?
Regards,
Canny
Comments
Hi Canny.
What precisely do you mean by "how many times"? Do you mean the flat count, i.e. the number of times a cell appears in a given other cell when drawing that cell? This count is not the same than the number of instances, because a cell might be instantiated a number of times in another cell which itself is instantiated multiple times. Hence in that case the count multiplies.
Best regards,
Matthias
I'm sorry for in-precisely question.
I want to know under the some specific cell(ex, top-cell),
how many times the cell IDs were used (or instantiated)?
Ex, there are 16 instances under the top_cell, 4 instances are referenced by cell ID "A", 2 referenced by cell ID "B", 8 referenced by cell ID "C" and 2 referenced by cell ID "D". Is there any way to get the result list like,
Top_cell/Cell_ID/Count
top_cell/A/4
top_cell/B/2
top_cell/C/8
top_cell/D/2
?
Thank you for your feedback.
Regards,
Canny
I'm also curious about the "flat" of brower instance in Klayout.
Why is the number of "Flat" always twice of the "Count"?
Regards,
Hsin Yi
Hallo,
Regarding the second question, the flat count is not necessarily two times the count. Consider the following hierarchy, where B is instantiated in A and A itself in TOP. Assume there a three instances of B in A (the instance count is 3). But expanding the two A instances in TOP effectively renders 6 instances of B in TOP (2 times 3). The latter is the "flat" count. In that example the flat count is twice the instance count:
The arithmetics gets more complicated if you have multiple instantiation paths of a cell, but in every case the "flat" count is the number of expanded instances of a cell in the current scope. The instance browser will report a total of flat instances and a flat count along each instantiation path.
For the first question: the instance browser does not exactly give you that information but just for one cell. It is possible to create a script that gives you that information.
You'll find a sample script below. The script shows the results in a message box which may not make sense if the list gets very long.
Best regards,
Matthias
Thank you for your kindly feedback, I totally understand my second question.
I'm sorry for my pool English to make the mistake of my 1st question.
The information I want to get is like the left window of Klayout Browse instance shows.
To take the example you took, the information would be,
B shows 2 times under parent A
B shows 6 times under parent TOP
But the function Browse instance only show information of 1 cell per time.
I want to know this simple statistic information of all cells in the layout.
If there is any command to do it and export the result with the file?
Regards,
Canny
Hi Canny,
Ok, given that requirement the script looks somewhat different
The script will write a file called "stat.txt" which contains the information about the number of instances of all cells in other cells. Again it's just a template, you may modify of course.
Best regards,
Matthias
Thank you for your kindly help.
It is great and useful for me.
Regards,
Canny
Hi, Matthias,
I'm confused with this section and don't know how to modify it
If I have 2 instances under the layout which top cell is A
one is 1*5 B cell array
the other is a single B cell
I use the above script, and the result would show
B cell shows 6 time under its parents cell A, not 2.
Could you tell me how to modify the script to record the number of times of cell referenced?
Regards,
Canny
Hi Canny,
that's simple: replace
by
Matthias