Crate liberty_io
source ·Expand description
Input and output library for the Liberty format. The Liberty format is used to describe characteristics of standard-cell libraries.
The liberty library is represented as nested Group
structures.
§Example
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);
// Print the parsed library or error value.
// dbg!(&read_result);
// 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_group.name, "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 group.name == "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 = library_group.find_cell("DFFNEGX1");
assert!(dffnegx1.is_some());
Modules§
- Parse boolean expressions as used in the liberty format.
- Utility functions for handling Liberty data.
Structs§
- Liberty
define
statement. - ‘Group’ in the liberty file.
Enums§
- Data type of attributes. This is used in define statements.
- Unit of capacitive loads.
- Unit of time.
- Liberty values.
Functions§
- Read a liberty library from a byte stream
- Read a liberty library from an iterator over characters.