# parseliberty

> Liberty .lib parser implemented in Java

- Catalog id: `Parseliberty`; bundle: `parseliberty`; latest version 20261018
- Documentation page: https://edautils.com/RTLUtils.html
- Keywords: Liberty parser, .lib parser, standard cell library, timing library, Java API
- Terms: as stated on edautils.com, EDAUtils tools are free for commercial and academic use, with no license server. The bundle's own metadata says: "Free to evaluate with the bundled licence; commercial licences from help@edautils.com". Licence prerequisites per tool are under "How an agent runs it".
- This file: https://edautils.com/capabilities/parseliberty.md

## Downloads

- EDAUtils download site: https://edautils.ai/download/Parseliberty (latest file `parseliberty-20261018.tar.gz`)
- SourceForge: https://sourceforge.net/projects/parsers-liberty-upf-sdc-vcd/files/parseliberty/
- GitHub Releases: https://github.com/edautils/releases/releases/download/RELEASE_20261018/parseliberty-20261018.tar.gz (release `RELEASE_20261018`; all releases: https://github.com/edautils/releases/releases)

## How an agent runs it

The following is the AGENTS.md shipped at the root of the bundle.

Reads a Liberty (`.lib`) timing/power library and writes it back out as an equivalent Liberty file
(default `decompiled.lib`). This is a round-trip check of the Liberty parser, whose Java API is the main
deliverable of the bundle (javadoc in `doc/html`). Main class:
`com.eu.miscedautils.libertyparser.ParseLibraryFile` (jar `lib/libertyparser.jar`; the `.bat`
launcher uses the same class).

### Where it ships

Its own bundle, `parseliberty.tar.gz` (flow `parseliberty`; release tree
`release_scripts/parseliberty/1.0`), and as a point tool in the **designplayer-shell** bundle
(`bin/parseliberty` running the shell's jar; this guide as `tools/parseliberty/AGENTS.md`,
examples under `tools/parseliberty/examples/`).

### Prerequisites

- Java on `PATH` (the launcher runs plain `java`). Use Java 11 or newer (Java 21 recommended: the
  release is built and regression-tested with OpenJDK 21); the bundled JAXB and Eclipse libraries
  are class-file version 55, so a Java 8 runtime fails with `UnsupportedClassVersionError`.
- `EDAUTILS_ROOT` = the unpacked bundle directory (must contain `bin/` and `lib/`). The
  launcher exits 1 with "Environment variable EDAUTILS_ROOT is not set" otherwise.
  `source setup_env.sh` (or `setup_env.csh`) from the bundle root sets `EDAUTILS_ROOT`,
  `EDAUTILS_LICENSE_FILE=$EDAUTILS_ROOT/edautils.lic`, prepends `bin/` to `PATH` and sets
  `CLASSPATH=$EDAUTILS_ROOT/lib/libertyparser.jar`.
- Licence: a valid licence file (none: exit status 10) and feature `LIBERTYPARSER`. If the feature is missing,
  `Error: 6404: Failed to checkout LICENSE for the feature : LIBERTYPARSER` is logged, nothing is
  parsed or written, and the exit status is still 0. The licence file is searched in this order:
  `$EDAUTILS_LICENSE_FILE`, `./edautils.lic` (run directory), `$HOME/edautils.lic`,
  `$EDAUTILS_ROOT/edautils.lic`.
- Optional environment: `JAVA_FLAGS` (passed to the JVM, e.g. `-Xmx8g`; with no heap option in it the launcher adds `-Xmx` sized to the machine (`bin/eu_heap.sh`: the largest of 64/32/16/12/8/4 GB within 3/4 of physical or cgroup memory, else 2 GB; `EDAUTILS_MAX_HEAP_GB` caps it) for big libraries),
  `EDAUTILS_LOG_FILE` / `EDAUTILS_APPEND_LOG_FILE` (log file name; the second appends),
  `EDAUTILS_DISABLE_USAGE_TRACKING=true`, `EDAUTILS_PRINT_STACK_TRACE` (stack traces on
  internal exceptions), `EDAUTILS_ENABLE_DEBUG_ENVIRONMENT=1` (debug messages).
  No tool-specific environment variables are read.
- No external tools needed.

### Invocation

```
parseliberty -in <file.lib> [-out <file>]
```

| Option | Meaning |
|---|---|
| `-in <file>` | Liberty file to read (mandatory) |
| `-out <file>` | Output Liberty file (default `decompiled.lib`) |
| `-user <email>` | Usage-tracking user id |
| `-help` | Print usage and return (`-h` is not recognised) |

There is no `-nobanner`, `-l`, `-quiet` or `-suppress`. Any other option prints "Unrecognized option"
(Error 7024) followed by the usage. With no arguments, or without `-in`, the usage is printed.

### Inputs / Outputs

- Reads: the `-in` Liberty file.
- Writes: `-out` (default `decompiled.lib` in the current directory). It is written only if at least
  one `library` group was parsed.
- Log: `ParseLibraryFile.log` in the current directory (override with `EDAUTILS_LOG_FILE`). Every
  console line is also written to the log.

### Exit status and messages

- 0 on a normal finish, **including runs that reported errors** (parse errors, missing licence
  feature, usage errors). 1 = the `-out` file cannot be opened. 10 = no valid licence file.
  1 = `EDAUTILS_ROOT` missing/invalid. An option given without its value throws an index
  exception, which is printed as an internal error, and the exit status is 0.
- Message format: `ParseLibraryFile: <Severity>: <id>: <text>`, severity one of `Error`,
  `Fatal Error`, `Warning`, `Note`. `<id>` is a 5-digit message number. Usage lines have no severity or id.
- The banner is always printed. A run that parses ends with
  `ParseLibraryFile: Note: <id>: Found N error(s) and M warning(s) ...`, and a successful write logs
  `Written decompiled Library in file : <out>`. The usage paths return before that summary.

### Examples

Shipped: `examples/Example_Aplication/src/` holds only Java source (`ParseLibraryFile.java`,
`FLPDecompiler.java`) showing API use. It has no `runme.csh` and no sample `.lib`, and the release self-test
runs nothing for this bundle.

From the regression suite (reference: `tests.edautilscommandline/tests/parseliberty/lsi_10k/runme.csh`
via `../runme_common.csh`; goldens `decompiled.lib.gld`, `ParseLibraryFile.log.gld`):

```
parseliberty -in lsi_10k.lib -out decompiled.lib
```

The large-input case is `tests.edautilscommandline/tests/bigparse/bigliberty/runme.csh` (`parseliberty -in $infile -out decompiled.lib`).

### Integration notes

- Non-interactive; does not read stdin. Run with `</dev/null`.
- Writes the log and default output into the current directory: give each parallel run its
  own working directory (or distinct `-out` and `EDAUTILS_LOG_FILE`).
- Set `EDAUTILS_DISABLE_USAGE_TRACKING=true` to stop usage registration.
- Success test: exit status 0 **and** the log contains `Found 0 error(s)` **and** the `-out` file exists.

### See also

lib2verilog, verilog2lib; API docs in `doc/html/index.html`.
