Rust crate of a parser and writer for the 'liberty' format which is used to describe the timing behavior of CMOS standard-cells.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Thomas Kramer 5afaff3295 Work on 2nd generation parser. 6 days ago
src Work on 2nd generation parser. 6 days ago
tests Parse define statements. 2 months ago
.gitignore Initial commit. 8 months ago
Cargo.toml Comments. 3 months ago
LICENCE Initial commit. 8 months ago Language specifier in README example. 3 months ago


Liberty-io is a Rust crate for parsing and writing the 'liberty' format which is used for characterizing the timing behaviour of digital CMOS standard-cells.

Since liberty files can be huge (up to gigabytes) this parser does not require to load the full file into memory but streams it from the disk.


Read a liberty file:

use liberty_io;
use std::fs::File;
use std::io::BufReader;

// Create a buffered reader for faster reading.
let f = File::open("./tests/data/freepdk45/gscl45nm.lib").expect("Failed to open file.");
let mut buf = BufReader::new(f);

// Read the file.
let read_result = liberty_io::read_liberty_bytes(&mut buf);

// Abort the program if the library could not be read.
let library_group = read_result.expect("Failed to read library!");

// Access the content.
assert_eq!(&, "library");
assert_eq!(&library_group.arguments[0].to_string(), "gscl45nm");

// List all cell names. (There's only DFFNEGX1 in the provided example file.)
println!("Library cells:");
for group in &library_group.groups {
    if == "cell" {
        println!("* {}", &group.arguments[0]);

// There's some utility functions for accessing the library structure.
// Find a cell group by it's name.
let dffnegx1 = liberty_io::util::find_cell(&library_group, "DFFNEGX1");