# liberty-db [![pipeline](https://github.com/zao111222333/liberty-db/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/zao111222333/liberty-db/actions/workflows/build.yml) [![pipeline](https://github.com/zao111222333/liberty-db/actions/workflows/bench_deploy.yml/badge.svg?branch=master)](https://github.com/zao111222333/liberty-db/actions/workflows/bench_deploy.yml) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![liberty-db](https://shields.io/crates/v/liberty-db.svg?style=flat-square&label=liberty-db)](https://crates.io/crates/liberty-db) [![Docs](https://docs.rs/liberty-db/badge.svg)](https://docs.rs/liberty-db) [![Benchmark](https://img.shields.io/badge/Benchmark-8A2BE2)](https://zao111222333.github.io/liberty-db/bench) [![codecov](https://codecov.io/github/zao111222333/liberty-db/graph/badge.svg?token=AI2BVDIFOI)](https://codecov.io/github/zao111222333/liberty-db) ## Highlight Features + Support all `liberty` attributes with typed datastructure, rather than syntax tree (AST) only, in the definition of [Liberty Version R-2020.09, September 2020](https://zao111222333.github.io/liberty-db/2020.09/reference_manual.pdf) + Support [`liberty` boolean expression syntax](https://zao111222333.github.io/liberty-db/2020.09/reference_manual.html?field=test&bgn=132.36+132.41&end=132.38+133.13), employ [binary decesion diagram (BDD)](https://github.com/sybila/biodivine-lib-bdd) to [identify (hashing)](https://docs.rs/liberty-db/latest/liberty_db/expression/struct.IdBooleanExpression.html) + Parser & formatter are implemented by static macros, providing a decent preformance and tiny ~3MB `parser & formatter` binary. See [benchmark summary](https://zao111222333.github.io/liberty-db/bench) + Support `define define_group` user-defined attributes + Verified with library-complier, well defined [document](https://docs.rs/liberty-db/latest/liberty_db/library/struct.Library.html), and [examples](examples) provided ## Usage This library is implemented in [Rust](https://doc.rust-lang.org/book/ch01-00-getting-started.html), with [document](https://docs.rs/liberty-db). ```toml [dependencies] liberty_db = "0.7" ``` You can run [examples](examples) with commands: ``` shell # 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 ``` ## Benchmark Basic information as follow, see latest [benchmark summary](https://zao111222333.github.io/liberty-db/bench). ### Project Comparison
ProjectLangVersionType SupportBoolean
Expression
Comment
AllPartlyAST only
liberty-dbrustlatestcurrent version
si2dr_libertyC1.0Synopsys's version at 2005, many attributes are not supported
OpenTimerC++172STA tool's liberty component
liberty-iorust0.0.4
libertyparserust0.3.0
liberty2jsonrust0.1.0
### Self Regression
ProjectLangVersionType SupportBoolean
Expression
Comment
AllPartlyAST only
liberty-dbrustlatestcurrent version
liberty-dbrust0.6.3published at 2024-09-07
liberty-dbrust0.5.9published at 2024-08-27
liberty-dbrust0.4.13published at 2024-08-13
liberty-dbrust0.3.1published at 2023-08-03
## Dev Run unit-test and regression. ```shell cargo test cargo test --package dev ``` Run benchmark, it will takes 5h. ```shell cargo bench --bench dev ``` ## TODO + Reconstruction: + parser to `GroupBuilder`, e.g., use `Vec` to store `GroupSet`, no comment attribute + build/link `GroupBuilder` to `Group`, providing parent's `scope`, e.g. + all `Pin` name set to build BDD + supper group like `timing::TimingTableLookUp` + check all rules + Parse: + ~~Only `Vec>` and `Value` complex attributes need quotes vector, use `fast_float2::parse_partial`~~ + ~~Fix error when `make_golden`~~ + ~~`intrinsic_parasitic` group~~ + ~~`leakage_current` group~~ + ~~`dynamic_current` group~~ + async + stream input + CI: + only do comparsion after tag new version + fast regression self in build.yml + Other: + BDD use ArcStr + Linked Group + like IndexMap, only sort once and store + bitcode support + Finished + ~~user `define`~~ + ~~remove `GroupWapper`, `ComplexWapper`, `SimpleWapper`. At leaset remove it in parser and formatter~~ + ~~fix missing newline at endding~~ + ~~recursive parse boolean expression~~ + ~~macros~~ + ~~format to `liberty`~~ + ~~support multi-line `\`~~ + ~~support comment~~ + ~~Use `MutSet` to store GroupMap~~