Skip to main content

Crate liberty_parser

Crate liberty_parser 

Source
Expand description

This crate reads Liberty format files, commonly used by EDA tools to describe library cells (including standard cells, hard IP, etc.).

§Example

use liberty_parser::parse_lib;

let lib_str = r#"
library(sample) {
    cell(AND2) {
        area: 1;
    }
}
"#;

for lib in parse_lib(lib_str).unwrap() {
    println!("Library '{}' has {} cells", lib.name, lib.iter_cells().count());
    let area = lib
        .get_cell("AND2")
        .and_then(|c| c.simple_attribute("area"))
        .map_or(-1.0, |v| v.float());
    println!("Cell AND2 has area: {}", area);
}

Re-exports§

pub use ast::ParseResult;
pub use ast::Value;

Modules§

ast
Defines the types and parser for the Abstract Syntax Tree (AST) representation of a Liberty file.
liberty
Defines a slightly enhanced data structure than the base AST
parser

Structs§

Error

Functions§

parse_lib
Parse a string slice into a liberty::Liberty struct