Expand description
§Lef21 Library Exchange Format (LEF) Parser & Writer
Library Exchange Format (LEF) is an ASCII-based format for integrated circuit (IC) layout and technology.
LEF is near-ubiquitously used IC-industry-wide for two related purposes:
- LEF design libraries, primarily comprised of LEF macros, provide the physical abstract view of circuit designs.
- Such abstract-views are commonly the target for layout-synthesis programs (“place and route”).
- They include a circuit’s pin locations and requirements for physical blockages (“obstructions”), among other metadata, typically without including the circuit’s internal implementation.
- LEF technology descriptions (“tech-lef”) provide a concise description of design-rules for assembling such cells, as commonly performed by layout-synthesis software.
Lef21 includes comprehensive support for parsing and writing LEF design libraries, primarily stored as its LefLibrary
and LefMacro
types.
A select subset of tech-lef features are also supported, particularly those which blur the lines between technology and library data.
§Usage
Creating a LefLibrary
from file solely requires a call to the LefLibrary::open
method:
use lef21::LefLibrary;
let lib = LefLibrary::open("mylib.lef")?;
Each LefLibrary
is a short tree of macro-definitions, which are in turn primarily comprised of pin-definitions and obstructions.
This LefLibrary
tree is of the form:
LefLibrary
- Library Metadata
- Macro Definitions, stored as Vec<
LefMacro
>- Macro Metadata
- Blockages / Obstructions, stored as Vec<
LefLayerGeometries
> - Pin Definitions, stored as Vec<
LefPin
>- Pin Metadata
- Port Definitions, stored as Vec<
LefPort
>
All fields of all layers in the LefLibrary
tree are publicly accessible and modifiable.
Lef21 libraries can be saved to file with their LefLibrary::save
method:
lib.save("yourlib.lef")?;
Or converted to in-memory LEF-format Strings via LefLibrary::to_string
:
let s = lib.to_string()?;
println!({}, s);
§Serialization
LefLibrary
, all underlying data structures, and all Lef21’s other primary data stores are serde
serializable,
and can be straightforwardly converted to and from any serde-compatible format. Examples:
let lib = lef21::LefLibrary::new();
let json = serde_json::to_string(&lib);
let yaml = serde_yaml::to_string(&lib);
let toml = toml::to_string(&lib);
Lef21 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 lef21::SerializationFormat::Yaml;
let lib = lef21::LefLibrary::new();
// Write to YAML-format file
Yaml.save(&lib, "mylib.lef.yaml")?;
// And read back from file
let lib2: lef21::LefLibrary = Yaml.open("mylib.lef.yaml")?;
§Background
Lef21 is a subset of the larger Layout21 library, and is primarily used as an import and export layer. Lef21 correspondingly uses the LEF format’s concepts, idioms, and terminology (e.g. “macro” vs. “cell”) throughout. Its LEF data structures are nonetheless designed for direct manipulation, for example in programmatically modifying existing LEF content.
LEF is frequently paired with the DEF ASCII-based format for specifying circuit’s internal physical implementations. More common industry usage pairs LEF with GDSII’s binary implementation format, which dramatically reduces data-sizes for large circuits. DEF is not supported by Lef21. GDSII is supported by the related gds21 crate.
§License
Lef21 and Layout21 are published under a permissive BSD license.
The LEF format was originally designed by Tangent Systems, later acquired by Cadence Design Systems. Lef21 holds no relationship to either entity, nor any authority or ownership over the format. Countless LEF-format design descriptions are freely available as open-source software. Their examples serve as the basis for Lef21.
Structs§
- Lef Distance Units per Micron
- Lef Foreign Cell Declaration
- Lef Single-Layer Geometry Store
- Lef Library
- Lef Macro
- Lef Pin Definition
- Lef Antenna Attributes
- Lef X-Y Spatial Point
- Lef Port
- Lef Site Definition
- Lef Physical-Dimension Units
- Lef Via Instance
- Unsupported Feature
Enums§
- Antenna Models
- Sub-Types for Macros of Class LefMacroClass::Block
- Sub-Types for Macros of Class LefMacroClass::Core
- Lef/ Def
SOURCE
- Sub-Types for Macros of Class LefMacroClass::EndCap
- Lef Error Enumeration
- Lef Geometric Object Enumeration
- Lef Key(Word)s
- Enumerated Layer-Spacing Options
- LefMacro Classes
- Identifiers for the enumerated LefMacroClasses
- Binary On/Off Settings, Denoted by
ON
andOFF
- Sub-Types for Macros of Class LefMacroClass::Pad
- Lef Pin Direction
- Specifies a pin with special connection requirements because of its shape
- Lef Pin-Usage
- Sub-Types for Macros of Class LefMacroClass::Core
- Lef Shape Enumeration
- LefSite Classes
- Specifies which MACRO orientations are valid for placement
- Enumerated, Supported Serialization Formats
Traits§
- Serialization to & from file trait
Type Aliases§
- LefDecimal
- Lef21 Library-Wide Result Type