Skip to main content

Updated 5 min readGDSII

GDSII vs OASIS: layout formats explained

What GDSII and OASIS (SEMI P39) actually store, why OASIS files are smaller, how to convert and check them with KLayout, and what to verify at handoff.

By the SkyCadEda engineering teamHow these notes are written

  • GDSII
  • OASIS
  • Layout
  • Mask data
  • KLayout

ShareLinkedInX

On this page

GDSII and OASIS both describe mask layout as hierarchical geometry: cells that contain shapes on numbered layers and placements of other cells. GDSII (GDS II Stream format, from Calma in the late 1970s) is still the default handoff format for IP blocks and tapeouts. OASIS, the Open Artwork System Interchange Standard (SEMI P39, 2004), stores the same kind of data far more compactly and is the usual choice for large full-chip and post-OPC mask data. Neither format carries timing, netlists or device models.

What a GDSII file contains

A GDSII file is a flat sequence of binary records. Each record starts with a 2-byte length, a 1-byte record type and a 1-byte data-type code, followed by its data. A library (BGNLIB ... ENDLIB) holds a UNITS record and a list of structures (BGNSTR/STRNAME ...ENDSTR), which are the cells. Inside a structure the elements are:

  • BOUNDARY: a closed polygon on a LAYER/DATATYPE pair.
  • PATH: a centreline with a width and an end-cap type.
  • SREF: one placement of another structure, with optional mirror, rotation and magnification.
  • AREF: a regular rows-by-columns array of placements.
  • TEXT: a label string on a layer and text type. LVS uses these to name nets and pins.
  • BOX and NODE: rarely used today.

Coordinates are 4-byte signed integers in database units. The UNITS record holds two 8-byte reals: the size of a database unit in user units and in metres. A 1 nm grid with micron user units is written as 0.001 and 1e-9. These reals use the old IBM excess-64 hexadecimal format, not IEEE 754, which is a classic bug source in home-grown readers.

Where GDSII runs out of room

  • File size. Every vertex costs 8 bytes and there is no compression, so teams ship .gds.gz. Large post-OPC layouts run to tens or hundreds of gigabytes.
  • Layer and datatype are 16-bit fields. Many tools cap them lower, which bites when a PDK or a merged IP uses high layer numbers.
  • Record length is 16 bits, so one XY record holds at most 8,191 points. Writers split or fracture larger polygons.
  • Only cell placements can be arrayed (AREF). Repeated shapes, such as vias in a via array or fill, are written out one by one unless they are wrapped in a cell.

What OASIS changes

OASIS keeps the same data model (cells, layers, datatypes, placements, text, properties) and changes the encoding:

  • Integers are variable length, so small offsets take one byte and large designs are not limited by 32-bit fields. Layer and datatype numbers are unbounded unsigned integers.
  • Modal variables let a record omit a value that is the same as in the previous record (layer, datatype, width, and so on).
  • REPETITION applies to shapes and to placements, with regular and irregular spacing. A via array becomes one rectangle plus one repetition.
  • Cell names, text strings and property names go into numbered tables (CELLNAME, TEXTSTRING, PROPNAME, PROPSTRING) and are referenced by number.
  • CBLOCK records compress a run of records with deflate (RFC 1951).
  • Extra primitives: RECTANGLE, TRAPEZOID, CTRAPEZOID and CIRCLE, which suit mask writers.
  • Table offsets, stored in the START or END record, let a reader find the name tables without scanning the file; in strict mode each table is one contiguous block, so those offsets are complete. The END record can also carry a CRC32 or checksum.

Standard properties such as S_TOP_CELL and S_BOUNDING_BOX help readers, and S_GDS_PROPERTY carries GDSII element properties across a conversion. That is the full extent of the metadata. OASIS.MASK (SEMI P44) restricts the format further for mask-shop equipment.

