Expand description
A library for parsing and writing GDSII files.
GDSII is the IC industry’s de facto standard for storing and sharing layout data.
gds is a crate for reading and creating GDSII data based on Gds21 and similar to libraries such as gdstk and its predecessor gdspy.
Reading and generating GDSII-format data are primary goals;
offering ease-of-use functionality for more elaborate manipulations of GDS data is not.
Layout data is represented in three primary forms:
- A short tree with three layers:
- The root is a
GdsLibrary, which primarily consists of a set of cells (GdsStructs), and secondarily a set of metadata. EachGdsLibraryis a universe unto itself, in that it has no mechanisms for comprehending layout cells or data defined outside itself. On-disk eachGdsLibraryis typically paired one-to-one with a.gdsfile. - Libraries consist of cell definitions AKA
GdsStructs, which define each layout cell (or module, or “struct” in GDSII terms). - Cells consist of
GdsElements, an enumeration which includes individual polygons (GdsBoundary), instances of other layout cells (GdsStructRef), text (GdsTextElem), and a few other geometric elements.
- The root is a
- For storage on disk, the
GdsLibrarytree is flattened to a series ofGdsRecords. These records indicate the beginning, end, and content of each tree-node. Detailed descriptions of these records comprise the majority of the GDSII spec. - Records are stored on-disk in binary form as detailed in the GDSII spec.
Each includes a record-type header, datatype, length field, and optional additional content.
These raw-bytes are never stored by Gds21, only generated and consumed on their way into and out of
ReadandWriteobjects (typicallyFiles).
§Usage
Loading a GdsLibrary from disk:
let lib = GdsLibrary::load("sample.gds")?;Creating a new and empty GdsLibrary, and adding a GdsStruct cell-definition:
use gds::{GdsLibrary, GdsStruct};
let mut lib = GdsLibrary::new("mylib");
lib.structs.push(GdsStruct::new("mycell"));Saving a GdsLibrary to disk:
lib.save("mylib.gds");§Serialization
Each element in Gds21’s GdsLibrary tree is serde-serializable.
GDSII data can be straightforwardly serialized in any serde-supported format.
Examples:
let lib = gds::GdsLibrary::new("mylib");
let json = serde_json::to_string(&lib);
let yaml = serde_yaml::to_string(&lib);
let toml = toml::to_string(&lib);Gds21 includes built-in support for a subset of serde-formats via its SerializationFormat enumeration,
and support for directly reading and writing files in each format via its accompanying SerdeFile trait.
Example using SerializationFormat::Yaml:
use gds::SerializationFormat::Yaml;
let lib = gds::GdsLibrary::new("mylib");
// Write to YAML-format file
Yaml.save(&lib, "mylib.gds.yaml")?;
// And read back from file
let lib2: gds::GdsLibrary = Yaml.open("mylib.gds.yaml")?;Note these text-based representations will generally be substantially larger than binary GDSII data.
Structs§
- A GDS array reference.
- A GDS boundary element.
- A GDS box element.
- GDS modification dates and times.
- GDS element flags.
- A namespace for encoding and decoding GDSII floats to and from the IEEE754 double-precision format.
- A GDS layer spec.
- A GDS library.
- GDS node element
- A GDS path element.
- A GDS plex record.
- A GDS spatial point.
- GDS text presentation flags.
- A GDS property specification.
- A GDS record header.
- GDS summary stats.
- A GDS translation setting.
- A GDS struct (cell) definition
- A GDS struct reference (cell instance).
- A GDS text element.
- An encoding of GDS units.
- A marker type for unsupported features.
Enums§
- An enumeration of each context in which a record can be parsed, primarily for error reporting.
- An enumeration of GDS data types.
- An enumeration of GDS elements.
- An enumeration of GDS errors.
- An enumeration of GDS mask formats.
- An enumeration of GDS record types.
- An enumeration of GDS record types.
- An enumeration of first-class supported serialization formats.
Traits§
- An object that has a corresponding GDS layer.
- A trait for serializing/deserializing files.
Functions§
- Check
libmatches across a write-read round-trip cycle
Type Aliases§
- A result type alias.