-
Notifications
You must be signed in to change notification settings - Fork 1
All Aboute liberty2json
Eric edited this page Mar 27, 2021
·
3 revisions
This page introduce two major usage of liberty2json, including using as standalone CLI(command line interface) and as binary package.
Use liberty2json as CLI is the primary design goal. It read in a large liberty file and separates it into *.libray.lib.json and multi *.cell.lib.json, containing liberty header information and liberty cell information respectively.
Use liberty2json as binary is also considered because this crate also contain a liberty file parser natively.If you want to use this crate as your third-party tool, it may also help.
After parsing the whole liberty file, you get the Liberty AST struct. whose structure is defined as
pub struct Liberty {
pub name: String,
pub single_attribute: HashMap<String, LibertyJson>,
pub group_attribute: HashMap<String, LibertyJson>,
pub ffs: HashMap<String, LibertyJson>,
pub latchs: HashMap<String, LibertyJson>,
pub fillers: HashMap<String, LibertyJson>,
pub icgs: HashMap<String, LibertyJson>,
pub logics: HashMap<String, LibertyJson>,
pub testffs: HashMap<String, LibertyJson>,
}
Indexing
// assume you got the Liberty
let data:Liberty = ...
// index ff cell by name
let cell = data.ffs[name];
// index cell pin by name
let pin = cell["pin"][pin_name];
// index cell power&ground pin
let pg_pin = cell["pg_pin"];
// index ff definition, not parsed currently
let ff = cell["ff"];
// index cell pin timing and power
let pin_timing = pin["timing"];
let pin_power = pin["internal_power"];