| Crates.io | liberty-macros |
| lib.rs | liberty-macros |
| version | 0.16.5 |
| created_at | 2023-02-27 18:09:13.757645+00 |
| updated_at | 2025-09-10 01:16:21.09482+00 |
| description | `liberty` macros |
| homepage | |
| repository | https://github.com/zao111222333/liberty-db/ |
| max_upload_size | |
| id | 796260 |
| size | 71,614 |
Fully defined liberty (std. cells in VLSI) data structure, efficient parser & formatter.
liberty attributes with typed datastructure, rather than syntax tree (AST) only, in the definition of Liberty Version R-2020.09, September 2020liberty boolean expression syntax, use binary decesion diagram (BDD) to identify (hashing)parser & formatter binary. See benchmark summarydefine define_group user-defined attributesThis library is implemented in Rust, with document.
[dependencies]
liberty-db = "0.16"
One basic demo here:
use liberty_db::{DefaultCtx, Library, MutSetExt, PinId};
use std::{
fs::File,
io::{BufWriter, Write},
};
static TEMPLATE: &str = r#"
library(demo) {
time_unit : "1ps";
voltage_unit : "10mV";
current_unit : "1uA";
operating_conditions ( typical ) {
process : 1;
voltage : 1.1;
}
lu_table_template(delay_template_4x5) {
variable_1 : total_output_net_capacitance;
variable_2 : input_net_transition;
index_1 ("1000.0, 1001.0, 1002.0, 1003.0");
index_2 ("1000.0, 1001.0, 1002.0, 1003.0, 1004.0");
}
cell (DFF) {
pin (D) {}
pin (CK) {}
pin (Q) {}
}
}"#;
fn main(){
let mut library = Library::<DefaultCtx>::parse_lib(TEMPLATE, None).unwrap();
// modify library
library.cell.get_mut("DFF").map(|cell_dff| {
cell_dff
.pin
.get_mut(&PinId::from("CK"))
.map(|pin_ck| pin_ck.clock = Some(true))
});
// print library
println!("{library}");
// write library
let out_file = File::create("demo.lib").unwrap();
let mut writer = BufWriter::new(out_file);
write!(&mut writer, "{}", library).unwrap();
}
See more examples, and run them if you clone this repo:
# example0
cargo run --example 0_parse_fmt
# example1
cargo run --example 1_parse_fmt_file -- dev/tech/cases/ocv.lib
# example2
cargo run --example 2_prune_lib -- dev/tech/cases/ocv.lib
# example3
cargo run --example 3_lookup_timing
Or you can download the releases/latest/examples.zip, then
cd ./examples_x86_64-unknown-linux-musl
# example0
./0_parse_fmt
# example1
./1_parse_fmt_file dev/tech/cases/ocv.lib
# example2
./2_prune_lib dev/tech/cases/ocv.lib
# example3
./3_lookup_timing
Basic information as follow, see latest benchmark summary.
| Project | Lang | Version | Type Support | Boolean Expression | Comment | ||
|---|---|---|---|---|---|---|---|
| All | Partly | AST only | |||||
| liberty-db | rust | latest | ✓ | ✓ | current version | ||
| si2dr_liberty | C | 1.0 | ✓ | ✓ | Synopsys's version at 2005, many attributes are not supported | ||
| OpenTimer | C++17 | 2 | ✓ | ✓ | STA tool's liberty component | ||
| liberty-io | rust | 0.0.4 | ✓ | ||||
| libertyparse | rust | 0.3.0 | ✓ | ✓ | |||
| liberty2json | rust | 0.1.0 | ✓ | ||||
Run unit-test and regression.
cargo test --release
Run benchmark, it will takes 40mins.
cargo bench --package dev --bench benchmark --features bench