Array Instance Counts Identified by "Detailed Layer Statistics"

edited July 28 in KLayout Support

I am seeing something peculiar with "Detailed Layer Statistics" while using large instance arrays.

If I have a cell, MY_CELL, with a single polygon in it and then place MY_CELL in a 1000 x 1000 Array Instance in the top cell, when I look at "Detailed Layer Statistics", then I see 1,000,000 total boxes, which is correct (1000x1000=1,000,000).

If I then modify my array size a few times, I get the following values from "Detailed Layer Statistics"
X * Y=detailed layer box count
10 * 10 = 100
100 * 100 = 1,000
1,000 * 1,000 = 1,000,000
10,000 * 10,000 = 100,000,000
100,000 * 100,000 = 1,410,065,408

That last one really throws me... it says there are 1.4B boxes, when there should be 10B. I thought this maybe was just an overflow error in detailed layer statistics, but I opened the file in a commercial EDA viewer, and it also said there were 1.4B cell placements instead of 10B, which doubles down on the confusion.

The 100k * 100k Array Instance represents my use case, but it doesn't seem to work to create it as a single array. As a workaround, I created a second cell, ONETENTH, and put a 10k * 10k Array Instance of MY_CELL in it and then placed ONETENTH as an ArrayInstance in Top as 10 * 10. This gives me the 10B placements that I need.

Have I run into some oasis spec limit, or have I perhaps hit an upper bound of a variable in klayout?


  • Attached is a test case that shows this behavior for a 100k * 100k Array Instance.

  • Hi jpk,

    thanks for bringing up this issue.

    There actually isn't a spec limit on OASIS, but there is one on GDS. GDS can only represent a maximum of 32767x32767 (or 65535x65535 if you read 16bit numbes as unsigned ones). But OASIS does not have such an image.

    I loaded your layout and found the number correctly reported as 10B instances:

    Are you maybe using 32bit KLayout?


  • Interesting... I'm using the 64-bit version, installed from klayout-0.26.7-win64-install.exe.

    I see this in Detailed Layer Statistics:

  • edited August 4

    I see ... but I guess that's Windows.

    Windows compilers traditionally keep "long int" at 32bit even for 64bit (which makes "int" and "long int" the same length). Linux compilers instead make "long int" 64bit. I think that explains your observation and it will be easy to fix (


Sign In or Register to comment.