ItemGDSIIOASIS
StandardDe facto (Calma, later Cadence)SEMI P39; OASIS.MASK is SEMI P44
IntegersFixed 2/4 bytesVariable length
Layer / datatype16-bit, often capped lowerUnbounded unsigned
ArraysCell arrays only (AREF)Shapes and cells, regular or irregular
CompressionNone (external gzip)Built-in CBLOCK (deflate)
Typical useIP exchange, block and chip handoffFull-chip, fill-heavy and post-OPC data

Converting and checking with KLayout

KLayout ships command-line "buddy" tools that do the common jobs without opening the GUI. Convert in either direction, then XOR the result against the source to prove nothing changed: an empty XOR means the geometry is identical.

strm2oas top.gds.gz top.oas
strm2gds top.oas top_back.gds
strmxor top.gds.gz top.oas     # XOR the two files

For scripted checks, the klayout Python package (pip install klayout) reads both formats. This prints the database unit, the top cells and the number of shapes per layer/datatype, counted per cell rather than flattened, so it stays fast on large hierarchical files:

import sys
import klayout.db as db

layout = db.Layout()
layout.read(sys.argv[1])          # .gds, .gds.gz or .oas

print("dbu (um):", layout.dbu)
print("top cells:", [c.name for c in layout.top_cells()])

for li in layout.layer_indexes():
    info = layout.get_info(li)
    count = sum(cell.shapes(li).size() for cell in layout.each_cell())
    print(f"{info.layer}/{info.datatype}: {count}")

To write OASIS from the same script with compression and strict mode switched on:

opts = db.SaveLayoutOptions()
opts.format = "OASIS"
opts.oasis_compression_level = 2
opts.oasis_strict_mode = True
layout.write("top.oas", opts)

What to check before you hand off a stream file

  • Database unit. Merging a 1 nm block into a 0.5 nm or 0.25 nm top cell is fine if the tool scales it; snapping the other way moves edges off grid.
  • Exactly one intended top cell. Stray unreferenced cells become extra top cells and confuse DRC and LVS runs.
  • Layer map. Compare the layer/datatype pairs in the file against the PDK layer map and flag anything not in it.
  • Cell-name collisions. Two IPs that both contain a cell called via1_2x2 with different contents will silently replace one another on merge. Prefix cell names per IP before merging.
  • Text labels on the pin/label layers the LVS deck expects, at the top level where they are needed.
  • A round-trip XOR whenever data passes through a converter or a different tool than the one that wrote it.

Format choice is usually dictated by the receiver: many foundries and IP vendors still ask for GDSII, while mask shops and full-chip verification flows prefer OASIS for size and load time. For browsing and editing large stream files on Linux we resell Slam-View and Slam-Edit, which read both formats; KLayout covers a lot of everyday viewing for free.

Frequently asked questions

What does OASIS stand for?

OASIS is the Open Artwork System Interchange Standard, published by SEMI as SEMI P39. A restricted variant for mask writers and inspection tools, OASIS.MASK, is SEMI P44.

Why is an OASIS file so much smaller than the same GDSII?

OASIS uses variable-length integers, implicit (modal) values, repetition records for arrays of cells and shapes, numbered name tables, and optional deflate compression of whole sections (CBLOCK). GDSII stores every coordinate as a fixed 4-byte integer and has no compression. Repetitive designs commonly shrink by an order of magnitude.

Can OASIS carry timing constraints or connectivity?

No. Like GDSII, OASIS is a geometry format: cells, placements, polygons, paths, rectangles, trapezoids, circles, text labels and properties. Timing lives in SDC and Liberty, connectivity in netlists or OpenAccess/LEF/DEF databases.

How do I convert GDSII to OASIS?

Most layout and verification tools read and write both. With KLayout, the strm2oas and strm2gds command-line tools convert in either direction, and strmxor can confirm that the result is geometrically identical to the source.

More engineering notes

Working through a problem like this?

Tell us about your flow: the tools, the PDK, what is failing and when it needs to be clean.