What a GDS File Actually Is
In the previous module, uart_top passed all physical verification checks: DRC, LVS, antenna rules, voltage drop, and metal density. In this module, we prepare the final delivery file for the semiconductor foundry. This file format is GDSII. In this article, we examine the internal structure of GDSII stream files.
A GDSII file is not an image graphic. It contains no display colors, pixel maps, or rendering styles. Instead, GDSII is a binary stream of records that define precise geometric polygons on numbered process layers. The file organizes geometry into a strict design hierarchy. It is a geometric database rather than a graphical illustration.
Structure of GDSII Stream Records
The Graphic Design System II (GDSII) format originated with Calma in the 1970s. Modern ultra-large-scale designs sometimes use the OASIS format for data compression. However, GDSII remains the industry standard interchange format for foundry tapeout and open-source flows. The file consists of length-prefixed binary records. Layout viewers and photomask generation systems parse these records sequentially to reconstruct chip geometry.
Table 1 lists the primary GDSII record types:
| Record Type | Description |
|---|---|
HEADER, BGNLIB, LIBNAME, UNITS |
Library metadata: format revision and database units (number of database units per micron) |
BGNSTR, STRNAME |
Structure definition: declares the beginning and name of a cell |
BOUNDARY |
Closed polygon on a specified layer and datatype, defined by coordinate pairs (XY) |
PATH |
Wire segment with defined width along a sequence of coordinate points |
SREF |
Structure reference: instance placement of a named cell with position, rotation, and mirror flags |
AREF |
Array reference: regular two-dimensional grid of cell placements (such as memory arrays or via cuts) |
TEXT |
Alphanumeric text label on a specific layer, used for net and pin names |
ENDSTR, ENDLIB |
Delimiters marking the conclusion of a structure or the complete library |
Note the absence of logical circuit abstractions. GDSII does not store transistor schematics, timing constraints, or gate functions. Apart from optional text labels on pins, GDSII stores only layer numbers, coordinates, and structure references. Logical netlist definitions reside in Verilog, LEF, and DEF files. GDSII represents physical geometric mask data exclusively.
Design Hierarchy in GDSII
An integrated circuit containing 12,000 standard cell instances from 50 unique cell types does not store 12,000 separate polygon definitions. Instead, the file contains 50 structure definitions (BGNSTR). Each definition stores unique cell geometries once. The top-level cell contains 12,000 compact structure references (SREF), each specifying a cell name, coordinates, and orientation. Hierarchy prevents file sizes from expanding excessively.
Consider an illustrative text representation of a cell INV_X1 referenced twice inside a parent structure BUF_PAIR (actual GDSII files are binary):
BGNSTR INV_X1
BOUNDARY layer=diff XY=(...)
BOUNDARY layer=poly XY=(...)
BOUNDARY layer=met1 XY=(...)
ENDSTR
BGNSTR BUF_PAIR
SREF SNAME=INV_X1 XY=(0,0)
SREF SNAME=INV_X1 XY=(5000,0)
ENDSTR
As shown in Figure 1, the polygons for INV_X1 exist once in memory. The structure BUF_PAIR contains no raw polygons. It contains only two placement references. Adding a third inverter requires one additional SREF record instead of duplicating all polygon coordinates. In production SkyWater 130 nm layouts, integer numbers identify layers (for example, layer 68, datatype 20 designates met1 drawing).
Mask preparation facilities require hierarchical layout data for complex chips. Flattening an entire layout into individual raw polygons creates unwieldy files that overwhelm processing pipelines. Hand-off archives preserve hierarchical cell structures.
Display colors, fill textures, and human-readable layer names do not exist in the GDSII file. An external layer properties file (.lyp) maps layer and datatype numbers to visual styles in layout viewers.
Practice Exercise
A design contains 50 unique standard cell macros and 12,000 placed instances. Why does total file size scale with the sum of these parameters rather than with the total number of flattened polygons?
Solution
A flattened GDSII file stores all polygons for every instance. If each cell contains 12 polygons, a flattened layout requires approximately 144,000 BOUNDARY records with complete coordinate arrays.
A hierarchical GDSII file stores unique cell geometry once: $50 \times 12 = 600$ polygons. The 12,000 cell placements require only compact SREF records containing coordinates and transform flags. Therefore, storage requirements scale with unique macro geometries plus placement records, which preserves manageable file sizes.
In the next article, we execute GDS streamout using Magic to generate the verified uart_top.gds database.