Lumerical has a suggested script that automatically exports the structures into a GDSII file, but there is a caveat:
Doesn't work for Klayout 0.27+
Thanks to this post (Error reading GDSII file), i was able to use dump_oas_gds2 to view a GDS file that throws an error in the current version of Klayout. I have created my own script that allows me to export GDS files, so I would consider the problem solved, but it did raise two questions:
I am curious if anyone would comment on the difference between Klayout 0.27+ and previous that allows the older versions to view the file? I can use 0.24.10 to view the file without error.
Is there any suggested way of editing a GDS file that won't open in Klayout, or perhaps, editing in an older version to allow it to work in newer versions of Klayout?
dump_oas_gds2 output
```
000 00 06 00 02 HEADER
004 00 03 3
006 00 1c 01 02 BGNLIB
010 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
018 + 00 35 00 0b
022 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
030 + 00 35 00 0b
034 00 10 02 06 LIBNAME
038 6f 75 74 70 75 74 5f 64 "outputdemo"
046 + 65 6d 6f 00
050 00 14 03 05 UNITS
054 3e 41 89 37 4b c6 a7 f0 0.001
062 39 44 b8 2f a0 9b 5a 54 1e-09
070 00 1c 05 02 BGNSTR
074 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
082 + 00 35 00 0b
086 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
094 + 00 35 00 0b
098 00 0c 06 06 STRNAME
102 74 72 69 61 6e 67 6c 65 "triangle"
110 00 04 08 00 BOUNDARY
114 00 06 0d 02 LAYER
118 00 04 4
120 00 06 0e 02 DATATYPE
124 00 00 0
126 00 24 10 03 XY
130 00 00 13 88 00 00 0e ec 5000,3820
138 00 00 14 24 00 00 0f fa 5156,4090
146 00 00 12 ec 00 00 0f fa 4844,4090
154 00 00 13 88 00 00 0e ec 5000,3820
162 00 04 11 00 ENDEL
166 00 04 07 00 ENDSTR
170 00 1c 05 02 BGNSTR
174 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
182 + 00 35 00 0b
186 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
194 + 00 35 00 0b
198 00 0e 06 06 STRNAME
202 72 65 63 74 61 6e 67 6c "rectangle"
210 + 65 00
212 00 04 08 00 BOUNDARY
216 00 06 0d 02 LAYER
220 00 01 1
222 00 06 0e 02 DATATYPE
226 00 00 0
228 00 2c 10 03 XY
232 00 00 03 e8 00 00 03 e8 1000,1000
240 00 00 0b b8 00 00 03 e8 3000,1000
248 00 00 0b b8 00 00 0b b8 3000,3000
256 00 00 03 e8 00 00 0b b8 1000,3000
264 00 00 03 e8 00 00 03 e8 1000,1000
272 00 04 11 00 ENDEL
276 00 04 07 00 ENDSTR
280 00 1c 05 02 BGNSTR
284 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
292 + 00 35 00 0b
296 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
304 + 00 35 00 0b
308 00 0e 06 06 STRNAME
312 72 65 63 74 61 6e 67 6c "rectangle2"
320 + 65 32
322 00 04 08 00 BOUNDARY
326 00 06 0d 02 LAYER
330 00 05 5
332 00 06 0e 02 DATATYPE
336 00 00 0
338 00 2c 10 03 XY
342 00 00 0d ac 00 00 0d ac 3500,3500
350 00 00 11 94 00 00 0d ac 4500,3500
358 00 00 11 94 00 00 11 94 4500,4500
366 00 00 0d ac 00 00 11 94 3500,4500
374 00 00 0d ac 00 00 0d ac 3500,3500
382 00 04 11 00 ENDEL
386 00 04 07 00 ENDSTR
390 00 1c 05 02 BGNSTR
394 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
402 + 00 35 00 0b
406 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
414 + 00 35 00 0b
418 00 0a 06 06 STRNAME
422 6d 6f 64 65 6c 00 "model"
428 00 04 0a 00 SREF
432 00 14 12 06 SNAME
436 73 74 72 75 63 74 75 72 "structure group"
444 + 65 20 67 72 6f 75 70 00
452 00 0c 10 03 XY
456 00 00 00 00 00 00 00 00 0,0
464 00 04 11 00 ENDEL
468 00 04 07 00 ENDSTR
472 00 1c 05 02 BGNSTR
476 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
484 + 00 35 00 0b
488 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
496 + 00 35 00 0b
500 00 14 06 06 STRNAME
504 73 74 72 75 63 74 75 72 "structure group"
512 + 65 20 67 72 6f 75 70 00
520 00 04 0a 00 SREF
524 00 0c 12 06 SNAME
528 74 72 69 61 6e 67 6c 65 "triangle"
536 00 0c 10 03 XY
540 00 00 00 00 00 00 00 00 0,0
548 00 04 11 00 ENDEL
552 00 04 07 00 ENDSTR
556 00 1c 05 02 BGNSTR
560 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
568 + 00 35 00 0b
572 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
580 + 00 35 00 0b
584 00 0c 06 06 STRNAME
588 74 72 69 61 6e 67 6c 65 "triangle"
596 00 04 07 00 ENDSTR
600 00 1c 05 02 BGNSTR
604 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
612 + 00 35 00 0b
616 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
624 + 00 35 00 0b
628 00 14 06 06 STRNAME
632 73 74 72 75 63 74 75 72 "structure group"
640 + 65 20 67 72 6f 75 70 00
648 00 04 0a 00 SREF
652 00 0e 12 06 SNAME
656 72 65 63 74 61 6e 67 6c "rectangle"
664 + 65 00
666 00 0c 10 03 XY
670 00 00 00 00 00 00 00 00 0,0
678 00 04 11 00 ENDEL
682 00 04 07 00 ENDSTR
686 00 1c 05 02 BGNSTR
690 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
698 + 00 35 00 0b
702 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
710 + 00 35 00 0b
714 00 0e 06 06 STRNAME
718 72 65 63 74 61 6e 67 6c "rectangle"
726 + 65 00
728 00 04 07 00 ENDSTR
732 00 1c 05 02 BGNSTR
736 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
744 + 00 35 00 0b
748 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
756 + 00 35 00 0b
760 00 14 06 06 STRNAME
764 73 74 72 75 63 74 75 72 "structure group"
772 + 65 20 67 72 6f 75 70 00
780 00 04 0a 00 SREF
784 00 0e 12 06 SNAME
788 72 65 63 74 61 6e 67 6c "rectangle2"
796 + 65 32
798 00 0c 10 03 XY
802 00 00 00 00 00 00 00 00 0,0
810 00 04 11 00 ENDEL
814 00 04 07 00 ENDSTR
818 00 1c 05 02 BGNSTR
822 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
830 + 00 35 00 0b
834 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
842 + 00 35 00 0b
846 00 0e 06 06 STRNAME
850 72 65 63 74 61 6e 67 6c "rectangle2"
858 + 65 32
860 00 04 07 00 ENDSTR
864 00 1c 05 02 BGNSTR
868 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
876 + 00 35 00 0b
880 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
888 + 00 35 00 0b
892 00 14 06 06 STRNAME
896 73 74 72 75 63 74 75 72 "structure group"
904 + 65 20 67 72 6f 75 70 00
912 00 04 07 00 ENDSTR
916 00 1c 05 02 BGNSTR
920 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
928 + 00 35 00 0b
932 07 e8 00 04 00 11 00 0d 2024-04-17 13:53:11
940 + 00 35 00 0b
944 00 0a 06 06 STRNAME
948 6d 6f 64 65 6c 00 "model"
954 00 04 07 00 ENDSTR
958 00 04 04 00 ENDLIB
Comments
ERROR: A cell with name triangle already exists (position=596, record number=43, cell=triangle)
dump_gds2 output_demo.gds | grep '"'
shows that the gds contains multiple struct with the same name.
So the question is not how to make klayout read this illegal gds,
the question is how to fix the tool/script that generated it.
My opinion as well! Thanks @StefanThiede.
Technically, GDS references cells by name. So if two cells carry the same name you cannot decide which cell is targeted when a cell is instantiated.
The GDS reader initially joined cells with the same name into one, which raises a number of questions. In the best case you duplicate information, in the worst case you spoil your layout.
Matthias
Thanks @StefanThiede @Matthias
Agree x 3.
I'm not asking for Klayout to read an illegal gds, I'm asking about any insights into why the older version is able to? And in the case of possessing a gds that is illegal, are there any Klayout supported strategies for repair?
Thanks.
Hi @tgustafson,
I would call it a bug in the old version to accept illegal GDS files. Basically the results are unpredicable, and it is very easy to spoil your design this way. KLayout may show you a layout this way, but once you submit it to manufacturing, the chip will look different. You do not want to have this.
As mentioned, the layout is broken and cannot be repaired, as information is missing. You have two cells that cannot be distinguished (because they share the same name). So if you have two references to two such cells, this can either mean two references to the first cell, two references to different cells or two references to the second cell. So the information about which cell was meant by which reference is lost and cannot be restored.
Matthias
@tgustafson, can you say how to fix the problem? I have the same error and don't know how to change script in Lumerical