Maximum Number of Vertices in a GDSII Boundary

The maximum number of vertices that can be used per boundary was initially limited to 200 when the original GDSII specification was developed by Calma back in the early 80's. This was probably due to the slow operation of the CPU's and limited memory available at that time.

Since that time virtually everyone who develops IC software has extended that limit -- sometimes to 1024, sometimes to 2048 or even 4096. The maximum vertex count that can be used without creating a truly non-compatible GDSII file is limited to 8191 due to the record structure of GDSII.

Binary Records

GDSII is a binary file format and is broken into records of different lengths. At the beginning of each record are 4 bytes which describe the record length, record type and data type for the record. A boundary or a path record is always followed by a XY record prior to the ENDEL (end element) record. The XY record contains the list of XY coordinates for the boundary or path. The boundary record is built up of additional record types, some which are optional:


XY Record Header

The XY record contains the XY coordinate pairs used to describe the boundary. How many pairs can one cram into a single record? This is easy to calculate.

GDSII record header

Since we have two bytes (16 bits) to describe the record length, the maximum length of any GDSII record is 216 bytes or 65536 bytes.

We always need 4 bytes for the header leaving 65532 bytes for XY data.

bytes for each XY coordinate pair

Since each XY pair needs 8 bytes, the total number of pairs you can list is

65532/8 = 8191.5  (but can't use 1/2 vertex pair ...) = 8191

How to Get Around The 8191 Limit

An obvious way to get around this limit is to use multiple XY records following the boundary (or path) record. However if you output GDSII in this fashion, most if not all GDSII parsers will fail since they generally expect an end of element (ENDEL) record to immediately follow the XY record.

   XY   <-- most GDSII parsers will expect ENDEL after XY record ...

With suitable modification of the GDSII parser and the associated buffers and data structures, a GDSII processor can support as many consecutive XY records as needed to support 32,000 or even 64,000 vertices per boundary.